Esempio n. 1
0
        // This method is invoked when the application has loaded its UI and its ready to run
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            CreateNotificationView();
            Xamarin.Insights.Identify(Helper.OptionInstallId.Value, null);
            ObjCRuntime.Class.ThrowOnInitFailure = false;

            Ticker tick = new Ticker();

            helper.Helper.SetStackExtender(this);
            helper.Helper.Stack.EventStatusChanged += StatusChanged;

            viewControllerRooms.StandbyButtonOffsetX = 5;

            ArtworkCacheInstance.Instance = new ArtworkCache();

            controlRotaryVolume.ViewBar.FontSize          = 12.0f;
            controlRotaryVolume.ViewBar.InnerCircleRadius = 25.0f;
            controlRotaryVolume.ViewBar.OuterCircleRadius = 30.0f;
            iViewWidgetVolumeControl = new ViewWidgetVolumeControl(controlRotaryVolume);

            iViewWidgetVolumeRotary = new ViewWidgetVolumeRotary("VolumeRotary", null);

            iViewWidgetVolumeButtons = new ViewWidgetVolumeButtons("VolumeButtons", null);
            iViewWidgetVolumeButtons.RepeatInterval = 0.1f;

            iVolumeController = new VolumeControllerIphone(viewControllerNowPlaying, iViewWidgetVolumeRotary, iViewWidgetVolumeButtons, controlVolume, controlTime, scrollView);
            iVolumeController.SetRockers(helper.OptionEnableRocker.Native);

            controlRotaryTime.ViewBar.FontSize          = 12.0f;
            controlRotaryTime.ViewBar.InnerCircleRadius = 25.0f;
            controlRotaryTime.ViewBar.OuterCircleRadius = 30.0f;
            iViewWidgetTime = new ViewWidgetTime(controlRotaryTime, viewHourGlass);

            iViewWidgetTimeRotary = new ViewWidgetTimeRotary("TimeRotary", null, iViewWidgetTime);

            iViewWidgetTimeButtons = new ViewWidgetTimeButtons("TimeButtons", null, iViewWidgetTime);
            iViewWidgetTimeButtons.RepeatInterval = 0.1f;

            iTimeController = new TimeControllerIphone(viewControllerNowPlaying, iViewWidgetTimeRotary, iViewWidgetTimeButtons, controlTime, controlVolume, scrollView);
            iTimeController.SetRockers(helper.OptionEnableRocker.Native);

            helper.OptionEnableRocker.EventValueChanged += delegate(object sender, EventArgs e) {
                iVolumeController.SetRockers(helper.OptionEnableRocker.Native);
                iTimeController.SetRockers(helper.OptionEnableRocker.Native);
            };

            Reachability.LocalWifiConnectionStatus();
            Reachability.ReachabilityChanged += delegate(object sender, EventArgs e) {
                OnReachabilityChanged();
            };

            new Action(delegate {
                Ticker ticker = new Ticker();

                iViewMaster = new ViewMaster();

                iHttpServer = new HttpServer(HttpServer.kPortKinskyTouch);
                iHttpClient = new HttpClient();

                iLibrary         = new MediaProviderLibrary(helper.Helper);
                iSharedPlaylists = new SharedPlaylists(helper.Helper);
                iLocalPlaylists  = new LocalPlaylists(helper.Helper, false);
                iLocalPlaylists.SaveDirectory.ResetToDefault();

                iPlaySupport = new PlaySupport();
                MediaProviderSupport support = new MediaProviderSupport(iHttpServer);
                PluginManager pluginManager  = new PluginManager(helper.Helper, iHttpClient, support);

                iLocator = new ContentDirectoryLocator(pluginManager, new AppRestartHandler());
                iLocator.Add(MediaProviderLibrary.kLibraryId, iLibrary);
                OptionBool optionSharedPlaylists = iLocator.Add(SharedPlaylists.kRootId, iSharedPlaylists);
                OptionBool optionLocalPlaylists  = iLocator.Add(LocalPlaylists.kRootId, iLocalPlaylists);

                iSaveSupport     = new SaveSupport(helper.Helper, iSharedPlaylists, optionSharedPlaylists, iLocalPlaylists, optionLocalPlaylists);
                iViewSaveSupport = new ViewSaveSupport(SavePlaylistHandler, iSaveSupport);

                helper.Helper.AddOptionPage(iLocator.OptionPage);

                InvokeOnMainThread(delegate {
                    AddViews();
                });

                iModel    = new Model(iViewMaster, iPlaySupport);
                iMediator = new Mediator(helper.Helper, iModel);

                OnFinishedLaunching();

                UserLog.WriteLine(string.Format("FinishedLaunching background tasks in {0} ms", ticker.MilliSeconds));
            }).BeginInvoke(null, null);

            //Trace.Level = Trace.kKinskyTouch;

            // If you have defined a view, add it here:
            navigationController.View.Frame = new CGRect(CGPoint.Empty, viewBrowser.Frame.Size);
            viewBrowser.InsertSubview(navigationController.View, 0);

            window.RootViewController = viewController;

            window.MakeKeyAndVisible();

            UserLog.WriteLine(string.Format("FinishedLaunching in {0} ms", tick.MilliSeconds));

            return(true);
        }
