//=========== SETTINGS =========== #region Settings /**<summary>Loads the application settings.</summary>*/ private void LoadSettings() { Config.LoadConfig(this); LoadSetups(); int width = Settings.Default.WindowWidth; int height = Settings.Default.WindowHeight; if (width >= MinWidth) { Width = width; } if (height >= MinHeight) { Height = height; } SetupTypes setupTabsValue; if (Enum.TryParse(Settings.Default.CurrentTab, out setupTabsValue)) { currentTab = setupTabsValue; } UpdateTab(); UpdateFolder(); }
private void OnToolsTab(object sender, MouseButtonEventArgs e) { if (currentTab != SetupTypes.Tool) { if (!Config.DisableTransitions) { double width = CurrentSetupGrid.ActualWidth; bool middlePass = false; // currentTab == SetupTypes.Game; var last = CurrentSetupStack.Peek(); var middle = serverStack.Peek(); var next = toolStack.Peek(); gridTools.Visibility = Visibility.Visible; last.LeaveTab(false, width, middlePass, UpdateTab); next.EnterTab(false, width, middlePass); if (middlePass) { gridServers.Visibility = Visibility.Visible; middle.PassTab(false, width); } } currentTab = SetupTypes.Tool; UpdateFolder(); if (Config.DisableTransitions) { UpdateTab(); } } }
public SettingsWindow(SetupTypes startupTab) { InitializeComponent(); tabControl.SelectedIndex = (int)startupTab; treeViewGames.Populate(Config.Games, SetupTypes.Game); treeViewServers.Populate(Config.Servers, SetupTypes.Server); treeViewTools.Populate(Config.Tools, SetupTypes.Tool); int width = Settings.Default.SettingsWidth; int height = Settings.Default.SettingsHeight; if (width >= MinWidth) { Width = width; } if (height >= MinHeight) { Height = height; } checkBoxCloseGame.IsChecked = Config.CloseOnGameLaunch; checkBoxCloseServer.IsChecked = Config.CloseOnServerLaunch; checkBoxCloseTool.IsChecked = Config.CloseOnToolLaunch; checkBoxDisableTransitions.IsChecked = Config.DisableTransitions; checkBoxMuted.IsChecked = Config.Muted; checkBoxIntegration.IsChecked = Config.Integration; spinnerScrollSpeed.Value = (int)(Config.ScrollSpeed * 100); }
public void Populate(SetupFolder folder, SetupTypes setupType) { folder = folder.CloneFolder(); this.setupType = setupType; TreeViewItem root = MakeFolderItem(folder, true); treeView.Items.Add(root); Populate(root, folder); switch (setupType) { case SetupTypes.Game: imageAddSetup.Source = iconAddGame; break; case SetupTypes.Server: imageAddSetup.Source = iconAddServer; break; case SetupTypes.Tool: imageAddSetup.Source = iconAddTool; break; } buttonAddSetup.ToolTip = "Add " + setupType + " Setup"; UpdateButtons(); }
public static bool ShowDialog(Window owner, SetupTypes startupTab) { SettingsWindow window = new SettingsWindow(startupTab); window.Owner = owner; var result = window.ShowDialog(); Settings.Default.SettingsWidth = (int)window.Width; Settings.Default.SettingsHeight = (int)window.Height; if (result.HasValue && result.Value) { if (window.treeViewGames.Modified) { Config.Games = window.treeViewGames.GenerateHierarchy(); Config.Modified = true; } if (window.treeViewServers.Modified) { Config.Servers = window.treeViewServers.GenerateHierarchy(); Config.Modified = true; } if (window.treeViewTools.Modified) { Config.Tools = window.treeViewTools.GenerateHierarchy(); Config.Modified = true; } Config.CloseOnGameLaunch = window.checkBoxCloseGame.IsChecked.Value; Config.CloseOnServerLaunch = window.checkBoxCloseServer.IsChecked.Value; Config.CloseOnToolLaunch = window.checkBoxCloseTool.IsChecked.Value; Config.DisableTransitions = window.checkBoxDisableTransitions.IsChecked.Value; Config.Muted = window.checkBoxMuted.IsChecked.Value; Config.Integration = window.checkBoxIntegration.IsChecked.Value; Config.ScrollSpeed = (double)window.spinnerScrollSpeed.Value / 100.0; Config.SaveConfig(); return(true); } return(false); }
private void OnServersTab(object sender, MouseButtonEventArgs e) { if (currentTab != SetupTypes.Server) { if (!Config.DisableTransitions) { double width = CurrentSetupGrid.ActualWidth; bool back = currentTab == SetupTypes.Tool; var last = CurrentSetupStack.Peek(); var next = serverStack.Peek(); gridServers.Visibility = Visibility.Visible; last.LeaveTab(back, width, false, UpdateTab); next.EnterTab(back, width, false); } currentTab = SetupTypes.Server; UpdateFolder(); if (Config.DisableTransitions) { UpdateTab(); } } }
/// <summary> /// Send a base config containing at least 1 of each activity type /// The input config will be modified and can be requested via .ActiveConfig /// </summary> /// <param name="config"></param> public SlotConfigHandler(Profile profile, SetupTypes setupType) { ActiveProfile = profile; SetupType = setupType; ProfileSetupCompleted += SlotConfigHandler_ProfileSetupCompleted; }