Applying Trackbeam Theme: FinishedLaunching - no suitable method found to override

I try to apply the Trackbeam Theme to my Xamarin.iOS App. I have downloaded the theme via Project -> Get More Components ... and added the following code to my .cs file of one controller:
public override bool FinishedLaunching (UIApplication app, NSDictionary options) { ThemeManager.Register<TrackBeamTheme>().Apply(); }

When I try to run the app in the debugger I get the following error:
FinishedLaunching(UIKit.UIApplication, Foundation.NSDictionary) is marked as an override but no suitable method found to override (CS0115) (04_EinGaben)

Where do I have to put the FinishesLaunching Method?

Greets from Austria,
Fabian

Tagged:

Answers

  • I have added the function to the AppDelegate.cs file:

    public override bool FinishedLaunching (UIApplication app, NSDictionary options)
    {
            ThemeManager.Register<TrackBeamTheme>().Apply(Window);
        return true;
    }
    

    But my App do look the same as before. Is there anything I have to edit?

  • ashalvaashalva GEMember ✭✭✭

    If you download the component of trackbeam there is a sample folder, where you can see how to implement it.
    https://components.xamarin.com/gettingstarted/trackbeamtheme/true
    Download, unzip and look for the folder samples there.

  • FabianGeisslerFabianGeissler ATMember
    edited February 2016

    I tried it, but in the sample there is also the following code in the AppDelegate.cs:
    public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
    {
    //Register the theme and use Fluent API to apply to the application
    ThemeManager.Register().Apply();

            //Use a custom theme
            //ThemeManager.Register<CustomTheme>().Apply();
    
            ////Use the V1 APi
            //Xamarin.Themes.V1.TrackBeam.TrackBeamTheme.Apply();
            return true;
        }
    

    My method in the AppDelegate.cs looks like this:
    public override bool FinishedLaunching (UIApplication app, NSDictionary options)
    {
    ThemeManager.Register().Apply();

            return true;
        }
    

    But this throws me the following exception: System.NullReferenceException Object Reference not set to an instance of an object

    When I use ThemeManager.Register<TrackBeamTheme>().Apply(Windows); in my AppDelegate the Simulator starts without any problems but the Theme is not applied.

    What do I do wrong?

Sign In or Register to comment.