Exemple #1
0
        public Model(HelperKinsky aHelper)
        {
            aHelper.SetStackExtender(this);
            aHelper.Stack.EventStatusChanged += StatusChanged;

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

            iLocalPlaylists  = new LocalPlaylists(aHelper, true);
            iRemotePlaylists = new RemotePlaylists(aHelper);
            iLibrary         = new MediaProviderLibrary(aHelper);
            iSupport         = new MediaProviderSupport(iHttpServer);

            PluginManager pluginManager = new PluginManager(aHelper, iHttpClient, iSupport);

            iLocator = new ContentDirectoryLocator(pluginManager, this);

            OptionBool optionLocalPlaylists  = iLocator.Add(LocalPlaylists.kRootId, iLocalPlaylists);
            OptionBool optionRemotePlaylists = iLocator.Add(RemotePlaylists.kRootId, iRemotePlaylists);

            iLocator.Add(MediaProviderLibrary.kLibraryId, iLibrary);

            aHelper.AddOptionPage(iLocator.OptionPage);

            iPlaySupport     = new PlaySupport();
            iSaveSupport     = new SaveSupport(aHelper, iRemotePlaylists, optionRemotePlaylists, iLocalPlaylists, optionLocalPlaylists);
            iViewSaveSupport = new ViewSaveSupport(SavePlaylistHandler, iSaveSupport);
        }
Exemple #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)
        {
            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);
        }
