Skip to content

Commit f458e79

Browse files
committed
Finished AppTree view; - NWZ
1 parent b48395a commit f458e79

29 files changed

+1031
-70
lines changed

UI++Editor/(G)UI++.csproj

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,10 @@
196196
<Compile Include="AppBootstrapper.cs" />
197197
<Compile Include="Controllers\ImageController.cs" />
198198
<Compile Include="Controllers\TreeViewSelectionBehavior.cs" />
199+
<Compile Include="Converters\AppTreeIconConverter.cs" />
200+
<Compile Include="Enums\AppTreeEnum.cs" />
199201
<Compile Include="Globals.cs" />
202+
<Compile Include="Interfaces\IAppTreeSubChild.cs" />
200203
<Compile Include="Interfaces\IChildElement.cs" />
201204
<Compile Include="Interfaces\IParentElement.cs" />
202205
<Compile Include="Models\ActionClasses\DefaultValues.cs" />
@@ -270,7 +273,10 @@
270273
<Compile Include="ViewModels\Actions\Children\InputTextViewModel.cs" />
271274
<Compile Include="ViewModels\Actions\Children\MatchViewModel.cs" />
272275
<Compile Include="ViewModels\Actions\Children\PropertyViewModel.cs" />
276+
<Compile Include="ViewModels\Actions\Children\SetViewModel.cs" />
277+
<Compile Include="ViewModels\Actions\Children\SoftwareGroupViewModel.cs" />
273278
<Compile Include="ViewModels\Actions\Children\SoftwareListRefViewModel.cs" />
279+
<Compile Include="ViewModels\Actions\Children\SoftwareRefViewModel.cs" />
274280
<Compile Include="ViewModels\Actions\Children\TextViewModel.cs" />
275281
<Compile Include="ViewModels\Actions\Children\VariableViewModel.cs" />
276282
<Compile Include="ViewModels\Actions\InfoFullScreenViewModel.cs" />
@@ -297,6 +303,7 @@
297303
<Compile Include="ViewModels\Actions\RegWriteViewModel.cs" />
298304
<Compile Include="ViewModels\Actions\RegReadViewModel.cs" />
299305
<Compile Include="ViewModels\Actions\_IAction.cs" />
306+
<Compile Include="ViewModels\Dialogs\AppSearchDialogViewModel.cs" />
300307
<Compile Include="ViewModels\Elements\_IElement.cs" />
301308
<Compile Include="ViewModels\MainWindowViewModel.cs" />
302309
<Compile Include="ViewModels\Menus\AboutViewModel.cs" />
@@ -321,6 +328,9 @@
321328
<Compile Include="ViewModels\Preview\InfoViewModel.cs" />
322329
<Compile Include="ViewModels\Preview\_IPreview.cs" />
323330
<Compile Include="ViewModels\Preview\_NoPreviewViewModel.cs" />
331+
<Compile Include="Views\Actions\Children\SetView.xaml.cs">
332+
<DependentUpon>SetView.xaml</DependentUpon>
333+
</Compile>
324334
<Compile Include="Views\Actions\Children\ChoiceListView.xaml.cs">
325335
<DependentUpon>ChoiceListView.xaml</DependentUpon>
326336
</Compile>
@@ -357,6 +367,9 @@
357367
<Compile Include="Views\Actions\SoftwareDiscoveryView.xaml.cs">
358368
<DependentUpon>SoftwareDiscoveryView.xaml</DependentUpon>
359369
</Compile>
370+
<Compile Include="Views\Dialogs\AppSearchDialog.xaml.cs">
371+
<DependentUpon>AppSearchDialog.xaml</DependentUpon>
372+
</Compile>
360373
<Compile Include="Views\MainWindowView.xaml.cs">
361374
<DependentUpon>MainWindowView.xaml</DependentUpon>
362375
</Compile>
@@ -559,6 +572,10 @@
559572
<Resource Include="Images\warn.png" />
560573
</ItemGroup>
561574
<ItemGroup>
575+
<Page Include="Views\Actions\Children\SetView.xaml">
576+
<Generator>MSBuild:Compile</Generator>
577+
<SubType>Designer</SubType>
578+
</Page>
562579
<Page Include="Views\Actions\Children\ChoiceListView.xaml">
563580
<Generator>MSBuild:Compile</Generator>
564581
<SubType>Designer</SubType>
@@ -607,6 +624,10 @@
607624
<Generator>MSBuild:Compile</Generator>
608625
<SubType>Designer</SubType>
609626
</Page>
627+
<Page Include="Views\Dialogs\AppSearchDialog.xaml">
628+
<SubType>Designer</SubType>
629+
<Generator>MSBuild:Compile</Generator>
630+
</Page>
610631
<Page Include="Views\MainWindowView.xaml">
611632
<SubType>Designer</SubType>
612633
<Generator>MSBuild:Compile</Generator>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Globalization;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
using System.Windows.Data;
9+
10+
namespace UI__Editor.Converters
11+
{
12+
public class AppTreeCheckConverter : IValueConverter
13+
{
14+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
15+
{
16+
return new Int32Rect(System.Convert.ToInt32(value), 0, 16, 16);
17+
}
18+
19+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
20+
{
21+
return null;
22+
}
23+
}
24+
25+
public class AppTreeTypeConverter : IValueConverter
26+
{
27+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
28+
{
29+
return new Int32Rect(System.Convert.ToInt32(value), 0, 18, 18);
30+
}
31+
32+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
33+
{
34+
return null;
35+
}
36+
}
37+
}

