Esempio n. 1
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            // create helpers
            iHelper = new Helper(e.Args);
            iHelper.ProcessOptionsFileAndCommandLine();

            ICrashLogDumper d = new CrashLogDumperWindow(ResourceManager.IconLarge, iHelper.Title, iHelper.Product, iHelper.Version);

            iHelper.AddCrashLogDumper(d);

            iHelperAutoUpdate = new HelperAutoUpdate(iHelper, new Linn.Toolkit.Wpf.ViewAutoUpdateStandard(Konfig.ResourceManager.Icon, Konfig.Properties.Resources.IconLarge), new Invoker(this.Dispatcher));
            iHelperAutoUpdate.Start();

            // create the main window
            iMainWindow = new MainWindow(iHelper.Product, iHelper.Title);
            iMainWindow.Show();

            Preferences preferences = new Preferences(iHelper);

            Model.Instance = new Model(preferences);

            // create the xapp controller and view
            Invoker invoker = new Invoker(this.Dispatcher);
            SettingsPageAdvanced   settings  = new SettingsPageAdvanced(invoker, Model.Instance, preferences, iHelperAutoUpdate, "settings", "settings");
            UpdateListenerRepeater listeners = new UpdateListenerRepeater(new IUpdateListener[] { iMainWindow, settings });

            iXappController = new XappController(invoker, iHelper, Model.Instance, preferences, settings, listeners);
            iViewer         = new ViewerBrowser(iMainWindow.WebBrowser, iXappController.MainPageUri);
        }
Esempio n. 2
0
        private void Application_Startup(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 helpers
            iHelper = new Helper(e.Args);
            ICrashLogDumper d = new CrashLogDumperWindow(Wizard.Properties.Resources.Icon, iHelper.Title, iHelper.Product, iHelper.Version);

            iHelper.AddCrashLogDumper(d);

            iHelperAutoUpdate = new HelperAutoUpdate(iHelper, new Linn.Toolkit.Wpf.ViewAutoUpdateStandard(Wizard.Properties.Resources.Icon, Wizard.Properties.Resources.IconImage), new Invoker(this.Dispatcher));
            iHelperAutoUpdate.Start();

            iHelper.ProcessOptionsFileAndCommandLine();

            // create components
            iXapp      = new Framework <Session>(Path.Combine(OpenHome.Xen.Environment.AppPath, "PageHtml"));
            iWebServer = new WebServer(iXapp);
            iControl   = new PageControl(iHelper, iXapp, Path.Combine(OpenHome.Xen.Environment.AppPath, "PageHtml"), "PageDefinitions.xml");

            // create the main window
            iMainWindow = new MainWindow(iHelper, iWebServer.ResourceUri, iControl);
            iMainWindow.Show();
        }
Esempio n. 3
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);
        }
Esempio n. 4
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            try
            {
                // create helpers
                iHelper = new Helper(e.Args);
                ICrashLogDumper d = new CrashLogDumperWindow(ResourceManager.Icon, iHelper.Title, iHelper.Product, iHelper.Version);
                iHelper.AddCrashLogDumper(d);

                iHelperAutoUpdate = new HelperAutoUpdate(iHelper, new Linn.Toolkit.Wpf.ViewAutoUpdateStandard(ResourceManager.IconSongcaster, Linn.Songcast.Properties.Resources.IconLarge), new Invoker(this.Dispatcher));
                iHelperAutoUpdate.Start();

                // create the model
                iModel = new Model(new Invoker(this.Dispatcher), iHelper);

                iHelper.ProcessOptionsFileAndCommandLine();

                // this should be created before PreferencesWindowClosing event can be called or PreferencesWindowClosing will raise a null reference exception
                iWaitMainWindowClosed = new AutoResetEvent(false);

                // create the preferences window and controller
                iPreferencesWindow          = new PreferencesWindow(iHelper, new PreferenceBindings(iModel, iHelperAutoUpdate.OptionPageUpdates), iModel, iHelperAutoUpdate);
                iPreferencesWindow.Closing += PreferencesWindowClosing;
                iPreferencesWindow.EventButtonHelpClicked += OpenHelp;

                // create the main window
                iMainWindow              = new MainWindow();
                iMainWindow.Deactivated += MainWindowDeactivated;

                // create the xapp controller and view
                iXappController = new XappController(iModel, new Invoker(this.Dispatcher));
                iXappController.MainPage.EventShowConfig += OpenPreferences;
                iXappController.MainPage.EventShowHelp   += OpenHelp;
                iViewer = new ViewerBrowser(iMainWindow.WebBrowser, iXappController.MainPageUri);

                // create the sys tray icon
                iFormSysTray = new FormSysTray(iModel);
                iFormSysTray.EventIconClick += SysTrayIconClick;

                // start the model
                System.Drawing.Image   image  = System.Drawing.Image.FromStream(ResourceManager.Icon.StreamSource);
                System.IO.MemoryStream stream = new System.IO.MemoryStream();
                image.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
                iModel.Start("linn.co.uk", "Linn", "http://www.linn.co.uk", "http://www.linn.co.uk", stream.ToArray(), "image/png");

                bool createdNew;
                iWaitHandleMainWindow = new EventWaitHandle(false, EventResetMode.ManualReset, "LinnSongcastOpenPreferences", out createdNew);
                if (!createdNew)
                {
                    iWaitHandleMainWindow.Set();
                    //MessageBox.Show("Linn Songcast is already running", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                    App.Current.Shutdown(0);
                    return;
                }

                iWaitHandleExit = new EventWaitHandle(false, EventResetMode.ManualReset, "LinnSongcastExit", out createdNew);
                Assert.Check(createdNew);

                iThreadMainWindow = new Thread(ProcessOpenMainWindow);
                iThreadMainWindow.IsBackground = true;
                iThreadMainWindow.Start();

                iThreadExit = new Thread(ProcessExit);
                iThreadExit.IsBackground = true;
                iThreadExit.Start();

                Microsoft.Win32.SystemEvents.PowerModeChanged += PowerModeChanged;
            }
            catch (SongcastError)
            {
                MessageBox.Show("Failed to initialise Linn Songcast Driver", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                App.Current.Shutdown(1);
            }
        }