Exemple #3
0
        public FormKinskyDesktop(HelperKinsky aHelperKinsky)
        {
            iCurrentView = 0;

            iHelper = aHelperKinsky;

            KinskyDesktop.Properties.Resources.SetBasePath(iHelper.ExePath.FullName);

            InitializeComponent();

            if (Environment.OSVersion.Platform == PlatformID.Unix)
            {
                SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
            }

            Icon = Icon.FromHandle(Linn.Kinsky.Properties.Resources.KinskyLogo.GetHicon());

            SplitContainer.Panel1MinSize    = 200;
            SplitContainer.Panel2MinSize    = 200;
            SplitContainer.SplitterDistance = (int)(Width * 0.5f);

            Text = iHelper.Product;

            notifyIcon.Text = iHelper.Product;
            try
            {
                notifyIcon.Icon = Icon;
            }
            catch (NotImplementedException) { } // thrown on MacOSX

            kHeaderLeft   = KinskyDesktop.Properties.Resources.Wing1;
            kHeaderRight  = KinskyDesktop.Properties.Resources.Wing2;
            kHeaderFiller = KinskyDesktop.Properties.Resources.FillerTop;

            kFooterLeft   = KinskyDesktop.Properties.Resources.Wing3;
            kFooterRight  = KinskyDesktop.Properties.Resources.Wing4;
            kFooterFiller = KinskyDesktop.Properties.Resources.FillerBottom;

            kRightEdgeFiller = KinskyDesktop.Properties.Resources.RightEdgeFiller;
            kLeftEdgeFiller  = KinskyDesktop.Properties.Resources.LeftEdgeFiller;

            kMiniLeft   = KinskyDesktop.Properties.Resources.MiniWing1;
            kMiniRight  = KinskyDesktop.Properties.Resources.MiniWing2;
            kMiniFiller = KinskyDesktop.Properties.Resources.MiniFiller;

            iBrushHeaderFiller = new TextureBrush(kHeaderFiller);
            iBrushLeftFiller   = new TextureBrush(kLeftEdgeFiller);
            iBrushLeftFiller.TranslateTransform(0, kHeaderLeft.Height);
            iBrushRightFiller  = new TextureBrush(kRightEdgeFiller);
            iBrushFooterFiller = new TextureBrush(kFooterFiller);
            iBrushMiniFiller   = new TextureBrush(kMiniFiller);

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

            iUiOptions = new UiOptions(iHelper);

            iOptionPageGeneral = new OptionPageGeneral();
            iHelper.AddOptionPage(iOptionPageGeneral);

            iOptionPageColours = new OptionPageColours();
            iHelper.AddOptionPage(iOptionPageColours);

            iOptionPageFonts = new OptionPageFonts();
            iHelper.AddOptionPage(iOptionPageFonts);

            iArtworkCache = new ArtworkCache(ArtworkCache.ECacheSize.eMedium);

            iViewSupport = new ViewSupport(iOptionPageColours, iOptionPageFonts);

            iLibrary         = new MediaProviderLibrary(iHelper);
            iLocalPlaylists  = new LocalPlaylists(iHelper, true);
            iSharedPlaylists = new SharedPlaylists(iHelper);

            MediaProviderSupport mediaProviderSupport = new MediaProviderSupport(iHttpServer);

            iOptionPageGeneral.EventTransparencyChanged      += TransparencyOrBorderChanged;
            iOptionPageGeneral.EventWindowBorderChanged      += TransparencyOrBorderChanged;
            iOptionPageGeneral.EventHideMouseCursorChanged   += HideMouseCursorChanged;
            iOptionPageGeneral.EventUseRotaryControlsChanged += UseRotaryControlsChanged;
            iOptionPageGeneral.EventShowToolTipsChanged      += ShowToolTipsChanged;
            iViewSupport.EventSupportChanged += EventSupportChanged;

            iFormUserLog = new FormUserLog(Icon);

            iViewStatus                 = new FormStatus(this, iArtworkCache, iViewSupport);
            iViewStatus.UseTheme        = false;
            iViewStatus.Icon            = Icon;
            iViewStatus.Visible         = false;
            iViewStatus.TopLevel        = false;
            iViewStatus.FormBorderStyle = FormBorderStyle.None;
            iViewStatus.MouseMove      += FormKinskyDesktop_MouseMove;
            Controls.Add(iViewStatus);

            PluginManager pluginManager = new PluginManager(iHelper, iHttpClient, mediaProviderSupport);

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

            iSaveSupport     = new SaveSupport(iHelper, iSharedPlaylists, optionSharedPlaylists, iLocalPlaylists, optionLocalPlaylists);
            iViewSaveSupport = new ViewSaveSupport(RequestLocalPlaylistFilename, iSaveSupport);

            iPlaySupport = new PlaySupport();

            // create the DropConverter for the browse views
            DropConverter browseDropConverter = new DropConverter();

            browseDropConverter.Add(new DropConverterInternal());
            browseDropConverter.Add(new DropConverterUri());
            browseDropConverter.Add(new DropConverterFileDrop(iHttpServer, false));
            browseDropConverter.Add(new DropConverterText());

            MediatorLocation location = new MediatorLocation();

            MediatorTab tab = new MediatorTab(this, location);

            IBrowser b = new Browser(new Location(iLocator));

            tab.Add(new ViewWidgetTabPage(this, 0), new ViewWidgetBrowser(this, b, iArtworkCache, iViewSupport, iPlaySupport, browseDropConverter, iUiOptions), b);
            b = new Browser(new Location(iLocator));
            tab.Add(new ViewWidgetTabPage(this, 1), new ViewWidgetBrowser(this, b, iArtworkCache, iViewSupport, iPlaySupport, browseDropConverter, iUiOptions), b);
            b = new Browser(new Location(iLocator));
            tab.Add(new ViewWidgetTabPage(this, 2), new ViewWidgetBrowser(this, b, iArtworkCache, iViewSupport, iPlaySupport, browseDropConverter, iUiOptions), b);
            b = new Browser(new Location(iLocator));
            tab.Add(new ViewWidgetTabPage(this, 3), new ViewWidgetBrowser(this, b, iArtworkCache, iViewSupport, iPlaySupport, browseDropConverter, iUiOptions), b);

            location.Add(tab);

            ViewWidgetBreadcrumb breadcrumb = new ViewWidgetBreadcrumb(this, iViewSupport, location, new ViewWidgetButtonUp(this));

            location.Add(breadcrumb);

            // create the DropConverter for the other views
            DropConverter viewDropConverter = new DropConverter();

            viewDropConverter.Add(new DropConverterInternal());
            viewDropConverter.Add(new DropConverterUri());
            viewDropConverter.Add(new DropConverterFileDrop(iHttpServer, true));
            viewDropConverter.Add(new DropConverterText());

            iSourceList = new ReceiverSourceList(iHelper);

            iView  = new View(this, iArtworkCache, iViewSupport, iPlaySupport, iViewSaveSupport, viewDropConverter, iSourceList, iHelper.Senders);
            iModel = new Model(iView, iPlaySupport);

            iMediator = new Mediator(iHelper, iModel);

            iHelper.SetStackExtender(this);
            iHelper.Stack.SetStatusHandler(new StackStatusHandlerWinForms(iHelper.Title, notifyIcon));
        }
        // 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);
        }
