Change system tabs to required operating systems tab in metadata dialog.

This commit is contained in:
2018-03-16 15:44:58 +00:00
parent 1d05a81d2d
commit 700814600c
3 changed files with 133 additions and 82 deletions

View File

@@ -160,4 +160,10 @@ namespace apprepodbmgr.Eto
public string path { get; set; } public string path { get; set; }
public BlockMediaType disk { get; set; } public BlockMediaType disk { get; set; }
} }
class TargetOsEntry
{
public string name { get; set; }
public string version { get; set; }
}
} }

View File

@@ -80,6 +80,31 @@
</StackLayoutItem> </StackLayoutItem>
</StackLayout> </StackLayout>
</TabPage> </TabPage>
<TabPage Text="Required operating systems" ID="tabTargetOs">
<StackLayout Orientation="Vertical">
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label>New operating system:</Label>
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch">
<TextBox ID="txtNewOsName" />
</StackLayoutItem>
<Label>version:</Label>
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch">
<TextBox ID="txtNewOsVersion" />
</StackLayoutItem>
<Button ID="btnAddNewOs" Click="OnBtnAddNewOsClicked">Add</Button>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Expand="True">
<GridView ID="treeOses">
</GridView>
</StackLayoutItem>
<StackLayout Orientation="Horizontal">
<Button ID="btnClearOses" Click="OnBtnClearOsesClicked">Clear</Button>
<Button ID="btnRemoveRemoveOs" Click="OnBtnRemoveOsClicked">Remove</Button>
</StackLayout>
</StackLayout>
</TabPage>
<TabPage Text="Keywords" ID="tabKeywords"> <TabPage Text="Keywords" ID="tabKeywords">
<StackLayout Orientation="Vertical"> <StackLayout Orientation="Vertical">
<StackLayoutItem HorizontalAlignment="Stretch"> <StackLayoutItem HorizontalAlignment="Stretch">
@@ -191,27 +216,6 @@
</StackLayout> </StackLayout>
</StackLayout> </StackLayout>
</TabPage> </TabPage>
<TabPage Text="Systems" ID="tabSystems">
<StackLayout Orientation="Vertical">
<StackLayoutItem HorizontalAlignment="Stretch">
<StackLayout Orientation="Horizontal">
<Label>New system:</Label>
<StackLayoutItem Expand="True" HorizontalAlignment="Stretch">
<TextBox ID="txtNewSystem" />
</StackLayoutItem>
<Button ID="btnAddSystem" Click="OnBtnAddSystemClicked">Add</Button>
</StackLayout>
</StackLayoutItem>
<StackLayoutItem HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Expand="True">
<GridView ID="treeSystems">
</GridView>
</StackLayoutItem>
<StackLayout Orientation="Horizontal">
<Button ID="btnClearSystems" Click="OnBtnClearSystemsClicked">Clear</Button>
<Button ID="btnRemoveSystem" Click="OnBtnRemoveSystemClicked">Remove</Button>
</StackLayout>
</StackLayout>
</TabPage>
<TabPage Text="Architectures" ID="tabArchitectures"> <TabPage Text="Architectures" ID="tabArchitectures">
<StackLayout Orientation="Vertical"> <StackLayout Orientation="Vertical">
<StackLayoutItem HorizontalAlignment="Stretch"> <StackLayoutItem HorizontalAlignment="Stretch">

View File