UI++Editor/Enums/AppTreeEnum.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace UI__Editor.Enums
8+
{
9+
public static class AppTreeEnum
10+
{
11+
public enum IconStyle
12+
{
13+
Folder = 0,
14+
FolderLock = 18,
15+
App = 36,
16+
AppLock = 54,
17+
AppAdd = 72,
18+
AppRemove = 90
19+
}
20+
public enum CheckStyle
21+
{
22+
Unchecked = 16,
23+
Checked = 32,
24+
Indeterminate = 48,
25+
DisabledUnchecked = 64,
26+
DisabledChecked = 80,
27+
DisabledIndeterminate = 96,
28+
HighlightUnchecked = 112,
29+
HighlightChcked = 128,
30+
HighlightIndeterminate = 144
31+
}
32+
}
33+
}

UI++Editor/Globals.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
using System.Linq;
55
using System.Text;
66
using System.Threading.Tasks;
7+
using UI__Editor.ViewModels;
8+
using UI__Editor.ViewModels.Menus;
79

810
namespace UI__Editor
911
{
@@ -20,5 +22,7 @@ public static class Globals
2022
public static string PREFLIGHTPASSED;
2123
public static string PREFLIGHTPASSEDWITHWARNING;
2224
public static IEventAggregator EventAggregator;
25+
public static SoftwareViewModel SoftwareViewModel;
26+
public static MainWindowViewModel MainWindowViewModel;
2327
}
2428
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace UI__Editor.Interfaces
8+
{
9+
public interface IAppTreeSubChild
10+
{
11+
bool Default { get; set; }
12+
bool Required { get; set; }
13+
IElement Parent { get; set; }
14+
}
15+
}

UI++Editor/Models/ActionClasses/AppTree.cs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,27 @@
66
using System.Xml;
77
using UI__Editor.Interfaces;
88
using Caliburn.Micro;
9+
using System.Collections.ObjectModel;
910

