mirror of
https://github.com/EpicMorg/UniversalValveToolbox.git
synced 2024-12-26 14:45:30 +03:00
fix save last selected project
This commit is contained in:
parent
3f057d100e
commit
7471086bd3
@ -59,9 +59,6 @@
|
||||
this.comboBoxProjects.Name = "comboBoxProjects";
|
||||
this.comboBoxProjects.Size = new System.Drawing.Size(449, 21);
|
||||
this.comboBoxProjects.TabIndex = 1;
|
||||
this.comboBoxProjects.SelectedIndexChanged += new System.EventHandler(this.comboBoxGameConfig_SelectedIndexChanged);
|
||||
this.comboBoxProjects.SelectionChangeCommitted += new System.EventHandler(this.comboBoxProjects_SelectionChangeCommitted);
|
||||
this.comboBoxProjects.SelectedValueChanged += new System.EventHandler(this.comboBoxProjects_SelectedValueChanged);
|
||||
//
|
||||
// comboBoxEngine
|
||||
//
|
||||
|
@ -53,7 +53,7 @@ namespace UniversalValveToolbox {
|
||||
}
|
||||
|
||||
private void UpdateLastSelectedProject() {
|
||||
var lastSelectedProject = dataProvider.Projects.First(project => project.Name.Equals(dataProvider.Settings.LastSelectedProject));
|
||||
var lastSelectedProject = dataProvider.Projects.FirstOrDefault(project => project.Name.Equals(dataProvider.Settings.LastSelectedProject));
|
||||
|
||||
if (lastSelectedProject != null) {
|
||||
var indexEngine = comboBoxEngine.Items.IndexOf(Engines.First(engine => engine.Appid.Equals(lastSelectedProject.Engine)).Name);
|
||||
@ -65,6 +65,11 @@ namespace UniversalValveToolbox {
|
||||
comboBoxProjects.SelectedIndex = indexProject;
|
||||
}
|
||||
}
|
||||
private void SaveLastSelectedProject() {
|
||||
var settings = dataProvider.Settings;
|
||||
settings.LastSelectedProject = SelectedProject?.Name;
|
||||
dataProvider.Settings = settings;
|
||||
}
|
||||
|
||||
|
||||
private void UpdateFormData() {
|
||||
@ -86,12 +91,6 @@ namespace UniversalValveToolbox {
|
||||
UpdateFormData();
|
||||
}
|
||||
|
||||
private void QuickSaveSettings() {
|
||||
var settings = dataProvider.Settings;
|
||||
settings.LastSelectedProject = SelectedProject.Name;
|
||||
dataProvider.Settings = settings;
|
||||
}
|
||||
|
||||
public void FillBaseMenuItems() {
|
||||
#region static content, do not edit
|
||||
//creating groups (categores)
|
||||
@ -436,20 +435,8 @@ namespace UniversalValveToolbox {
|
||||
}
|
||||
}
|
||||
|
||||
private void comboBoxGameConfig_SelectedIndexChanged(object sender, EventArgs e) {
|
||||
QuickSaveSettings();
|
||||
}
|
||||
|
||||
private void FormMain_FormClosing(object sender, FormClosingEventArgs e) {
|
||||
QuickSaveSettings();
|
||||
}
|
||||
|
||||
private void comboBoxProjects_SelectionChangeCommitted(object sender, EventArgs e) {
|
||||
QuickSaveSettings();
|
||||
}
|
||||
|
||||
private void comboBoxProjects_SelectedValueChanged(object sender, EventArgs e) {
|
||||
QuickSaveSettings();
|
||||
SaveLastSelectedProject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user