@@ -58,8 +58,8 @@ namespace apprepodbmgr.Eto
ObservableCollection<StringEntry> lstKeywords; ObservableCollection<StringEntry> lstKeywords;
ObservableCollection<StringEntry> lstLanguages; ObservableCollection<StringEntry> lstLanguages;
ObservableCollection<string> lstLanguageTypes; ObservableCollection<string> lstLanguageTypes;
ObservableCollection<TargetOsEntry> lstOses;
ObservableCollection<StringEntry> lstSubcategories; ObservableCollection<StringEntry> lstSubcategories;
ObservableCollection<StringEntry> lstSystems;
// TODO: Add the options to edit these fields // TODO: Add the options to edit these fields
MagazineType[] magazines; MagazineType[] magazines;
@@ -67,7 +67,6 @@ namespace apprepodbmgr.Eto
public bool Modified; public bool Modified;
PCIType[] pcis; PCIType[] pcis;
RequiredOperatingSystemType[] requiredOses;
bool stopped; bool stopped;
Thread thdDisc; Thread thdDisc;
@@ -88,7 +87,7 @@ namespace apprepodbmgr.Eto
lstCategories = new ObservableCollection<StringEntry>(); lstCategories = new ObservableCollection<StringEntry>();
lstSubcategories = new ObservableCollection<StringEntry>(); lstSubcategories = new ObservableCollection<StringEntry>();
lstLanguages = new ObservableCollection<StringEntry>(); lstLanguages = new ObservableCollection<StringEntry>();
lstSystems = new ObservableCollection<StringEntry>(); lstOses = new ObservableCollection<TargetOsEntry>();
lstArchitectures = new ObservableCollection<StringEntry>(); lstArchitectures = new ObservableCollection<StringEntry>();
lstDiscs = new ObservableCollection<DiscEntry>(); lstDiscs = new ObservableCollection<DiscEntry>();
lstDisks = new ObservableCollection<DiskEntry>(); lstDisks = new ObservableCollection<DiskEntry>();
@@ -126,10 +125,15 @@ namespace apprepodbmgr.Eto
DataCell = new TextBoxCell {Binding = Binding.Property<StringEntry, string>(r => r.str)}, DataCell = new TextBoxCell {Binding = Binding.Property<StringEntry, string>(r => r.str)},
HeaderText = "Language" HeaderText = "Language"
}); });
treeSystems.Columns.Add(new GridColumn treeOses.Columns.Add(new GridColumn
{ {
DataCell = new TextBoxCell {Binding = Binding.Property<StringEntry, string>(r => r.str)}, DataCell = new TextBoxCell {Binding = Binding.Property<TargetOsEntry, string>(r => r.name)},
HeaderText = "System" HeaderText = "Name"
});
treeOses.Columns.Add(new GridColumn
{
DataCell = new TextBoxCell {Binding = Binding.Property<TargetOsEntry, string>(r => r.version)},
HeaderText = "Version"
}); });
treeArchitectures.Columns.Add(new GridColumn treeArchitectures.Columns.Add(new GridColumn
{ {
@@ -152,7 +156,7 @@ namespace apprepodbmgr.Eto
treeCategories.DataStore = lstCategories; treeCategories.DataStore = lstCategories;
treeSubcategories.DataStore = lstSubcategories; treeSubcategories.DataStore = lstSubcategories;
treeLanguages.DataStore = lstLanguages; treeLanguages.DataStore = lstLanguages;
treeSystems.DataStore = lstSystems; treeOses.DataStore = lstOses;
treeArchitectures.DataStore = lstArchitectures; treeArchitectures.DataStore = lstArchitectures;
treeDiscs.DataStore = lstDiscs; treeDiscs.DataStore = lstDiscs;
treeDisks.DataStore = lstDisks; treeDisks.DataStore = lstDisks;
@@ -162,7 +166,7 @@ namespace apprepodbmgr.Eto
treeCategories.AllowMultipleSelection = false; treeCategories.AllowMultipleSelection = false;
treeSubcategories.AllowMultipleSelection = false; treeSubcategories.AllowMultipleSelection = false;
treeLanguages.AllowMultipleSelection = false; treeLanguages.AllowMultipleSelection = false;
treeSystems.AllowMultipleSelection = false; treeOses.AllowMultipleSelection = false;
treeArchitectures.AllowMultipleSelection = false; treeArchitectures.AllowMultipleSelection = false;
treeDiscs.AllowMultipleSelection = false; treeDiscs.AllowMultipleSelection = false;
treeDisks.AllowMultipleSelection = false; treeDisks.AllowMultipleSelection = false;
@@ -289,9 +293,10 @@ namespace apprepodbmgr.Eto
lstLanguageTypes.Remove(language.ToString()); lstLanguageTypes.Remove(language.ToString());
} }
if(Metadata.Systems != null) if(Metadata.RequiredOperatingSystems != null)
foreach(string system in Metadata.Systems) foreach(RequiredOperatingSystemType reqos in Metadata.RequiredOperatingSystems)
lstSystems.Add(new StringEntry {str = system}); foreach(string reqver in reqos.Version)
lstOses.Add(new TargetOsEntry {name = reqos.Name, version = reqver});
if(Metadata.Architectures != null) if(Metadata.Architectures != null)
foreach(ArchitecturesTypeArchitecture architecture in Metadata.Architectures) foreach(ArchitecturesTypeArchitecture architecture in Metadata.Architectures)
@@ -372,7 +377,6 @@ namespace apprepodbmgr.Eto
magazines = Metadata.Magazine; magazines = Metadata.Magazine;
books = Metadata.Book; books = Metadata.Book;
requiredOses = Metadata.RequiredOperatingSystems;
usermanuals = Metadata.UserManual; usermanuals = Metadata.UserManual;
adverts = Metadata.Advertisement; adverts = Metadata.Advertisement;
linearmedias = Metadata.LinearMedia; linearmedias = Metadata.LinearMedia;
@@ -483,20 +487,33 @@ namespace apprepodbmgr.Eto
FillLanguagesCombo(); FillLanguagesCombo();
} }
protected void OnBtnAddSystemClicked(object sender, EventArgs e) protected void OnBtnAddNewOsClicked(object sender, EventArgs e)
{ {
lstSystems.Add(new StringEntry {str = txtNewSystem.Text}); if(string.IsNullOrWhiteSpace(txtNewOsName.Text))
txtNewSystem.Text = ""; {
MessageBox.Show("Operating system name cannot be empty.", MessageBoxType.Error);
return;
} }
protected void OnBtnClearSystemsClicked(object sender, EventArgs e) if(string.IsNullOrWhiteSpace(txtNewOsVersion.Text))
{ {
lstSystems.Clear(); MessageBox.Show("Operating system version cannot be empty.", MessageBoxType.Error);
return;
} }
protected void OnBtnRemoveSystemClicked(object sender, EventArgs e) lstOses.Add(new TargetOsEntry {name = txtNewOsName.Text, version = txtNewOsVersion.Text});
txtNewOsName.Text = "";
txtNewOsVersion.Text = "";
}
protected void OnBtnClearOsesClicked(object sender, EventArgs e)
{ {
if(treeSystems.SelectedItem != null) lstSystems.Remove((StringEntry)treeSystems.SelectedItem); lstOses.Clear();
}
protected void OnBtnRemoveOsClicked(object sender, EventArgs e)
{
if(treeOses.SelectedItem != null) lstOses.Remove((TargetOsEntry)treeOses.SelectedItem);
} }
protected void OnBtnAddArchitectureClicked(object sender, EventArgs e) protected void OnBtnAddArchitectureClicked(object sender, EventArgs e)
@@ -529,7 +546,7 @@ namespace apprepodbmgr.Eto
tabBarcodes.Visible = false; tabBarcodes.Visible = false;
tabCategories.Visible = false; tabCategories.Visible = false;
tabLanguages.Visible = false; tabLanguages.Visible = false;
tabSystems.Visible = false; tabTargetOs.Visible = false;
tabArchitectures.Visible = false; tabArchitectures.Visible = false;
tabDisks.Visible = false; tabDisks.Visible = false;
prgAddDisc1.Visible = true; prgAddDisc1.Visible = true;
@@ -616,7 +633,7 @@ namespace apprepodbmgr.Eto
tabBarcodes.Visible = true; tabBarcodes.Visible = true;
tabCategories.Visible = true; tabCategories.Visible = true;
tabLanguages.Visible = true; tabLanguages.Visible = true;
tabSystems.Visible = true; tabTargetOs.Visible = true;
tabArchitectures.Visible = true; tabArchitectures.Visible = true;
tabDisks.Visible = true; tabDisks.Visible = true;
prgAddDisc1.Visible = false; prgAddDisc1.Visible = false;
@@ -678,7 +695,7 @@ namespace apprepodbmgr.Eto
tabBarcodes.Visible = true; tabBarcodes.Visible = true;
tabCategories.Visible = true; tabCategories.Visible = true;
tabLanguages.Visible = true; tabLanguages.Visible = true;
tabSystems.Visible = true; tabTargetOs.Visible = true;
tabArchitectures.Visible = true; tabArchitectures.Visible = true;
tabDisks.Visible = true; tabDisks.Visible = true;
prgAddDisc1.Visible = false; prgAddDisc1.Visible = false;
@@ -724,7 +741,7 @@ namespace apprepodbmgr.Eto
tabBarcodes.Visible = false; tabBarcodes.Visible = false;
tabCategories.Visible = false; tabCategories.Visible = false;
tabLanguages.Visible = false; tabLanguages.Visible = false;
tabSystems.Visible = false; tabTargetOs.Visible = false;
tabArchitectures.Visible = false; tabArchitectures.Visible = false;
tabDiscs.Visible = false; tabDiscs.Visible = false;
prgAddDisk1.Visible = true; prgAddDisk1.Visible = true;
@@ -811,7 +828,7 @@ namespace apprepodbmgr.Eto
tabBarcodes.Visible = true; tabBarcodes.Visible = true;
tabCategories.Visible = true; tabCategories.Visible = true;
tabLanguages.Visible = true; tabLanguages.Visible = true;
tabSystems.Visible = true; tabTargetOs.Visible = true;
tabArchitectures.Visible = true; tabArchitectures.Visible = true;
tabDiscs.Visible = true; tabDiscs.Visible = true;
prgAddDisk1.Visible = false; prgAddDisk1.Visible = false;
@@ -877,7 +894,7 @@ namespace apprepodbmgr.Eto
tabBarcodes.Visible = true; tabBarcodes.Visible = true;
tabCategories.Visible = true; tabCategories.Visible = true;
tabLanguages.Visible = true; tabLanguages.Visible = true;
tabSystems.Visible = true; tabTargetOs.Visible = true;
tabArchitectures.Visible = true; tabArchitectures.Visible = true;
tabDiscs.Visible = true; tabDiscs.Visible = true;
prgAddDisk1.Visible = false; prgAddDisk1.Visible = false;
@@ -977,7 +994,31 @@ namespace apprepodbmgr.Eto
foreach(StringEntry entry in lstSubcategories) subcategories.Add(entry.str); foreach(StringEntry entry in lstSubcategories) subcategories.Add(entry.str);
foreach(StringEntry entry in lstSystems) systems.Add(entry.str); if(lstOses.Count > 0)
{
Dictionary<string, List<string>> osesDict = new Dictionary<string, List<string>>();
foreach(TargetOsEntry entry in lstOses.OrderBy(t => t.name).ThenBy(t => t.version))
{
osesDict.TryGetValue(entry.name, out List<string> versList);
if(versList == null) versList = new List<string>();
if(versList.Contains(entry.version)) continue;
versList.Add(entry.version);
versList.Sort();
osesDict.Remove(entry.name);
osesDict.Add(entry.name, versList);
}
Metadata.RequiredOperatingSystems = osesDict
.OrderBy(t => t.Key)
.Select(entry => new RequiredOperatingSystemType
{
Name = entry.Key,
Version = entry.Value.ToArray()
}).ToArray();
}
if(architectures.Count > 0) Metadata.Architectures = architectures.ToArray(); if(architectures.Count > 0) Metadata.Architectures = architectures.ToArray();
if(barcodes.Count > 0) Metadata.Barcodes = barcodes.ToArray(); if(barcodes.Count > 0) Metadata.Barcodes = barcodes.ToArray();
@@ -991,7 +1032,6 @@ namespace apprepodbmgr.Eto
Metadata.Magazine = magazines; Metadata.Magazine = magazines;
Metadata.Book = books; Metadata.Book = books;
Metadata.RequiredOperatingSystems = requiredOses;
Metadata.UserManual = usermanuals; Metadata.UserManual = usermanuals;
Metadata.Advertisement = adverts; Metadata.Advertisement = adverts;
Metadata.LinearMedia = linearmedias; Metadata.LinearMedia = linearmedias;
@@ -1069,9 +1109,10 @@ namespace apprepodbmgr.Eto
TabPage tabLanguages; TabPage tabLanguages;
ComboBox cmbLanguages; ComboBox cmbLanguages;
GridView treeLanguages; GridView treeLanguages;
TabPage tabSystems; TabPage tabTargetOs;
TextBox txtNewSystem; TextBox txtNewOsName;
GridView treeSystems; TextBox txtNewOsVersion;
GridView treeOses;
TabPage tabArchitectures; TabPage tabArchitectures;
ComboBox cmbArchitectures; ComboBox cmbArchitectures;
GridView treeArchitectures; GridView treeArchitectures;