mirror of
https://github.com/EpicMorg/UniversalValveToolbox.git
synced 2024-12-27 07:05:29 +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.Name = "comboBoxProjects";
|
||||||
this.comboBoxProjects.Size = new System.Drawing.Size(449, 21);
|
this.comboBoxProjects.Size = new System.Drawing.Size(449, 21);
|
||||||
this.comboBoxProjects.TabIndex = 1;
|
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
|
// comboBoxEngine
|
||||||
//
|
//
|
||||||
|
@ -53,7 +53,7 @@ namespace UniversalValveToolbox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateLastSelectedProject() {
|
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) {
|
if (lastSelectedProject != null) {
|
||||||
var indexEngine = comboBoxEngine.Items.IndexOf(Engines.First(engine => engine.Appid.Equals(lastSelectedProject.Engine)).Name);
|
var indexEngine = comboBoxEngine.Items.IndexOf(Engines.First(engine => engine.Appid.Equals(lastSelectedProject.Engine)).Name);
|
||||||
@ -65,6 +65,11 @@ namespace UniversalValveToolbox {
|
|||||||
comboBoxProjects.SelectedIndex = indexProject;
|
comboBoxProjects.SelectedIndex = indexProject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void SaveLastSelectedProject() {
|
||||||
|
var settings = dataProvider.Settings;
|
||||||
|
settings.LastSelectedProject = SelectedProject?.Name;
|
||||||
|
dataProvider.Settings = settings;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void UpdateFormData() {
|
private void UpdateFormData() {
|
||||||
@ -86,12 +91,6 @@ namespace UniversalValveToolbox {
|
|||||||
UpdateFormData();
|
UpdateFormData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void QuickSaveSettings() {
|
|
||||||
var settings = dataProvider.Settings;
|
|
||||||
settings.LastSelectedProject = SelectedProject.Name;
|
|
||||||
dataProvider.Settings = settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void FillBaseMenuItems() {
|
public void FillBaseMenuItems() {
|
||||||
#region static content, do not edit
|
#region static content, do not edit
|
||||||
//creating groups (categores)
|
//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) {
|
private void FormMain_FormClosing(object sender, FormClosingEventArgs e) {
|
||||||
QuickSaveSettings();
|
SaveLastSelectedProject();
|
||||||
}
|
|
||||||
|
|
||||||
private void comboBoxProjects_SelectionChangeCommitted(object sender, EventArgs e) {
|
|
||||||
QuickSaveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void comboBoxProjects_SelectedValueChanged(object sender, EventArgs e) {
|
|
||||||
QuickSaveSettings();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user