Exemple #5
0
        internal void InitialiseStack()
        {
            OptionPage generalOptionsPage = new OptionPage("General");

            iHideCursorOption = new OptionBool("hidecursor", "Hide Cursor", "Hide Cursor", false);
            generalOptionsPage.Add(iHideCursorOption);
            iRotaryControlsOption = new OptionBool("rotarycontrol", "Use rotary controls", "Use rotary controls", true);
            generalOptionsPage.Add(iRotaryControlsOption);
            iShowToolTipsOption = new OptionBool("tooltips", "Show tooltips", "Show tooltips", true);
            generalOptionsPage.Add(iShowToolTipsOption);
            iShowExtendedTrackInfoOption = new OptionBool("trackinfo", "Extended track info", "Show extended track information", true);
            generalOptionsPage.Add(iShowExtendedTrackInfoOption);
            iGroupPlaylistOption = new OptionBool("groupplaylist", "Group playlist items by album", "Allows grouping of items within the playlist window", false);
            generalOptionsPage.Add(iGroupPlaylistOption);
            iTransparentOption = new OptionBool("customwindow", "Transparent window (requires restart)", "Toggles custom window", true);
            generalOptionsPage.Add(iTransparentOption);
            iSoftwareRenderingOption = new OptionBool("softwarerendering", "Force software rendering (requires restart)", "Disables hardware rendering for troublesome display cards", false);
            generalOptionsPage.Add(iSoftwareRenderingOption);
            iHelper.AddOptionPage(generalOptionsPage);

            iOptionPageUpdates = new OptionPageUpdates(iHelper);
            iHelper.AddOptionPage(iOptionPageUpdates);



            OptionPage fontsOptionPage = new OptionPage("Fonts");

            iFontsOption = new OptionEnum("fontsize", "Font size", "Font size");
            iFontsOption.AddDefault(kFontOptionNormal);
            iFontsOption.Add(kFontOptionLarge);
            fontsOptionPage.Add(iFontsOption);

            iHideCursorOption.EventValueChanged            += OnOptionChanged;
            iRotaryControlsOption.EventValueChanged        += OnOptionChanged;
            iShowToolTipsOption.EventValueChanged          += OnOptionChanged;
            iShowExtendedTrackInfoOption.EventValueChanged += OnOptionChanged;
            iFontsOption.EventValueChanged              += OnOptionChanged;
            iTransparentOption.EventValueChanged        += OnOptionChanged;
            iOptionPageUpdates.EventBetaVersionsChanged += OnUpdatesChanged;
            iOptionPageUpdates.EventAutoUpdateChanged   += OnUpdatesChanged;

            iHelper.AddOptionPage(fontsOptionPage);

            iViewMaster = new ViewMaster();
            iHttpServer = new HttpServer(HttpServer.kPortKinskyDesktop);
            iHttpClient = new HttpClient();

            iLibrary         = new MediaProviderLibrary(iHelper);
            iSharedPlaylists = new SharedPlaylists(iHelper);
            iLocalPlaylists  = new LocalPlaylists(iHelper, true);

            iSupport = new MediaProviderSupport(iHttpServer);

            PluginManager pluginManager = new PluginManager(iHelper, iHttpClient, iSupport);

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

            iLocator.Add(MediaProviderLibrary.kLibraryId, iLibrary);
            iHelper.AddOptionPage(iLocator.OptionPage);

            iSaveSupport     = new SaveSupport(iHelper, iSharedPlaylists, optionSharedPlaylists, iLocalPlaylists, optionLocalPlaylists);
            iViewSaveSupport = new ViewSaveSupport(RequestLocalPlaylistFilename, iSaveSupport);
            iPlaySupport     = new PlaySupport();

            iHelper.ProcessOptionsFileAndCommandLine();
            SetUpdateTypes();
        }
