mirror of
https://github.com/EpicMorg/UniversalValveToolbox.git
synced 2025-02-06 02:30:33 +03:00
[not working yet]
This commit is contained in:
parent
c016a1e618
commit
3f057d100e
@ -2,20 +2,14 @@
|
|||||||
|
|
||||||
namespace UniversalValveToolbox.Model.Dto {
|
namespace UniversalValveToolbox.Model.Dto {
|
||||||
public class SettingsDtoModel : DtoModel {
|
public class SettingsDtoModel : DtoModel {
|
||||||
private string defaultProject;
|
private string lastSelectedProject;
|
||||||
private int[] availableEnginies;
|
|
||||||
private string[] availableLanguages;
|
private string[] availableLanguages;
|
||||||
private string language;
|
private string language;
|
||||||
private string theme;
|
private string theme;
|
||||||
|
|
||||||
public string DefaultProject {
|
public string LastSelectedProject {
|
||||||
get => defaultProject;
|
get => lastSelectedProject;
|
||||||
set => UpdateField(value, ref defaultProject);
|
set => UpdateField(value, ref lastSelectedProject);
|
||||||
}
|
|
||||||
|
|
||||||
public int[] AvailableEnginies {
|
|
||||||
get => availableEnginies;
|
|
||||||
set => UpdateField(value, ref availableEnginies);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string[] AvailableLanguages {
|
public string[] AvailableLanguages {
|
||||||
@ -27,10 +21,5 @@ namespace UniversalValveToolbox.Model.Dto {
|
|||||||
get => language;
|
get => language;
|
||||||
set => UpdateField(value, ref language);
|
set => UpdateField(value, ref language);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Theme {
|
|
||||||
get => theme;
|
|
||||||
set => UpdateField(value, ref theme);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
33
src/UniversalValveToolbox/UI/FormMain.Designer.cs
generated
33
src/UniversalValveToolbox/UI/FormMain.Designer.cs
generated
@ -30,7 +30,7 @@
|
|||||||
{
|
{
|
||||||
this.components = new System.ComponentModel.Container();
|
this.components = new System.ComponentModel.Container();
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
|
||||||
this.comboBoxGameConfig = new System.Windows.Forms.ComboBox();
|
this.comboBoxProjects = new System.Windows.Forms.ComboBox();
|
||||||
this.comboBoxEngine = new System.Windows.Forms.ComboBox();
|
this.comboBoxEngine = new System.Windows.Forms.ComboBox();
|
||||||
this.listView = new System.Windows.Forms.ListView();
|
this.listView = new System.Windows.Forms.ListView();
|
||||||
this.imageListLarge = new System.Windows.Forms.ImageList(this.components);
|
this.imageListLarge = new System.Windows.Forms.ImageList(this.components);
|
||||||
@ -45,21 +45,23 @@
|
|||||||
this.statusStrip.SuspendLayout();
|
this.statusStrip.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// comboBoxGameConfig
|
// comboBoxProjects
|
||||||
//
|
//
|
||||||
this.comboBoxGameConfig.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
this.comboBoxProjects.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.comboBoxGameConfig.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
this.comboBoxProjects.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
this.comboBoxGameConfig.Enabled = false;
|
this.comboBoxProjects.Enabled = false;
|
||||||
this.comboBoxGameConfig.FormattingEnabled = true;
|
this.comboBoxProjects.FormattingEnabled = true;
|
||||||
this.comboBoxGameConfig.ItemHeight = 13;
|
this.comboBoxProjects.ItemHeight = 13;
|
||||||
this.comboBoxGameConfig.Items.AddRange(new object[] {
|
this.comboBoxProjects.Items.AddRange(new object[] {
|
||||||
"No project configured"});
|
"No project configured"});
|
||||||
this.comboBoxGameConfig.Location = new System.Drawing.Point(12, 412);
|
this.comboBoxProjects.Location = new System.Drawing.Point(12, 412);
|
||||||
this.comboBoxGameConfig.Name = "comboBoxGameConfig";
|
this.comboBoxProjects.Name = "comboBoxProjects";
|
||||||
this.comboBoxGameConfig.Size = new System.Drawing.Size(449, 21);
|
this.comboBoxProjects.Size = new System.Drawing.Size(449, 21);
|
||||||
this.comboBoxGameConfig.TabIndex = 1;
|
this.comboBoxProjects.TabIndex = 1;
|
||||||
this.comboBoxGameConfig.SelectedIndexChanged += new System.EventHandler(this.comboBoxGameConfig_SelectedIndexChanged);
|
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
|
||||||
//
|
//
|
||||||
@ -192,13 +194,14 @@
|
|||||||
this.Controls.Add(this.statusStrip);
|
this.Controls.Add(this.statusStrip);
|
||||||
this.Controls.Add(this.listView);
|
this.Controls.Add(this.listView);
|
||||||
this.Controls.Add(this.comboBoxEngine);
|
this.Controls.Add(this.comboBoxEngine);
|
||||||
this.Controls.Add(this.comboBoxGameConfig);
|
this.Controls.Add(this.comboBoxProjects);
|
||||||
this.DoubleBuffered = true;
|
this.DoubleBuffered = true;
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
this.MinimumSize = new System.Drawing.Size(373, 474);
|
this.MinimumSize = new System.Drawing.Size(373, 474);
|
||||||
this.Name = "FormMain";
|
this.Name = "FormMain";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
this.Text = "Universal Valve Toolbox";
|
this.Text = "Universal Valve Toolbox";
|
||||||
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormMain_FormClosing);
|
||||||
this.Load += new System.EventHandler(this.FormMain_Load);
|
this.Load += new System.EventHandler(this.FormMain_Load);
|
||||||
this.statusStrip.ResumeLayout(false);
|
this.statusStrip.ResumeLayout(false);
|
||||||
this.statusStrip.PerformLayout();
|
this.statusStrip.PerformLayout();
|
||||||
@ -208,7 +211,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
private System.Windows.Forms.ComboBox comboBoxGameConfig;
|
private System.Windows.Forms.ComboBox comboBoxProjects;
|
||||||
private System.Windows.Forms.ComboBox comboBoxEngine;
|
private System.Windows.Forms.ComboBox comboBoxEngine;
|
||||||
private System.Windows.Forms.ListView listView;
|
private System.Windows.Forms.ListView listView;
|
||||||
private System.Windows.Forms.StatusStrip statusStrip;
|
private System.Windows.Forms.StatusStrip statusStrip;
|
||||||
|
@ -28,8 +28,8 @@ namespace UniversalValveToolbox {
|
|||||||
|
|
||||||
private EngineDtoModel SelectedEngine { get => Engines[comboBoxEngine.SelectedIndex]; }
|
private EngineDtoModel SelectedEngine { get => Engines[comboBoxEngine.SelectedIndex]; }
|
||||||
private ProjectDtoModel SelectedProject {
|
private ProjectDtoModel SelectedProject {
|
||||||
get => (ProjectDtoModel)((comboBoxGameConfig.Enabled)
|
get => (ProjectDtoModel)((comboBoxProjects.Enabled)
|
||||||
? comboBoxGameConfig.SelectedItem
|
? Projects.First(project => project.Name.Equals(comboBoxProjects.SelectedItem))
|
||||||
: null);
|
: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,16 +47,34 @@ namespace UniversalValveToolbox {
|
|||||||
UpdateAddonsList();
|
UpdateAddonsList();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormMain_Load(object sender, EventArgs e) {
|
private void FormMain_Load(object sender, EventArgs e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateLastSelectedProject() {
|
||||||
|
var lastSelectedProject = dataProvider.Projects.First(project => project.Name.Equals(dataProvider.Settings.LastSelectedProject));
|
||||||
|
|
||||||
|
if (lastSelectedProject != null) {
|
||||||
|
var indexEngine = comboBoxEngine.Items.IndexOf(Engines.First(engine => engine.Appid.Equals(lastSelectedProject.Engine)).Name);
|
||||||
|
comboBoxEngine.SelectedIndex = indexEngine;
|
||||||
|
|
||||||
|
UpdateProjectList();
|
||||||
|
|
||||||
|
var indexProject = comboBoxProjects.Items.IndexOf(lastSelectedProject.Name);
|
||||||
|
comboBoxProjects.SelectedIndex = indexProject;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void UpdateFormData() {
|
private void UpdateFormData() {
|
||||||
UpdateEngineList();
|
UpdateEngineList();
|
||||||
UpdateProjectList();
|
UpdateProjectList();
|
||||||
UpdateToolsList();
|
UpdateToolsList();
|
||||||
UpdateAddonsList();
|
UpdateAddonsList();
|
||||||
UpdateNavigationBar();
|
UpdateNavigationBar();
|
||||||
|
|
||||||
|
UpdateLastSelectedProject();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateNavigationBar() {
|
private void UpdateNavigationBar() {
|
||||||
@ -68,6 +86,12 @@ 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)
|
||||||
@ -151,17 +175,17 @@ namespace UniversalValveToolbox {
|
|||||||
AvailableProjects = Projects.Where(project => project.Engine == selectEngine.Appid).ToArray();
|
AvailableProjects = Projects.Where(project => project.Engine == selectEngine.Appid).ToArray();
|
||||||
|
|
||||||
if (AvailableProjects != null && AvailableProjects.Length != 0) {
|
if (AvailableProjects != null && AvailableProjects.Length != 0) {
|
||||||
comboBoxGameConfig.Enabled = true;
|
comboBoxProjects.Enabled = true;
|
||||||
|
|
||||||
comboBoxGameConfig.Items.Clear();
|
comboBoxProjects.Items.Clear();
|
||||||
comboBoxGameConfig.Items.AddRange(AvailableProjects.ToArray());
|
comboBoxProjects.Items.AddRange(AvailableProjects.Select(project => project.Name).ToArray());
|
||||||
|
|
||||||
comboBoxGameConfig.SelectedIndex = 0;
|
comboBoxProjects.SelectedIndex = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
comboBoxGameConfig.Enabled = false;
|
comboBoxProjects.Enabled = false;
|
||||||
|
|
||||||
comboBoxGameConfig.Items.Clear();
|
comboBoxProjects.Items.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,7 +437,19 @@ namespace UniversalValveToolbox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void comboBoxGameConfig_SelectedIndexChanged(object sender, EventArgs e) {
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"DefaultProject": null,
|
"LastSelectedProject": null,
|
||||||
"AvailableEnginies": null,
|
|
||||||
"Language": "en-US",
|
"Language": "en-US",
|
||||||
"AvailableLanguages": [ "en-US", "ru-RU" ],
|
"AvailableLanguages": [ "en-US", "ru-RU" ],
|
||||||
"Theme": null
|
"Theme": null
|
||||||
|
Loading…
x
Reference in New Issue
Block a user