private void StartApplication() { GC.Collect(); GC.WaitForPendingFinalizers(); if (!string.IsNullOrEmpty(ServiceProvider.Settings.SelectedMainForm) && ServiceProvider.Settings.SelectedMainForm != _basemainwindow.DisplayName) { SelectorWnd wnd = new SelectorWnd(); wnd.ShowDialog(); } IMainWindowPlugin mainWindowPlugin = _basemainwindow; foreach (IMainWindowPlugin windowPlugin in ServiceProvider.PluginManager.MainWindowPlugins) { if (windowPlugin.DisplayName == ServiceProvider.Settings.SelectedMainForm) { mainWindowPlugin = windowPlugin; } } ServiceProvider.PluginManager.SelectedWindow = mainWindowPlugin; mainWindowPlugin.Show(); if (mainWindowPlugin is Window) { ((Window)mainWindowPlugin).Activate(); } }
private void InitWindowManager() { ServiceProvider.WindowsManager = new WindowsManager(); ServiceProvider.PluginManager.LoadPlugins(Path.Combine(Settings.ApplicationFolder, "Plugins")); ServiceProvider.PluginManager.LoadPlugins(Path.Combine(Settings.ApplicationFolder, "Branding", "Plugins")); //_basemainwindow = new MainWindow(); _basemainwindow = new MainWindowAdvanced(); ServiceProvider.PluginManager.MainWindowPlugins.Add(_basemainwindow); try { ServiceProvider.WindowsManager.Event += WindowsManager_Event; //ServiceProvider.WindowsManager.ApplyTheme(); ServiceProvider.WindowsManager.Add(new FullScreenWnd()); ServiceProvider.WindowsManager.Add(new LiveViewManager()); ServiceProvider.WindowsManager.Add(new MultipleCameraWnd()); ServiceProvider.WindowsManager.Add(new CameraPropertyWnd()); ServiceProvider.WindowsManager.Add(new AstroLiveViewWnd()); ServiceProvider.WindowsManager.Add(new MultipleLiveView()); //ServiceProvider.WindowsManager.Add(new BrowseWnd()); //ServiceProvider.WindowsManager.Add(new TagSelectorWnd()); //ServiceProvider.WindowsManager.Add(new DownloadPhotosWnd()); //ServiceProvider.WindowsManager.Add(new BulbWnd()); //ServiceProvider.WindowsManager.Add(new ScriptWnd()); // initialize print interface only if print button is visible //if (ServiceProvider.Branding.ShowPrintButtonMainWindow) // ServiceProvider.WindowsManager.Add(new PrintWnd()); //ServiceProvider.WindowsManager.Add(new TimeLapseWnd()); //ServiceProvider.WindowsManager.Add(new BarcodeWnd()); //ServiceProvider.WindowsManager.ApplyKeyHanding(); ServiceProvider.WindowsManager.RegisterKnowCommands(); ServiceProvider.Settings.SyncActions(ServiceProvider.WindowsManager.WindowCommands); //ServiceProvider.PluginManager.ToolPlugins.Add(new ScriptWnd()); //foreach (IPlugin plugin in ServiceProvider.PluginManager.Plugins) //{ // plugin.Init(); //} } catch (Exception exception) { Log.Error("Error to load plugins ", exception); } }
private void StartApplication() { // Get main window IMainWindowPlugin mainWindowPlugin = _basemainwindow; var args = Environment.GetCommandLineArgs(); String wndName = ""; foreach (string arg in args) { if (arg.Length > 5 && arg.Substring(0, 5) == "-wnd=") { wndName = arg.Substring(5); } } if (!String.IsNullOrEmpty(wndName)) { foreach (IMainWindowPlugin windowPlugin in ServiceProvider.PluginManager.MainWindowPlugins) { if (windowPlugin.DisplayName == wndName) { mainWindowPlugin = windowPlugin; } } } else { if (ServiceProvider.Settings.SelectedMainForm != _basemainwindow.DisplayName) { SelectorWnd wnd = new SelectorWnd(); wnd.ShowDialog(); } foreach (IMainWindowPlugin windowPlugin in ServiceProvider.PluginManager.MainWindowPlugins) { if (windowPlugin.DisplayName == ServiceProvider.Settings.SelectedMainForm) { mainWindowPlugin = windowPlugin; } } } // Display window mainWindowPlugin.Show(); if (mainWindowPlugin is Window) { ((Window)mainWindowPlugin).Activate(); } }
private void InitWindowManager() { ServiceProvider.WindowsManager = new WindowsManager(); _basemainwindow = new MainWindow(); ServiceProvider.PluginManager.MainWindowPlugins.Add(_basemainwindow); try { ServiceProvider.WindowsManager.Add(new FullScreenWnd()); ServiceProvider.WindowsManager.Add(new LiveViewManager()); ServiceProvider.WindowsManager.Add(new MultipleCameraWnd()); ServiceProvider.WindowsManager.Add(new CameraPropertyWnd()); ServiceProvider.WindowsManager.Add(new BrowseWnd()); ServiceProvider.WindowsManager.Add(new TagSelectorWnd()); ServiceProvider.WindowsManager.Add(new DownloadPhotosWnd()); ServiceProvider.WindowsManager.Add(new BulbWnd()); ServiceProvider.WindowsManager.Add(new AstroLiveViewWnd()); ServiceProvider.WindowsManager.Add(new ScriptWnd()); ServiceProvider.WindowsManager.Add(new PrintWnd()); ServiceProvider.WindowsManager.Add(new TimeLapseWnd()); ServiceProvider.WindowsManager.Add(new BarcodeWnd()); ServiceProvider.WindowsManager.Event += WindowsManager_Event; ServiceProvider.WindowsManager.ApplyTheme(); //ServiceProvider.WindowsManager.ApplyKeyHanding(); ServiceProvider.WindowsManager.RegisterKnowCommands(); ServiceProvider.Settings.SyncActions(ServiceProvider.WindowsManager.WindowCommands); ServiceProvider.PluginManager.LoadPlugins( Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "Plugins")); ServiceProvider.PluginManager.ToolPlugins.Add(new ScriptWnd()); foreach (IPanelPlugin plugin in ServiceProvider.PluginManager.PanelPlugins) { plugin.Init(); } } catch (Exception exception) { Log.Error("Error to load plugins ", exception); } }
private void InitApplication() { ServiceProvider.Configure(); ServiceProvider.Settings = new Settings(); ServiceProvider.Settings = ServiceProvider.Settings.Load(); ServiceProvider.Branding = ServiceProvider.Settings.LoadBranding(); if (!string.IsNullOrEmpty(ServiceProvider.Branding.StartupScreenImage) && File.Exists(ServiceProvider.Branding.StartupScreenImage)) { BitmapImage bi = new BitmapImage(); // BitmapImage.UriSource must be in a BeginInit/EndInit block. bi.BeginInit(); bi.UriSource = new Uri(ServiceProvider.Branding.StartupScreenImage); bi.EndInit(); background.Source = bi; } ServiceProvider.ActionManager.Actions = new AsyncObservableCollection <IMenuAction> { new CmdFocusStackingCombineZP(), new CmdEnfuse(), new CmdToJpg(), //new CmdExpJpg() }; //ServiceProvider.Branding.ApplicationTitle = "digiCamControl"; //ServiceProvider.Branding.DefaultMissingThumbImage = ""; //ServiceProvider.Branding.DefaultThumbImage = ""; //ServiceProvider.Branding.LogoImage = ""; //ServiceProvider.Branding.StartupScreenImage = ""; //ServiceProvider.Settings.Save(ServiceProvider.Branding); if (ServiceProvider.Settings.DisableNativeDrivers && MessageBox.Show(TranslationStrings.MsgDisabledDrivers, "", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { ServiceProvider.Settings.DisableNativeDrivers = false; } ServiceProvider.Settings.LoadSessionData(); TranslationManager.LoadLanguage(ServiceProvider.Settings.SelectedLanguage); ServiceProvider.WindowsManager = new WindowsManager(); ServiceProvider.WindowsManager.Add(new FullScreenWnd()); ServiceProvider.WindowsManager.Add(new EditDefaultSession()); ServiceProvider.WindowsManager.Add(new LiveViewManager()); ServiceProvider.WindowsManager.Add(new MultipleCameraWnd()); ServiceProvider.WindowsManager.Add(new CameraPropertyWnd()); ServiceProvider.WindowsManager.Add(new BrowseWnd()); ServiceProvider.WindowsManager.Add(new TagSelectorWnd()); ServiceProvider.WindowsManager.Add(new DownloadPhotosWnd()); ServiceProvider.WindowsManager.Add(new BulbWnd()); ServiceProvider.WindowsManager.Add(new AstroLiveViewWnd()); ServiceProvider.WindowsManager.Add(new ScriptWnd()); ServiceProvider.WindowsManager.Event += WindowsManager_Event; ServiceProvider.Trigger.Start(); ServiceProvider.PluginManager.LoadPlugins(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "Plugins")); _basemainwindow = new MainWindow(); ServiceProvider.PluginManager.MainWindowPlugins.Add(_basemainwindow); ServiceProvider.PluginManager.ToolPlugins.Add(new ScriptWnd()); // event handlers ServiceProvider.Settings.SessionSelected += Settings_SessionSelected; ServiceProvider.DeviceManager.CameraConnected += DeviceManager_CameraConnected; ServiceProvider.DeviceManager.CameraSelected += DeviceManager_CameraSelected; //------------------- ServiceProvider.DeviceManager.DisableNativeDrivers = ServiceProvider.Settings.DisableNativeDrivers; ServiceProvider.DeviceManager.ConnectToCamera(); Thread.Sleep(500); StartApplication(); Dispatcher.Invoke(new Action(Hide)); }
private void InitApplication() { // prevent some application crash WpfCommands.DisableWpfTabletSupport(); ServiceProvider.Configure(); ServiceProvider.Settings = new Settings(); ServiceProvider.Settings = ServiceProvider.Settings.Load(); ServiceProvider.Branding = ServiceProvider.Settings.LoadBranding(); if (!string.IsNullOrEmpty(ServiceProvider.Branding.StartupScreenImage) && File.Exists(ServiceProvider.Branding.StartupScreenImage)) { BitmapImage bi = new BitmapImage(); // BitmapImage.UriSource must be in a BeginInit/EndInit block. bi.BeginInit(); bi.UriSource = new Uri(ServiceProvider.Branding.StartupScreenImage); bi.EndInit(); background.Source = bi; } ServiceProvider.ActionManager.Actions = new AsyncObservableCollection <IMenuAction> { new CmdFocusStackingCombineZP(), new CmdEnfuse(), new CmdToJpg(), //new CmdExpJpg() }; if (ServiceProvider.Settings.DisableNativeDrivers && MessageBox.Show(TranslationStrings.MsgDisabledDrivers, "", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { ServiceProvider.Settings.DisableNativeDrivers = false; } ServiceProvider.Settings.LoadSessionData(); TranslationManager.LoadLanguage(ServiceProvider.Settings.SelectedLanguage); ServiceProvider.WindowsManager = new WindowsManager(); ServiceProvider.WindowsManager.Add(new FullScreenWnd()); ServiceProvider.WindowsManager.Add(new LiveViewManager()); ServiceProvider.WindowsManager.Add(new MultipleCameraWnd()); ServiceProvider.WindowsManager.Add(new CameraPropertyWnd()); ServiceProvider.WindowsManager.Add(new BrowseWnd()); ServiceProvider.WindowsManager.Add(new TagSelectorWnd()); ServiceProvider.WindowsManager.Add(new DownloadPhotosWnd()); ServiceProvider.WindowsManager.Add(new BulbWnd()); ServiceProvider.WindowsManager.Add(new AstroLiveViewWnd()); ServiceProvider.WindowsManager.Add(new ScriptWnd()); ServiceProvider.WindowsManager.Event += WindowsManager_Event; ServiceProvider.WindowsManager.ApplyTheme(); ServiceProvider.WindowsManager.RegisterKnowCommands(); ServiceProvider.Settings.SyncActions(ServiceProvider.WindowsManager.WindowCommands); ServiceProvider.Trigger.Start(); ServiceProvider.PluginManager.CopyPlugins(); ServiceProvider.PluginManager.LoadPlugins(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "Plugins")); _basemainwindow = new MainWindow(); ServiceProvider.PluginManager.MainWindowPlugins.Add(_basemainwindow); ServiceProvider.PluginManager.ToolPlugins.Add(new ScriptWnd()); // event handlers ServiceProvider.Settings.SessionSelected += Settings_SessionSelected; ServiceProvider.DeviceManager.CameraConnected += DeviceManager_CameraConnected; ServiceProvider.DeviceManager.CameraSelected += DeviceManager_CameraSelected; ServiceProvider.DeviceManager.CameraDisconnected += DeviceManager_CameraDisconnected; //------------------- ServiceProvider.DeviceManager.DisableNativeDrivers = ServiceProvider.Settings.DisableNativeDrivers; if (ServiceProvider.Settings.AddFakeCamera) { ServiceProvider.DeviceManager.AddFakeCamera(); } try { ServiceProvider.DeviceManager.ConnectToCamera(); } catch (Exception exception) { Log.Error("Unable to initialize device manager", exception); if (exception.Message.Contains("0AF10CEC-2ECD-4B92-9581-34F6AE0637F3")) { MessageBox.Show( "Unable to initialize device manager !\nMissing some components! Please install latest Windows Media Player! "); Application.Current.Shutdown(1); } } Thread.Sleep(500); Dispatcher.Invoke(new Action(Hide)); StartApplication(); }
private void InitApplication() { // prevent some application crash WpfCommands.DisableWpfTabletSupport(); ServiceProvider.Configure(); ServiceProvider.Settings = new Settings(); ServiceProvider.Settings = ServiceProvider.Settings.Load(); ServiceProvider.Branding = ServiceProvider.Settings.LoadBranding(); if (!string.IsNullOrEmpty(ServiceProvider.Branding.StartupScreenImage) && File.Exists(ServiceProvider.Branding.StartupScreenImage)) { BitmapImage bi = new BitmapImage(); // BitmapImage.UriSource must be in a BeginInit/EndInit block. bi.BeginInit(); bi.UriSource = new Uri(ServiceProvider.Branding.StartupScreenImage); bi.EndInit(); background.Source = bi; } ServiceProvider.ActionManager.Actions = new AsyncObservableCollection<IMenuAction> { new CmdFocusStackingCombineZP(), new CmdEnfuse(), new CmdToJpg(), //new CmdExpJpg() }; if (ServiceProvider.Settings.DisableNativeDrivers && MessageBox.Show(TranslationStrings.MsgDisabledDrivers, "", MessageBoxButton.YesNo) == MessageBoxResult.Yes) ServiceProvider.Settings.DisableNativeDrivers = false; ServiceProvider.Settings.LoadSessionData(); TranslationManager.LoadLanguage(ServiceProvider.Settings.SelectedLanguage); ServiceProvider.WindowsManager = new WindowsManager(); ServiceProvider.WindowsManager.Add(new FullScreenWnd()); ServiceProvider.WindowsManager.Add(new LiveViewManager()); ServiceProvider.WindowsManager.Add(new MultipleCameraWnd()); ServiceProvider.WindowsManager.Add(new CameraPropertyWnd()); ServiceProvider.WindowsManager.Add(new BrowseWnd()); ServiceProvider.WindowsManager.Add(new TagSelectorWnd()); ServiceProvider.WindowsManager.Add(new DownloadPhotosWnd()); ServiceProvider.WindowsManager.Add(new BulbWnd()); ServiceProvider.WindowsManager.Add(new AstroLiveViewWnd()); ServiceProvider.WindowsManager.Add(new ScriptWnd()); ServiceProvider.WindowsManager.Event += WindowsManager_Event; ServiceProvider.WindowsManager.ApplyTheme(); ServiceProvider.WindowsManager.RegisterKnowCommands(); ServiceProvider.Settings.SyncActions(ServiceProvider.WindowsManager.WindowCommands); ServiceProvider.Trigger.Start(); ServiceProvider.PluginManager.CopyPlugins(); ServiceProvider.PluginManager.LoadPlugins( Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "Plugins")); _basemainwindow = new MainWindow(); ServiceProvider.PluginManager.MainWindowPlugins.Add(_basemainwindow); ServiceProvider.PluginManager.ToolPlugins.Add(new ScriptWnd()); // event handlers ServiceProvider.Settings.SessionSelected += Settings_SessionSelected; ServiceProvider.DeviceManager.CameraConnected += DeviceManager_CameraConnected; ServiceProvider.DeviceManager.CameraSelected += DeviceManager_CameraSelected; ServiceProvider.DeviceManager.CameraDisconnected += DeviceManager_CameraDisconnected; //------------------- ServiceProvider.DeviceManager.DisableNativeDrivers = ServiceProvider.Settings.DisableNativeDrivers; if (ServiceProvider.Settings.AddFakeCamera) ServiceProvider.DeviceManager.AddFakeCamera(); try { ServiceProvider.DeviceManager.ConnectToCamera(); } catch (Exception exception) { Log.Error("Unable to initialize device manager", exception); if (exception.Message.Contains("0AF10CEC-2ECD-4B92-9581-34F6AE0637F3")) { MessageBox.Show( "Unable to initialize device manager !\nMissing some components! Please install latest Windows Media Player! "); Application.Current.Shutdown(1); } } Thread.Sleep(500); Dispatcher.Invoke(new Action(Hide)); StartApplication(); }