Esempio n. 2
0
        // This method is invoked when the application has loaded its UI and its ready to run
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Ticker tick = new Ticker();

            helper.Helper.SetStackExtender(this);
            helper.Helper.Stack.EventStatusChanged += StatusChanged;

            ArtworkCacheInstance.Instance = new ArtworkCache();

            controlRotaryVolume.ViewBar.FontSize          = 15.0f;
            controlRotaryVolume.ViewBar.InnerCircleRadius = 30.0f;
            controlRotaryVolume.ViewBar.OuterCircleRadius = 35.0f;
            iViewWidgetVolumeControl = new ViewWidgetVolumeControl(controlRotaryVolume);

            iViewWidgetVolumeButtons = new ViewWidgetVolumeButtons("VolumeButtons", null);
            iViewWidgetVolumeButtons.RepeatInterval = 0.1f;

            iViewWidgetVolumeRotary = new ViewWidgetVolumeRotary("VolumeRotary", null);

            iVolumeController = new VolumeControllerIpad(iViewWidgetVolumeButtons, iViewWidgetVolumeRotary, controlVolume);
            iVolumeController.SetRockers(helper.OptionEnableRocker.Native);
            viewController.SetVolumeController(iVolumeController);

            controlRotaryTime.ViewBar.FontSize          = 15.0f;
            controlRotaryTime.ViewBar.InnerCircleRadius = 30.0f;
            controlRotaryTime.ViewBar.OuterCircleRadius = 35.0f;
            iViewWidgetTime = new ViewWidgetTime(controlRotaryTime, viewHourGlass);

            iViewWidgetTimeButtons = new ViewWidgetTimeButtons("TimeButtons", null, iViewWidgetTime);
            iViewWidgetTimeButtons.RepeatInterval = 0.1f;

            iViewWidgetTimeRotary = new ViewWidgetTimeRotary("TimeRotary", null, iViewWidgetTime);

            iTimeController = new TimeControllerIpad(iViewWidgetTimeButtons, iViewWidgetTimeRotary, controlTime);
            iTimeController.SetRockers(helper.OptionEnableRocker.Native);
            viewController.SetTimeController(iTimeController);

            controlVolume.Hidden = false;
            controlTime.Hidden   = false;

            helper.OptionEnableRocker.EventValueChanged += delegate(object sender, EventArgs e) {
                iVolumeController.SetRockers(helper.OptionEnableRocker.Native);
                iTimeController.SetRockers(helper.OptionEnableRocker.Native);
            };

            Reachability.LocalWifiConnectionStatus();
            Reachability.ReachabilityChanged += delegate(object sender, EventArgs e) {
                helper.Helper.Interface.NetworkChanged();
            };

            new Action(delegate {
                Ticker ticker = new Ticker();

                iViewMaster = new ViewMaster();

                iHttpServer = new HttpServer(HttpServer.kPortKinskyTouch);
                iHttpClient = new HttpClient();

                iLibrary         = new MediaProviderLibrary(helper.Helper);
                iSharedPlaylists = new SharedPlaylists(helper.Helper);
                iLocalPlaylists  = new LocalPlaylists(helper.Helper, false);
                iLocalPlaylists.SaveDirectory.ResetToDefault();

                iConfigController = new ConfigControllerIpad(helper.Helper);
                iPlaySupport      = new PlaySupport();

                MediaProviderSupport support = new MediaProviderSupport(iHttpServer);
                PluginManager pluginManager  = new PluginManager(helper.Helper, iHttpClient, support);

                iLocator = new ContentDirectoryLocator(pluginManager, new AppRestartHandler());
                iLocator.Add(MediaProviderLibrary.kLibraryId, iLibrary);
                OptionBool optionSharedPlaylists = iLocator.Add(SharedPlaylists.kRootId, iSharedPlaylists);
                OptionBool optionLocalPlaylists  = iLocator.Add(LocalPlaylists.kRootId, iLocalPlaylists);

                iSaveSupport     = new SaveSupport(helper.Helper, iSharedPlaylists, optionSharedPlaylists, iLocalPlaylists, optionLocalPlaylists);
                iViewSaveSupport = new ViewSaveSupport(SavePlaylistHandler, iSaveSupport);

                helper.Helper.AddOptionPage(iLocator.OptionPage);

                InvokeOnMainThread(delegate {
                    AddViews();
                });

                iModel    = new Model(iViewMaster, iPlaySupport);
                iMediator = new Mediator(helper.Helper, iModel);

                OnFinishedLaunching();

                UserLog.WriteLine(string.Format("FinishedLaunching background tasks in {0} ms", ticker.MilliSeconds));
            }).BeginInvoke(null, null);

            Trace.Level = Trace.kKinskyTouch;

            // If you have defined a view, add it here:
            navigationController.View.Frame = new RectangleF(PointF.Empty, viewBrowser.Frame.Size);
            viewBrowser.InsertSubview(navigationController.View, 0);

            /*ArtworkTileViewFactory f = new ArtworkTileViewFactory(iLibrary);
             * NSBundle.MainBundle.LoadNib("ArtworkTileView", f, null);
             * viewController.View.AddSubview(f.View);
             * f.Initialise();*/

            window.RootViewController = viewController;

            window.MakeKeyAndVisible();

            UserLog.WriteLine(string.Format("FinishedLaunching in {0} ms", tick.MilliSeconds));

            return(true);
        }