Exemple #6
0
        private void InitialiseStack()
        {
            iEventCreated.WaitOne();
            iEventLock       = new object();
            iUserLogListener = new AndroidUserLogListener();
            UserLog.AddListener(iUserLogListener);
            iTraceListener = new AndroidTraceListener();
            Trace.AddListener(iTraceListener);
            iInvoker         = new Invoker(this.ApplicationContext);
            iResourceManager = new AndroidResourceManager(this.Resources);
            iIconResolver    = new IconResolver(iResourceManager);
            iLayoutInflater  = (LayoutInflater)GetSystemService(Context.LayoutInflaterService);

            iHelperKinsky = new HelperKinsky(new string[2] {
                "-t", kTraceLevel
            }, Invoker);
            Android.Runtime.AndroidEnvironment.UnhandledExceptionRaiser += UnhandledExceptionRaiser;

            // name the crash dumper section general and add other UI options
            OptionPageCrashDumper generalOptions = new OptionPageCrashDumper("General");

            iOptionExtendedTrackInfo = new OptionBool("trackinfo", "Extended track info", "Show extended track information for the current track", true);
            generalOptions.Add(iOptionExtendedTrackInfo);
            iOptionEnableRocker = new OptionBool("rocker", "Button controls", "Enable button controls for controlling volume and seeking", false);
            generalOptions.Add(iOptionEnableRocker);
            iOptionGroupTracks = new OptionBool("groupplaylist", "Group playlist tracks", "Grouping tracks by album within the playlist window", true);
            generalOptions.Add(iOptionGroupTracks);

            iOptionAutoLock = new OptionEnum("autolock", "Prevent auto-lock", "When to prevent auto-lock");
            iOptionAutoLock.AddDefault(kAutoLockNever);
            iOptionAutoLock.Add(kAutoLockCharging);
            iOptionAutoLock.Add(kAutoLockAlways);
            generalOptions.Add(iOptionAutoLock);
            iOptionAutoLock.EventValueChanged += OptionAutoLock_EventValueChangedHandler;
            iHelperKinsky.AddOptionPage(generalOptions);

            iHelperKinsky.SetStackExtender(this);
            iCrashLogDumper = new CrashDumper(this.ApplicationContext, Resource.Drawable.Icon, iHelperKinsky, generalOptions);
            iHelperKinsky.AddCrashLogDumper(iCrashLogDumper);

            iOptionInsertMode = new OptionInsertMode();
            iHelperKinsky.AddOption(iOptionInsertMode);

            iViewMaster = new ViewMaster();
            iHttpServer = new HttpServer(HttpServer.kPortKinskyDroid);
            iHttpClient = new HttpClient();

            iLibrary         = new MediaProviderLibrary(iHelperKinsky);
            iSharedPlaylists = new SharedPlaylists(iHelperKinsky);
            iLocalPlaylists  = new LocalPlaylists(iHelperKinsky, false);

            PluginManager pluginManager = new PluginManager(iHelperKinsky, iHttpClient, new MediaProviderSupport(iHttpServer));

            iLocator = new ContentDirectoryLocator(pluginManager, new AppRestartHandler());

            OptionBool optionSharedPlaylists = iLocator.Add(SharedPlaylists.kRootId, iSharedPlaylists);
            OptionBool optionLocalPlaylists  = iLocator.Add(LocalPlaylists.kRootId, iLocalPlaylists);

            iLocator.Add(MediaProviderLibrary.kLibraryId, iLibrary);
            iHelperKinsky.AddOptionPage(iLocator.OptionPage);

            iSaveSupport = new SaveSupport(iHelperKinsky, iSharedPlaylists, optionSharedPlaylists, iLocalPlaylists, optionLocalPlaylists);
            iPlaySupport = new PlaySupport();
            iHelperKinsky.ProcessOptionsFileAndCommandLine();

            Linn.Kinsky.Model model = new Linn.Kinsky.Model(iViewMaster, iPlaySupport);
            iMediator = new Mediator(iHelperKinsky, model);

            iAndroidViewMaster = new AndroidViewMaster(this,
                                                       iViewMaster,
                                                       iInvoker,
                                                       iResourceManager,
                                                       iSaveSupport,
                                                       iIconResolver,
                                                       iOptionGroupTracks,
                                                       iOptionExtendedTrackInfo,
                                                       IsTabletView ? kMaxImageCacheSizeTablet : kMaxImageCacheSizePhone);

            iStackWatchdog = new System.Threading.Timer(StackWatchdogExpired);
            iPowerListener = new PowerStateListener(this.ApplicationContext);
            iPowerListener.EventPowerStateChanged += EventPowerStateChangedHandler;

            iIsCharging  = PowerStateListener.IsConnected(this.ApplicationContext);
            iRescanTimer = new System.Threading.Timer((e) =>
            {
                Rescan();
            });
            iRescanTimer.Change(Timeout.Infinite, Timeout.Infinite);
            SetAutoLock();
            EventLowMemory += EventLowMemoryHandler;
            iInitialised    = true;
            StartStack();
        }