1011
namespace UI__Editor.Models.ActionClasses
1112
{
12-
public class AppTree : PropertyChangedBase, IElement, IAction
13+
public class AppTree : PropertyChangedBase, IElement, IAction, IParentElement
1314
{
1415
public IEventAggregator EventAggregator { get; set; }
1516
public ViewModels.Actions.IAction ViewModel { get; set; }
1617
public IElement Parent { get; set; }
1718
public bool HasSubChildren { get { return true; } }
1819
public string ActionType { get; } = "App Tree";
20+
public string[] ValidChildren { get; set; } = { "Set" };
1921
public string ApplicationVariableBase { get; set; }
2022
public string PackageVariableBase { get; set; }
21-
public bool? ShowBack { get; set; } // default is false
22-
public bool? ShowCancel { get; set; } // default is false
23+
public bool ShowBack { get; set; } = false; // default is false
24+
public bool ShowCancel { get; set; } = false; // default is false
2325
public string Title { get; set; }
2426
public string Size { get; set; } // default is regular | regular, tall, and extratall
25-
public bool? Expanded { get; set; } // default is true
27+
public bool Expanded { get; set; } = true; // default is true
2628
public bool CenterTitle = false;
27-
public SoftwareSets Sets { get; set; }
29+
public ObservableCollection<IChildElement> SubChildren { get; set; }
2830
public string Condition { get; set; }
2931

3032
// Code to handle TreeView Selection
@@ -41,6 +43,7 @@ public bool TVSelected
4143
public AppTree(IEventAggregator eventAggregator)
4244
{
4345
EventAggregator = eventAggregator;
46+
SubChildren = new ObservableCollection<IChildElement>();
4447
ViewModel = new ViewModels.Actions.AppTreeViewModel(this);
4548
}
4649

@@ -108,9 +111,14 @@ public XmlNode GenerateXML()
108111
}
109112
output.Attributes.Append(centerTitle);
110113

111-
// Append Child
112-
XmlNode importNode = d.ImportNode(Sets.GenerateXML(), true);
113-
output.AppendChild(importNode);
114+
// Add all child nodes to the group
115+
XmlNode SoftwareSetsNode = d.CreateNode("element", "SoftwareSets", "");
116+
foreach (IElement sets in SubChildren)
117+
{
118+
XmlNode importNode = d.ImportNode(sets.GenerateXML(), true);
119+
SoftwareSetsNode.AppendChild(importNode);
120+
}
121+
output.AppendChild(SoftwareSetsNode);
114122

115123
return output;
116124
}

UI++Editor/Models/Set.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,20 @@
77
using System.Threading.Tasks;
88
using System.Xml;
99
using UI__Editor.Interfaces;
10+
using UI__Editor.ViewModels.Actions.Children;
1011

