mirror of
https://github.com/EpicMorg/UniversalValveToolbox.git
synced 2024-12-26 06:35:29 +03:00
This commit is contained in:
parent
3b53622c49
commit
3a33fde10a
@ -57,7 +57,14 @@ namespace UniversalValveToolbox.Model.ViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
public AddonDtoModel SelectAddon => addons[selectAddonIndex];
|
||||
public AddonDtoModel SelectAddon {
|
||||
get {
|
||||
if (addons == null || addons.Length == 0)
|
||||
return null;
|
||||
|
||||
return addons[selectAddonIndex];
|
||||
}
|
||||
}
|
||||
|
||||
public DictionaryEntry SelectCategory {
|
||||
get { return categories[selectCategoryIndex]; }
|
||||
|
@ -61,7 +61,16 @@ namespace UniversalValveToolbox.Properties.translations {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to <new project>.
|
||||
/// Looks up a localized string similar to <New Addon>.
|
||||
/// </summary>
|
||||
internal static string strNewAddon {
|
||||
get {
|
||||
return ResourceManager.GetString("strNewAddon", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to <New Project>.
|
||||
/// </summary>
|
||||
internal static string strNewProject {
|
||||
get {
|
||||
|
@ -117,7 +117,10 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="strNewAddon" xml:space="preserve">
|
||||
<value><New Addon></value>
|
||||
</data>
|
||||
<data name="strNewProject" xml:space="preserve">
|
||||
<value><new project></value>
|
||||
<value><New Project></value>
|
||||
</data>
|
||||
</root>
|
@ -117,7 +117,10 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="strNewAddon" xml:space="preserve">
|
||||
<value><Новое Дополнение></value>
|
||||
</data>
|
||||
<data name="strNewProject" xml:space="preserve">
|
||||
<value><новый проект></value>
|
||||
<value><Новый Проект></value>
|
||||
</data>
|
||||
</root>
|
@ -75,11 +75,18 @@ namespace UniversalValveToolbox {
|
||||
engineCheckedListBox.Items.Clear();
|
||||
engineCheckedListBox.Items.AddRange(model.Engines);
|
||||
|
||||
for (var i = 0; i < model.Engines.Length; i++) {
|
||||
var engine = model.Engines[i];
|
||||
if (model.SelectAddon != null) {
|
||||
for (var i = 0; i < model.Engines.Length; i++) {
|
||||
var engine = model.Engines[i];
|
||||
|
||||
if (model.SelectAddon.Engines.Contains(engine.Appid)) {
|
||||
engineCheckedListBox.SetItemChecked(i, true);
|
||||
if (model.SelectAddon.Engines.Contains(engine.Appid)) {
|
||||
engineCheckedListBox.SetItemChecked(i, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var i = 0; i < model.Engines.Length; i++) {
|
||||
engineCheckedListBox.SetItemChecked(i, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,9 +94,15 @@ namespace UniversalValveToolbox {
|
||||
}
|
||||
|
||||
private void UpdateAddonsComboBox() {
|
||||
comboBox_Addon.Items.Clear();
|
||||
comboBox_Addon.Items.AddRange(model.Addons);
|
||||
comboBox_Addon.SelectedIndex = 0;
|
||||
if (model.Addons.Length == 0) {
|
||||
New();
|
||||
}
|
||||
else {
|
||||
comboBox_Addon.Items.Clear();
|
||||
comboBox_Addon.Items.AddRange(model.Addons);
|
||||
|
||||
comboBox_Addon.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateAddonCategoryComboBox() {
|
||||
@ -136,8 +149,7 @@ namespace UniversalValveToolbox {
|
||||
}
|
||||
|
||||
private void New() {
|
||||
var newAddon = new AddonDtoModel();
|
||||
newAddon.Name = "<new addon>";
|
||||
var newAddon = CreateNewEmptyAddon();
|
||||
|
||||
var newAddonList = new List<AddonDtoModel>(model.Addons);
|
||||
newAddonList.Insert(0, newAddon);
|
||||
@ -147,6 +159,13 @@ namespace UniversalValveToolbox {
|
||||
UpdateAddonsComboBox();
|
||||
}
|
||||
|
||||
private AddonDtoModel CreateNewEmptyAddon() {
|
||||
var newAddon = new AddonDtoModel();
|
||||
newAddon.Name = Properties.translations.VarStrings.strNewAddon;
|
||||
|
||||
return newAddon;
|
||||
}
|
||||
|
||||
private void Save() {
|
||||
JsonFileUtil.SaveValues(DataProvider.AddonsPath, "json", model.Addons.ToList());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user