private void buttonOK_Click(object sender, RoutedEventArgs e) { // Resolution if (_resolutionGeneralsChanged) { string[] resolution = ((ComboBoxItem)comboBoxGenerals.SelectedItem).Content.ToString().Split('x'); IniHelper.LineChanger(string.Format("Resolution = {0} {1}", resolution[0], resolution[1]), _pathToOptionIniGenerals, _optionIniResolutionGenerals.ResolutionNoLigne); } if (_resolutionHeureHChanged) { string[] resolution = ((ComboBoxItem)comboBoxHeureH.SelectedItem).Content.ToString().Split('x'); IniHelper.LineChanger(string.Format("Resolution = {0} {1}", resolution[0], resolution[1]), _pathToOptionIniHeureH, _optionIniResolutionHeureH.ResolutionNoLigne); } // Scroll if (_scrollChanged) { IniHelper.LineChanger(String.Format("ScrollFactor = {0}", sliderScrollFactor.Value), _pathToOptionIniGenerals, _optionIniResolutionGenerals.ScrollFactorNoLigne); IniHelper.LineChanger(String.Format("ScrollFactor = {0}", sliderScrollFactor.Value), _pathToOptionIniHeureH, _optionIniResolutionHeureH.ScrollFactorNoLigne); } // Settings int newCameraHeight = (int)sliderCameraHeight.Value; double newCameraSpeed = Math.Round(sliderCameraSpeed.Value / 100, 1); bool gregWareFullscreen = (bool)radioButtonFullscreenModeGregware.IsChecked; bool scrollWasd = (bool)checkBoxMiscScrollWasd.IsChecked; Properties.Settings.Default["ZoomMaxCameraHeight"] = newCameraHeight; Properties.Settings.Default["ZoomCameraAdjustSpeed"] = newCameraSpeed; Properties.Settings.Default["FullscreenModeGregware"] = gregWareFullscreen; Properties.Settings.Default["ScrollGregware"] = scrollWasd; Properties.Settings.Default.Save(); // Camera if (newCameraHeight != _zoomCameraHeightInitialValue || newCameraSpeed != _zoomCameraSpeedInitialValue) { ModFactory.AllGamesRefreshForceZoom(); } // Fullscreen mode if (gregWareFullscreen != _fullScreenModeGregwareInitialValue) { ModFactory.AllGamesRefreshFullscreenMode(); } // Fermer la fenêtre Close(); }
private void MetroWindow_Loaded(object sender, RoutedEventArgs e) { DataContext = this; // Faire la collection pour le tab TabItem tabItemGenerals = new TabItem { Header = "GENERALS", Name = "Generals" }; ScrollViewer svGenerals = new ScrollViewer { Name = "svGenerals", HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(0, 0, 0, 0), VerticalScrollBarVisibility = ScrollBarVisibility.Auto }; tabItemGenerals.Content = svGenerals; Grid gridGenerals = new Grid { Name = "gridButtonsGenerals" }; svGenerals.Content = gridGenerals; TabItem tabItemHeureH = new TabItem { Header = "HEURE H", Name = "HeureH" }; ScrollViewer svHeureH = new ScrollViewer { Name = "svHeureH", HorizontalAlignment = HorizontalAlignment.Left, Margin = new Thickness(0, 0, 0, 0), VerticalScrollBarVisibility = ScrollBarVisibility.Auto }; tabItemHeureH.Content = svHeureH; Grid gridHeureH = new Grid { Name = "gridButtonsHeureH" }; svHeureH.Content = gridHeureH; TabItems = new List <TabItem>(); TabItems.Add(tabItemGenerals); TabItems.Add(tabItemHeureH); TabItemsCollectionView = new ListCollectionView(TabItems); // Load mods _currentGameName = "HeureH"; ModFactory.Init(this, new List <string> { "Generals", "HeureH" }, new List <string> { _pathToMapsGenerals, _pathToMapsZeroHour }, _pathToExe, _uiScheduler, new List <Grid> { gridGenerals, gridHeureH }, new List <double> { Convert.ToInt32(_currentGameName.Equals("Generals")), Convert.ToInt32(_currentGameName.Equals("HeureH")) }, new List <ComboBox> { comboBoxMapsGenerals, comboBoxMapsHeureH }, new List <CheckBox> { checkBoxGentoolGenerals, checkBoxGentoolHeureH }, new List <CheckBox> { checkBoxForceZoomGenerals, checkBoxForceZoomHeureH }); // Evenements sur changement de tab tabControl.SelectionChanged += tabControl_SelectionChanged; // Sélectionner le bon jeu tabControl.SelectedIndex = 1; // Réappliquer les sélection après update if ((bool)Properties.Settings.Default["JustUpdated"]) { ModFactory.AllGamesRefreshForceZoom(); ModFactory.AllGamesRefreshFullscreenMode(); ModFactory.AllGamesRefreshGentool(); Properties.Settings.Default["JustUpdated"] = false; Properties.Settings.Default.Save(); } // Démarrer l'affichage ModFactory.Refresh(_currentGameName); // Démarrer le détecteur de lancement MonitorGameRunning(); }