1112
namespace UI__Editor.Models
1213
{
13-
public class Set : PropertyChangedBase, IElement
14+
public class Set : PropertyChangedBase, IElement, IChildElement, IParentElement
1415
{
1516
public ViewModels.Actions.IAction ViewModel { get; set; }
1617
public IElement Parent { get; set; }
1718
public bool HasSubChildren { get { return false; } }
1819
public string ActionType { get { return "Set"; } }
20+
public string[] ValidChildren { get; set; } = { "SoftwareGroup", "SoftwareRef" };
21+
public string[] ValidParents { get; set; } = { "AppTree" };
1922
public string Name { get; set; } // required
20-
public ObservableCollection<ISoftwareRef> SoftwareRefs { get; set; } // SoftwareGroup, SoftwareRef
23+
public ObservableCollection<IChildElement> SubChildren { get; set; } // SoftwareGroup, SoftwareRef
2124
public string Condition { get; set; }
2225

2326
// Code to handle TreeView Selection
@@ -31,6 +34,14 @@ public bool TVSelected
3134
NotifyOfPropertyChange(() => TVSelected);
3235
}
3336
}
37+
38+
public Set(IElement parent)
39+
{
40+
Parent = parent;
41+
SubChildren = new ObservableCollection<IChildElement>();
42+
ViewModel = new SetViewModel(this);
43+
}
44+
3445
public XmlNode GenerateXML()
3546
{
3647
// Create XML Node and Attributes
@@ -44,7 +55,7 @@ public XmlNode GenerateXML()
4455
condition.Value = Condition;
4556

4657
// Append Children
47-
foreach (ISoftwareRef softwareRef in SoftwareRefs)
58+
foreach (ISoftwareRef softwareRef in SubChildren)
4859
{
4960
XmlNode importNode = d.ImportNode(softwareRef.GenerateXML(), true);
5061
output.AppendChild(importNode);

UI++Editor/Models/SoftwareGroup.cs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,29 @@
77
using System.Threading.Tasks;
88
using System.Xml;
99
using UI__Editor.Interfaces;
10+
using UI__Editor.ViewModels.Actions.Children;
1011

1112
namespace UI__Editor.Models
1213
{
13-
public class SoftwareGroup : PropertyChangedBase, IElement, ISoftwareRef
14+
public class SoftwareGroup : PropertyChangedBase, IElement, ISoftwareRef, IChildElement, IParentElement, IAppTreeSubChild
1415
{
1516
public ViewModels.Actions.IAction ViewModel { get; set; }
1617
public IElement Parent { get; set; }
1718
public bool HasSubChildren { get { return false; } }
18-
public string ActionType { get { return "Software Group"; } }
19-
public bool? Default { get; set; } // default is false
19+
public string ActionType { get { return "SoftwareGroup"; } }
20+
public string[] ValidChildren { get; set; } = { "SoftwareGroup", "SoftwareRef" };
21+
public string[] ValidParents { get; set; } = { "Set", "SoftwareGroup" };
22+
public bool Default { get; set; } = false; // default is false
2023
public string Id { get; set; } // required
2124
public string Label { get; set; } // required
22-
public bool? Required { get; set; } // default is false
23-
public ObservableCollection<ISoftwareRef> SoftwareRefs { get; set; }
25+
public bool Required { get; set; } = false; // default is false
26+
public ObservableCollection<IChildElement> SubChildren { get; set; }
2427
public string Condition { get; set; }
2528

29+
// TreeView Specifics
30+
public Enums.AppTreeEnum.CheckStyle CheckStyle { get; set; } = Enums.AppTreeEnum.CheckStyle.Unchecked;
31+
public Enums.AppTreeEnum.IconStyle IconStyle { get; set; } = Enums.AppTreeEnum.IconStyle.Folder;
32+
2633
// Code to handle TreeView Selection
2734
private bool _TVSelected = false;
2835
public bool TVSelected
@@ -34,6 +41,14 @@ public bool TVSelected
3441
NotifyOfPropertyChange(() => TVSelected);
3542
}
3643
}
44+
45+
public SoftwareGroup(IElement parent)
46+
{
47+
Parent = parent;
48+
SubChildren = new ObservableCollection<IChildElement>();
49+
ViewModel = new SoftwareGroupViewModel(this);
50+
}
51+
3752
public XmlNode GenerateXML()
3853
{
3954
// Create XML Node and Attributes
@@ -69,7 +84,7 @@ public XmlNode GenerateXML()
6984
}
7085

7186
// Append Children
72-
foreach (ISoftwareRef softwareRef in SoftwareRefs)
87+
foreach (ISoftwareRef softwareRef in SubChildren)
7388
{
7489
XmlNode importNode = d.ImportNode(softwareRef.GenerateXML(), true);
7590
output.AppendChild(importNode);

UI++Editor/Models/SoftwareRef.cs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,29 @@
66
using System.Threading.Tasks;
77
using System.Xml;
88
using UI__Editor.Interfaces;
9+
using UI__Editor.ViewModels.Actions.Children;
910

1011
namespace UI__Editor.Models
1112
{
12-
public class SoftwareRef : PropertyChangedBase, IElement, ISoftwareRef
13+
public class SoftwareRef : PropertyChangedBase, IElement, ISoftwareRef, IChildElement, IAppTreeSubChild
1314
{
1415
public ViewModels.Actions.IAction ViewModel { get; set; }
1516
public IElement Parent { get; set; }
1617
public bool HasSubChildren { get { return false; } }
17-
public string ActionType { get { return "Software Ref"; } }
18+
public string ActionType { get { return "SoftwareRef"; } }
19+
public string[] ValidChildren { get; set; }
20+
public string[] ValidParents { get; set; } = { "Set", "SoftwareGroup" };
1821
public string Id { get; set; } // required
19-
public bool? Hidden { get; set; } // default is false
20-
public bool? Default { get; set; } // default is false
21-
public bool? Required { get; set; } // default is false
22+
public bool Hidden { get; set; } = false; // default is false
23+
public bool Default { get; set; } = false; // default is false
24+
public bool Required { get; set; } = false; // default is false
2225
public string Condition { get; set; }
2326

27+
// TreeView Specifics
28+
public Enums.AppTreeEnum.CheckStyle CheckStyle { get; set; } = Enums.AppTreeEnum.CheckStyle.Unchecked;
29+
public Enums.AppTreeEnum.IconStyle IconStyle { get; set; } = Enums.AppTreeEnum.IconStyle.App;
30+
public string Label { get; set; }
31+
2432
// Code to handle TreeView Selection
2533
private bool _TVSelected = false;
2634
public bool TVSelected
@@ -32,6 +40,13 @@ public bool TVSelected
3240
NotifyOfPropertyChange(() => TVSelected);
3341
}
3442
}
43+
44+
public SoftwareRef(IElement parent)
45+
{
46+
Parent = parent;
47+
ViewModel = new SoftwareRefViewModel(this);
48+
}
49+
3550
public XmlNode GenerateXML()
3651
{
3752
// Create XML Node and Attributes

0 commit comments

Comments
 (0)