Example #1
0
        private void ApplicationStartup(object sender, StartupEventArgs e)
        {
            // this prevents the UI framework from handling unhandled exceptions so that they are let throught
            // to be handled by the Linn code
            System.Windows.Forms.Application.SetUnhandledExceptionMode(System.Windows.Forms.UnhandledExceptionMode.ThrowException);

            // create the app helper
            iHelper = new Helper(Environment.GetCommandLineArgs());
            OptionPagePrivacy optionPagePrivacy = new OptionPagePrivacy(iHelper);

            iHelper.AddOptionPage(optionPagePrivacy);
            iHelper.ProcessOptionsFileAndCommandLine();

            // create crash log dumper
            ICrashLogDumper d = new CrashLogDumperWindow(Songbox.Properties.Resources.Icon, iHelper.Title, iHelper.Product, iHelper.Version);

            iHelper.AddCrashLogDumper(d);

            // create view and helper for auto updates
            iViewAutoUpdate = new Toolkit.Wpf.ViewAutoUpdateStandard(Songbox.Properties.Resources.Icon, Songbox.Properties.Resources.Image106x106);
            iViewAutoUpdate.EventButtonUpdateClicked += EventButtonUpdateClicked;
            iHelperAutoUpdate = new HelperAutoUpdate(iHelper, iViewAutoUpdate, new Invoker(this.Dispatcher));
            iHelperAutoUpdate.OptionPageUpdates.BetaVersions = iHelper.BuildType == EBuildType.Beta;
            iHelperAutoUpdate.Start();

            iPageMain = new Linn.Songbox.PageMain(iHelper, optionPagePrivacy, iHelperAutoUpdate, new StartAtLoginOption(iHelper.Title));

            IconInfo iconInfo = new IconInfo("logo.png", "image/png", 106, 106, 32);

            try
            {
                // create the media server
                iServer = new Server("git://github.com/linnoss/MediaApps.git", iHelper.Company, "http://www.linn.co.uk", iHelper.Title, "http://www.linn.co.uk", new Presentation(iPageMain), iconInfo);
            }
            catch (ApplicationException)
            {
                Shutdown(-1);
            }

            // create the configuration window
            iWindow          = new ConfigurationWindow(Songbox.Properties.Resources.Icon, iHelper.Title, iServer);
            iWindow.Closing += EventWindowClosing;

            // create and show the sys tray icon
            iFormSysTray = new FormSysTray(this);
        }
Example #2
0
        private void ShutdownApp()
        {
            if (iServer != null)
            {
                iServer.Dispose();
                iServer = null;
            }

            if (iFormSysTray != null)
            {
                iFormSysTray.Close();
                iFormSysTray = null;
            }

            if (iWindow != null)
            {
                iWindow.Close();
                iWindow = null;
            }
        }