public void CurrentInstanceUpdated() { Util.Invoke(this, () => { Text = String.Format("CKAN {0} - KSP {1} -- {2}", Meta.GetVersion(), CurrentInstance.Version(), CurrentInstance.GameDir()); }); configuration = Configuration.LoadOrCreateConfiguration ( Path.Combine(CurrentInstance.GameDir(), "CKAN/GUIConfig.xml"), Repo.default_ckan_repo.ToString() ); if (CurrentInstance.CompatibleVersionsAreFromDifferentKsp) { CompatibleKspVersionsDialog dialog = new CompatibleKspVersionsDialog(CurrentInstance); dialog.ShowDialog(); } UpdateModsList(); ChangeSet = null; Conflicts = null; Filter((GUIModFilter)configuration.ActiveFilter); }
private void CurrentInstanceUpdated() { Util.Invoke(this, () => { Text = $"CKAN {Meta.GetVersion()} - KSP {CurrentInstance.Version()} -- {CurrentInstance.GameDir()}"; }); configuration = Configuration.LoadOrCreateConfiguration ( Path.Combine(CurrentInstance.CkanDir(), "GUIConfig.xml"), CKAN.Repository.default_ckan_repo_uri.ToString() ); if (CurrentInstance.CompatibleVersionsAreFromDifferentKsp) { CompatibleKspVersionsDialog dialog = new CompatibleKspVersionsDialog(CurrentInstance); dialog.ShowDialog(); } UpdateModsList(); ChangeSet = null; Conflicts = null; Filter((GUIModFilter)configuration.ActiveFilter); }
public void CurrentInstanceUpdated() { Util.Invoke(this, () => { Text = String.Format("CKAN {0} - KSP {1} -- {2}", Meta.Version(), CurrentInstance.Version(), CurrentInstance.GameDir()); KSPVersionLabel.Text = String.Format("Kerbal Space Program {0}", CurrentInstance.Version()); }); // Update the settings dialog to reflect the changes made. Util.Invoke(m_SettingsDialog, () => { m_SettingsDialog.UpdateDialog(); }); m_Configuration = Configuration.LoadOrCreateConfiguration ( Path.Combine(CurrentInstance.GameDir(), "CKAN/GUIConfig.xml"), Repo.default_ckan_repo.ToString() ); UpdateModsList(); ChangeSet = null; Conflicts = null; Filter((GUIModFilter)m_Configuration.ActiveFilter); }
/// <summary> /// React to switching to a new game instance /// </summary> /// <param name="onStartup">true if this is the initial load and should trigger auto repo updates, false otherwise</param> private void CurrentInstanceUpdated(bool onStartup) { Util.Invoke(this, () => { Text = $"CKAN {Meta.GetVersion()} - KSP {CurrentInstance.Version()} -- {CurrentInstance.GameDir()}"; }); configuration = Configuration.LoadOrCreateConfiguration( Path.Combine(CurrentInstance.CkanDir(), "GUIConfig.xml") ); if (CurrentInstance.CompatibleVersionsAreFromDifferentKsp) { new CompatibleKspVersionsDialog(CurrentInstance, !actuallyVisible) .ShowDialog(); } bool repoUpdateNeeded = configuration.RefreshOnStartup || !RegistryManager.Instance(CurrentInstance).registry.HasAnyAvailable(); if (onStartup && repoUpdateNeeded) { UpdateRepo(); } else { UpdateModsList(); } ChangeSet = null; Conflicts = null; Filter((GUIModFilter)configuration.ActiveFilter); }
public Main(string[] cmdlineArgs, GUIUser User, bool showConsole) { m_CommandLineArgs = cmdlineArgs; m_User = User; User.displayMessage = AddStatusMessage; User.displayError = ErrorDialog; controlFactory = new ControlFactory(); Instance = this; mainModList = new MainModList(source => UpdateFilters(this)); InitializeComponent(); // We need to initialize error dialog first to display errors m_ErrorDialog = controlFactory.CreateControl <ErrorDialog>(); // We want to check our current instance is null first, as it may // have already been set by a command-line option. Manager = new KSPManager(User); if (CurrentInstance == null && manager.GetPreferredInstance() == null) { Hide(); var result = new ChooseKSPInstance().ShowDialog(); if (result == DialogResult.Cancel || result == DialogResult.Abort) { Application.Exit(); return; } } m_Configuration = Configuration.LoadOrCreateConfiguration ( Path.Combine(CurrentInstance.GameDir(), "CKAN/GUIConfig.xml"), Repo.default_ckan_repo.ToString() ); FilterToolButton.MouseHover += (sender, args) => FilterToolButton.ShowDropDown(); launchKSPToolStripMenuItem.MouseHover += (sender, args) => launchKSPToolStripMenuItem.ShowDropDown(); ApplyToolButton.MouseHover += (sender, args) => ApplyToolButton.ShowDropDown(); ModList.CurrentCellDirtyStateChanged += ModList_CurrentCellDirtyStateChanged; ModList.CellValueChanged += ModList_CellValueChanged; m_TabController = new TabController(MainTabControl); m_TabController.ShowTab("ManageModsTabPage"); RecreateDialogs(); if (!showConsole) { Util.HideConsoleWindow(); } Application.Run(this); }
public Main() { User.frontEnd = FrontEndType.UI; User.yesNoDialog = YesNoDialog; User.displayMessage = AddStatusMessage; User.displayError = ErrorDialog; controlFactory = new ControlFactory(); m_Instance = this; InitializeComponent(); // We need to initialize error dialog first to display errors m_ErrorDialog = controlFactory.CreateControl <ErrorDialog>(); // We want to check our current instance is null first, as it may // have already been set by a command-line option. if (KSPManager.CurrentInstance == null && KSPManager.GetPreferredInstance() == null) { Hide(); var result = new ChooseKSPInstance().ShowDialog(); if (result == DialogResult.Cancel || result == DialogResult.Abort) { Application.Exit(); return; } } m_Configuration = Configuration.LoadOrCreateConfiguration ( Path.Combine(KSPManager.CurrentInstance.GameDir(), "CKAN/GUIConfig.xml"), Repo.default_ckan_repo.ToString() ); FilterToolButton.MouseHover += (sender, args) => FilterToolButton.ShowDropDown(); launchKSPToolStripMenuItem.MouseHover += (sender, args) => launchKSPToolStripMenuItem.ShowDropDown(); ApplyToolButton.MouseHover += (sender, args) => ApplyToolButton.ShowDropDown(); ModList.CurrentCellDirtyStateChanged += ModList_CurrentCellDirtyStateChanged; ModList.CellValueChanged += ModList_CellValueChanged; m_TabController = new TabController(MainTabControl); m_TabController.ShowTab("ManageModsTabPage"); RecreateDialogs(); // We should run application only when we really sure. // System.Threading.Thread.CurrentThread.SetApartmentState(System.Threading.ApartmentState.STA); Util.HideConsoleWindow(); Application.Run(this); }
public void CurrentInstanceUpdated() { Util.Invoke(this, () => { Text = String.Format("CKAN {0} - KSP {1} -- {2}", Meta.Version(), CurrentInstance.Version(), CurrentInstance.GameDir()); }); configuration = Configuration.LoadOrCreateConfiguration ( Path.Combine(CurrentInstance.GameDir(), "CKAN/GUIConfig.xml"), Repo.default_ckan_repo.ToString() ); UpdateModsList(); ChangeSet = null; Conflicts = null; Filter((GUIModFilter)configuration.ActiveFilter); }
public void CurrentInstanceUpdated() { Util.Invoke(this, () => { Text = String.Format("CFAN {0} - Factorio {1} -- {2}", Meta.Version(), CurrentInstance.Version(), CurrentInstance.GameDir()); KSPVersionLabel.Text = String.Format("Factorio {0}", CurrentInstance.Version()); }); m_Configuration = Configuration.LoadOrCreateConfiguration ( CurrentInstance.findFactorioBinaryPath(), Path.Combine(CurrentInstance.CkanDir(), "GUIConfig.xml"), Repo.default_ckan_repo.ToString() ); UpdateModsList(); ChangeSet = null; Conflicts = null; Filter((GUIModFilter)m_Configuration.ActiveFilter); }
private void CurrentInstanceUpdated() { Util.Invoke(this, () => { Text = $"CKAN {Meta.GetVersion()} - KSP {CurrentInstance.Version()} -- {CurrentInstance.GameDir()}"; }); configuration = Configuration.LoadOrCreateConfiguration( Path.Combine(CurrentInstance.CkanDir(), "GUIConfig.xml") ); if (CurrentInstance.CompatibleVersionsAreFromDifferentKsp) { new CompatibleKspVersionsDialog(CurrentInstance, !actuallyVisible) .ShowDialog(); } UpdateModsList(); ChangeSet = null; Conflicts = null; Filter((GUIModFilter)configuration.ActiveFilter); }
public Main(string[] cmdlineArgs, GUIUser user, bool showConsole) { log.Info("Starting the GUI"); commandLineArgs = cmdlineArgs; currentUser = user; user.displayMessage = AddStatusMessage; user.displayError = ErrorDialog; controlFactory = new ControlFactory(); Instance = this; mainModList = new MainModList(source => UpdateFilters(this), TooManyModsProvide, user); navHistory = new NavigationHistory <GUIMod>(); navHistory.IsReadOnly = true; // read-only until the UI is started. // we switch out of it at the end of OnLoad() // when we call NavInit() InitializeComponent(); // We need to initialize error dialog first to display errors errorDialog = controlFactory.CreateControl <ErrorDialog>(); // We want to check our current instance is null first, as it may // have already been set by a command-line option. Manager = new KSPManager(user); if (CurrentInstance == null && manager.GetPreferredInstance() == null) { Hide(); var result = new ChooseKSPInstance().ShowDialog(); if (result == DialogResult.Cancel || result == DialogResult.Abort) { Application.Exit(); return; } } configuration = Configuration.LoadOrCreateConfiguration ( Path.Combine(CurrentInstance.GameDir(), "CKAN/GUIConfig.xml"), Repo.default_ckan_repo.ToString() ); // Check if there is any other instances already running. // This is not entirely necessary, but we can show a nicer error message this way. try { #pragma warning disable 219 var lockedReg = RegistryManager.Instance(CurrentInstance).registry; #pragma warning restore 219 } catch (RegistryInUseKraken kraken) { errorDialog.ShowErrorDialog(kraken.ToString()); return; } FilterToolButton.MouseHover += (sender, args) => FilterToolButton.ShowDropDown(); launchKSPToolStripMenuItem.MouseHover += (sender, args) => launchKSPToolStripMenuItem.ShowDropDown(); ApplyToolButton.MouseHover += (sender, args) => ApplyToolButton.ShowDropDown(); ModList.CurrentCellDirtyStateChanged += ModList_CurrentCellDirtyStateChanged; ModList.CellValueChanged += ModList_CellValueChanged; tabController = new TabController(MainTabControl); tabController.ShowTab("ManageModsTabPage"); RecreateDialogs(); if (!showConsole) { Util.HideConsoleWindow(); } // Disable the modinfo controls until a mod has been choosen. ModInfoTabControl.SelectedModule = null; // WinForms on Mac OS X has a nasty bug where the UI thread hogs the CPU, // making our download speeds really slow unless you move the mouse while // downloading. Yielding periodically addresses that. // https://bugzilla.novell.com/show_bug.cgi?id=663433 if (Platform.IsMac) { var timer = new Timer { Interval = 2 }; timer.Tick += (sender, e) => { Thread.Yield(); }; timer.Start(); } Application.Run(this); var registry = RegistryManager.Instance(Manager.CurrentInstance); if (registry != null) { registry.Dispose(); } }
public Main(string[] cmdlineArgs, KSPManager mgr, GUIUser user, bool showConsole) { log.Info("Starting the GUI"); commandLineArgs = cmdlineArgs; manager = mgr ?? new KSPManager(user); currentUser = user; controlFactory = new ControlFactory(); Instance = this; mainModList = new MainModList(source => UpdateFilters(this), TooManyModsProvide, user); // History is read-only until the UI is started. We switch // out of it at the end of OnLoad() when we call NavInit(). navHistory = new NavigationHistory <GUIMod> { IsReadOnly = true }; InitializeComponent(); // Replace mono's broken, ugly toolstrip renderer if (Platform.IsMono) { menuStrip1.Renderer = new FlatToolStripRenderer(); menuStrip2.Renderer = new FlatToolStripRenderer(); fileToolStripMenuItem.DropDown.Renderer = new FlatToolStripRenderer(); settingsToolStripMenuItem.DropDown.Renderer = new FlatToolStripRenderer(); helpToolStripMenuItem.DropDown.Renderer = new FlatToolStripRenderer(); FilterToolButton.DropDown.Renderer = new FlatToolStripRenderer(); minimizedContextMenuStrip.Renderer = new FlatToolStripRenderer(); ModListContextMenuStrip.Renderer = new FlatToolStripRenderer(); ModListHeaderContextMenuStrip.Renderer = new FlatToolStripRenderer(); } // Initialize all user interaction dialogs. RecreateDialogs(); // We want to check if our current instance is null first, // as it may have already been set by a command-line option. if (CurrentInstance == null && manager.GetPreferredInstance() == null) { Hide(); var result = new ManageKspInstances(!actuallyVisible).ShowDialog(); if (result == DialogResult.Cancel || result == DialogResult.Abort) { Application.Exit(); return; } } configuration = Configuration.LoadOrCreateConfiguration ( Path.Combine(CurrentInstance.CkanDir(), "GUIConfig.xml") ); // Check if there is any other instances already running. // This is not entirely necessary, but we can show a nicer error message this way. try { #pragma warning disable 219 var lockedReg = RegistryManager.Instance(CurrentInstance).registry; #pragma warning restore 219 } catch (RegistryInUseKraken kraken) { errorDialog.ShowErrorDialog(kraken.ToString()); return; } FilterToolButton.MouseHover += (sender, args) => FilterToolButton.ShowDropDown(); launchKSPToolStripMenuItem.MouseHover += (sender, args) => launchKSPToolStripMenuItem.ShowDropDown(); ApplyToolButton.MouseHover += (sender, args) => ApplyToolButton.ShowDropDown(); ModList.CurrentCellDirtyStateChanged += ModList_CurrentCellDirtyStateChanged; ModList.CellValueChanged += ModList_CellValueChanged; tabController = new TabController(MainTabControl); tabController.ShowTab("ManageModsTabPage"); if (!showConsole) { Util.HideConsoleWindow(); } // Disable the modinfo controls until a mod has been choosen. This has an effect if the modlist is empty. ActiveModInfo = null; // WinForms on Mac OS X has a nasty bug where the UI thread hogs the CPU, // making our download speeds really slow unless you move the mouse while // downloading. Yielding periodically addresses that. // https://bugzilla.novell.com/show_bug.cgi?id=663433 if (Platform.IsMac) { var timer = new Timer { Interval = 2 }; timer.Tick += (sender, e) => { Thread.Yield(); }; timer.Start(); } // Set the window name and class for X11 if (Platform.IsX11) { HandleCreated += (sender, e) => X11.SetWMClass("CKAN", "CKAN", Handle); } Application.Run(this); var registry = RegistryManager.Instance(Manager.CurrentInstance); registry?.Dispose(); }
public Main(string[] cmdlineArgs, GUIUser User, bool showConsole) { log.Info("Starting the GUI"); m_CommandLineArgs = cmdlineArgs; m_User = User; User.displayMessage = AddStatusMessage; User.displayError = ErrorDialog; controlFactory = new ControlFactory(); Instance = this; mainModList = new MainModList(source => UpdateFilters(this), TooManyModsProvide, User); InitializeComponent(); // We need to initialize error dialog first to display errors m_ErrorDialog = controlFactory.CreateControl <ErrorDialog>(); // We want to check our current instance is null first, as it may // have already been set by a command-line option. Manager = new KSPManager(User); if (CurrentInstance == null && manager.GetPreferredInstance() == null) { Hide(); var result = new ChooseKSPInstance().ShowDialog(); if (result == DialogResult.Cancel || result == DialogResult.Abort) { Application.Exit(); return; } } m_Configuration = Configuration.LoadOrCreateConfiguration ( Path.Combine(CurrentInstance.GameDir(), "CKAN/GUIConfig.xml"), Repo.default_ckan_repo.ToString() ); FilterToolButton.MouseHover += (sender, args) => FilterToolButton.ShowDropDown(); launchKSPToolStripMenuItem.MouseHover += (sender, args) => launchKSPToolStripMenuItem.ShowDropDown(); ApplyToolButton.MouseHover += (sender, args) => ApplyToolButton.ShowDropDown(); ModList.CurrentCellDirtyStateChanged += ModList_CurrentCellDirtyStateChanged; ModList.CellValueChanged += ModList_CellValueChanged; m_TabController = new TabController(MainTabControl); m_TabController.ShowTab("ManageModsTabPage"); RecreateDialogs(); if (!showConsole) { Util.HideConsoleWindow(); } // Disable the modinfo controls until a mod has been choosen. ModInfoTabControl.Enabled = false; // WinForms on Mac OS X has a nasty bug where the UI thread hogs the CPU, // making our download speeds really slow unless you move the mouse while // downloading. Yielding periodically addresses that. // https://bugzilla.novell.com/show_bug.cgi?id=663433 if (Platform.IsMac) { var yield_timer = new Timer { Interval = 2 }; yield_timer.Tick += (sender, e) => { Thread.Yield(); }; yield_timer.Start(); } Application.Run(this); }