Skip to content

Commit 753fb41

Browse files
committed
XMLToClassModel complete and Preview refresh on Import complete; - NWZ
1 parent a596ae3 commit 753fb41

18 files changed

+513
-47
lines changed

UI++Editor/Controllers/XMLToClassModel.cs

Lines changed: 247 additions & 20 deletions
Large diffs are not rendered by default.

UI++Editor/Models/UIpp.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ public class UIpp : PropertyChangedBase, IElement
1616
public IElement Parent { get; set; }
1717
public bool HasSubChildren { get { return false; } }
1818
public string ActionType { get { return "UI++ Element"; } }
19-
public bool? AlwaysOnTop { get; set; }
19+
public bool? AlwaysOnTop { get; set; } = true;
2020
public string Color { get; set; }
21-
public bool? DialogSidebar { get; set; }
22-
public bool? Flat { get; set; }
21+
public bool? DialogSidebar { get; set; } = true;
22+
public bool? Flat { get; set; } = false;
2323
public string Icon { get; set; }
2424
public string Title { get; set; }
2525
public string RootXMLPath { get; set; }

UI++Editor/ViewModels/Actions/AppTreeViewModel.cs

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66
using System.Threading.Tasks;
77
using UI__Editor.ViewModels.Preview;
88
using UI__Editor.Models.ActionClasses;
9+
using UI__Editor.EventAggregators;
910

1011
namespace UI__Editor.ViewModels.Actions
1112
{
12-
public class AppTreeViewModel : PropertyChangedBase, IAction
13+
public class AppTreeViewModel : PropertyChangedBase, IAction, IHandle<EventAggregators.ChangeUI>
1314
{
1415
public IPreview PreviewViewModel { get; set; }
1516
public object ModelClass { get; set; }
1617
public string ActionTitle { get { return "AppTree"; } }
18+
public IEventAggregator EventAggregator;
1719

1820
public string HiddenAttributes
1921
{
@@ -26,7 +28,18 @@ public string HiddenAttributes
2628
public AppTreeViewModel(AppTree appTree)
2729
{
2830
ModelClass = appTree;
31+
EventAggregator = Globals.EventAggregator;
32+
EventAggregator.Subscribe(this);
2933
PreviewViewModel = new Preview.AppTreeViewModel(appTree, appTree.EventAggregator);
34+
SelectedSize = string.IsNullOrEmpty(appTree.Size) ? "Regular" : appTree.Size;
35+
(PreviewViewModel as Preview.AppTreeViewModel).PreviewBackButtonVisible = ShowBack;
36+
(PreviewViewModel as Preview.AppTreeViewModel).PreviewCancelButtonVisible = ShowCancel;
37+
(PreviewViewModel as Preview.AppTreeViewModel).Title = Title;
38+
(PreviewViewModel as Preview.AppTreeViewModel).CenterTitle = CenterTitle;
39+
if(null != SelectedSize)
40+
{
41+
(PreviewViewModel as Preview.AppTreeViewModel).WindowHeight = SelectedSize;
42+
}
3043
}
3144

3245
public string ApplicationVariableBase
@@ -68,10 +81,46 @@ public string Title
6881
(PreviewViewModel as Preview.AppTreeViewModel).Title = value;
6982
}
7083
}
71-
public string Size
84+
85+
public string WindowHeight
7286
{
7387
get { return (ModelClass as AppTree).Size; }
74-
set { (ModelClass as AppTree).Size = value; }
88+
set
89+
{
90+
(ModelClass as AppTree).Size = value;
91+
(PreviewViewModel as Preview.AppTreeViewModel).WindowHeight = value;
92+
NotifyOfPropertyChange(() => Size);
93+
}
94+
}
95+
96+
private string _SelectedSize;
97+
public string SelectedSize
98+
{
99+
get { return _SelectedSize; }
100+
set
101+
{
102+
_SelectedSize = value;
103+
PreviewViewModel.WindowHeight = value;
104+
(ModelClass as AppTree).Size = value;
105+
EventAggregator.BeginPublishOnUIThread(new EventAggregators.SendMessage("SizeChange", value));
106+
NotifyOfPropertyChange(() => SelectedSize);
107+
}
108+
}
109+
110+
private List<string> _Size = new List<string>()
111+
{
112+
"Regular",
113+
"Tall",
114+
"ExtraTall"
115+
};
116+
public List<string> Size
117+
{
118+
get { return _Size; }
119+
set
120+
{
121+
_Size = value;
122+
NotifyOfPropertyChange(() => Size);
123+
}
75124
}
76125
public bool Expanded
77126
{
@@ -94,5 +143,22 @@ public string Condition
94143
get { return (ModelClass as AppTree).Condition; }
95144
set { (ModelClass as AppTree).Condition = value; }
96145
}
146+
147+
public void Handle(ChangeUI message)
148+
{
149+
switch (message.Type)
150+
{
151+
case "ImportComplete":
152+
(PreviewViewModel as Preview.AppTreeViewModel).PreviewBackButtonVisible = ShowBack;
153+
(PreviewViewModel as Preview.AppTreeViewModel).PreviewCancelButtonVisible = ShowCancel;
154+
(PreviewViewModel as Preview.AppTreeViewModel).Title = Title;
155+
(PreviewViewModel as Preview.AppTreeViewModel).CenterTitle = CenterTitle;
156+
if (null != SelectedSize)
157+
{
158+
(PreviewViewModel as Preview.AppTreeViewModel).WindowHeight = SelectedSize;
159+
}
160+
break;
161+
}
162+
}
97163
}
98164
}

UI++Editor/ViewModels/Actions/Children/CheckViewModel.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
using System.Management.Instrumentation;
66
using System.Text;
77
using System.Threading.Tasks;
8+
using UI__Editor.EventAggregators;
89
using UI__Editor.Models;
910
using UI__Editor.ViewModels.Elements;
1011
using UI__Editor.ViewModels.Preview;
1112
using UI__Editor.ViewModels.Preview.Children;
1213

1314
namespace UI__Editor.ViewModels.Actions.Children
1415
{
15-
public class CheckViewModel : PropertyChangedBase, IAction
16+
public class CheckViewModel : PropertyChangedBase, IAction, IHandle<ChangeUI>
1617
{
1718
public IEventAggregator EventAggregator { get; set; }
1819
public IPreview PreviewViewModel { get; set; }
@@ -27,6 +28,8 @@ public CheckViewModel(Check c)
2728
{
2829
ModelClass = c;
2930
PreviewViewModel = new Preview.Children.CheckViewModel();
31+
EventAggregator = Globals.EventAggregator;
32+
EventAggregator.Subscribe(this);
3033
}
3134

3235
private List<string> _PreviewAs = new List<string>()
@@ -122,5 +125,18 @@ public string Text
122125
(PreviewViewModel as Preview.Children.CheckViewModel).Text = value;
123126
}
124127
}
128+
129+
public void Handle(ChangeUI message)
130+
{
131+
switch (message.Type)
132+
{
133+
case "ImportComplete":
134+
(PreviewViewModel as Preview.Children.CheckViewModel).Description = Description;
135+
(PreviewViewModel as Preview.Children.CheckViewModel).ErrorDescription = ErrorDescription;
136+
(PreviewViewModel as Preview.Children.CheckViewModel).Text = Text;
137+
(PreviewViewModel as Preview.Children.CheckViewModel).WarnDescription = WarnDescription;
138+
break;
139+
}
140+
}
125141
}
126142
}

UI++Editor/ViewModels/Actions/Children/InputCheckboxViewModel.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
using System.Linq;
55
using System.Text;
66
using System.Threading.Tasks;
7+
using UI__Editor.EventAggregators;
78
using UI__Editor.Models;
89
using UI__Editor.ViewModels.Elements;
910
using UI__Editor.ViewModels.Preview;
1011

1112
namespace UI__Editor.ViewModels.Actions.Children
1213
{
13-
public class InputCheckboxViewModel : IAction
14+
public class InputCheckboxViewModel : IAction, IHandle<ChangeUI>
1415
{
1516
public IPreview PreviewViewModel { get; set; }
1617
public object ModelClass { get; set; }
@@ -24,6 +25,7 @@ public InputCheckboxViewModel(InputCheckbox i)
2425
{
2526
ModelClass = i;
2627
PreviewViewModel = new ViewModels.Preview.Children.InputCheckboxViewModel();
28+
Globals.EventAggregator.Subscribe(this);
2729
}
2830

2931
public string CheckedValue
@@ -80,5 +82,15 @@ public string Condition
8082
(ModelClass as InputCheckbox).Condition = value;
8183
}
8284
}
85+
86+
public void Handle(ChangeUI message)
87+
{
88+
switch (message.Type)
89+
{
90+
case "ImportComplete":
91+
(PreviewViewModel as Preview.Children.InputCheckboxViewModel).Question = Question;
92+
break;
93+
}
94+
}
8395
}
8496
}

UI++Editor/ViewModels/Actions/Children/InputChoiceViewModel.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Linq;
55
using System.Text;
66
using System.Threading.Tasks;
7+
using UI__Editor.EventAggregators;
78
using UI__Editor.Models;
89
using UI__Editor.ViewModels.Elements;
910
using UI__Editor.ViewModels.Preview;
@@ -12,7 +13,7 @@
1213

1314
namespace UI__Editor.ViewModels.Actions.Children
1415
{
15-
public class InputChoiceViewModel : IAction
16+
public class InputChoiceViewModel : IAction, IHandle<ChangeUI>
1617
{
1718
public IPreview PreviewViewModel { get; set; }
1819
public object ModelClass { get; set; }
@@ -27,6 +28,7 @@ public InputChoiceViewModel(InputChoice i)
2728
ModelClass = i;
2829
PreviewViewModel = new Preview.Children.InputChoiceViewModel();
2930
(PreviewViewModel as Preview.Children.InputChoiceViewModel).SubChildren = i.SubChildren;
31+
Globals.EventAggregator.Subscribe(this);
3032
}
3133

3234
public string AlternateVariable
@@ -112,5 +114,17 @@ public string Condition
112114
(ModelClass as InputChoice).Condition = value;
113115
}
114116
}
117+
118+
public void Handle(ChangeUI message)
119+
{
120+
switch (message.Type)
121+
{
122+
case "ImportComplete":
123+
(PreviewViewModel as Preview.Children.InputChoiceViewModel).DropDownSize = DropDownSize;
124+
(PreviewViewModel as Preview.Children.InputChoiceViewModel).Question = Question;
125+
(PreviewViewModel as Preview.Children.InputChoiceViewModel).Sort = Sort;
126+
break;
127+
}
128+
}
115129
}
116130
}

UI++Editor/ViewModels/Actions/Children/InputInfoViewModel.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
using System.Linq;
55
using System.Text;
66
using System.Threading.Tasks;
7+
using UI__Editor.EventAggregators;
78
using UI__Editor.Models;
89
using UI__Editor.ViewModels.Elements;
910
using UI__Editor.ViewModels.Preview;
1011

1112
namespace UI__Editor.ViewModels.Actions.Children
1213
{
13-
public class InputInfoViewModel : IAction
14+
public class InputInfoViewModel : IAction, IHandle<ChangeUI>
1415
{
1516
public IPreview PreviewViewModel { get; set; }
1617
public object ModelClass { get; set; }
@@ -24,6 +25,7 @@ public InputInfoViewModel(InputInfo i)
2425
{
2526
ModelClass = i;
2627
PreviewViewModel = new Preview.Children.InputInfoViewModel();
28+
Globals.EventAggregator.Subscribe(this);
2729
}
2830

2931
public string Color
@@ -64,5 +66,17 @@ public string Condition
6466
(ModelClass as InputInfo).Condition = value;
6567
}
6668
}
69+
70+
public void Handle(ChangeUI message)
71+
{
72+
switch (message.Type)
73+
{
74+
case "ImportComplete":
75+
(PreviewViewModel as Preview.Children.InputInfoViewModel).NumberOfLines = NumberOfLines;
76+
(PreviewViewModel as Preview.Children.InputInfoViewModel).Color = Color;
77+
(PreviewViewModel as Preview.Children.InputInfoViewModel).Content = Content;
78+
break;
79+
}
80+
}
6781
}
6882
}

UI++Editor/ViewModels/Actions/Children/InputTextViewModel.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
using System.Linq;
55
using System.Text;
66
using System.Threading.Tasks;
7+
using UI__Editor.EventAggregators;
78
using UI__Editor.Models;
89
using UI__Editor.ViewModels.Elements;
910
using UI__Editor.ViewModels.Preview;
1011

1112
namespace UI__Editor.ViewModels.Actions.Children
1213
{
13-
public class InputTextViewModel : PropertyChangedBase, IAction
14+
public class InputTextViewModel : PropertyChangedBase, IAction, IHandle<ChangeUI>
1415
{
1516
public IPreview PreviewViewModel { get; set; }
1617
public object ModelClass { get; set; }
@@ -24,6 +25,7 @@ public InputTextViewModel(InputText i)
2425
{
2526
ModelClass = i;
2627
PreviewViewModel = new Preview.Children.InputTextViewModel();
28+
Globals.EventAggregator.Subscribe(this);
2729
}
2830

2931
private List<string> _ADValidations = new List<string>()
@@ -208,5 +210,19 @@ public string Condition
208210
(ModelClass as InputText).Condition = value;
209211
}
210212
}
213+
214+
public void Handle(ChangeUI message)
215+
{
216+
switch (message.Type)
217+
{
218+
case "ImportComplete":
219+
(PreviewViewModel as Preview.Children.InputTextViewModel).Default = Default;
220+
(PreviewViewModel as Preview.Children.InputTextViewModel).Hint = Hint;
221+
(PreviewViewModel as Preview.Children.InputTextViewModel).Password = Password;
222+
(PreviewViewModel as Preview.Children.InputTextViewModel).Prompt = Prompt;
223+
(PreviewViewModel as Preview.Children.InputTextViewModel).Question = Question;
224+
break;
225+
}
226+
}
211227
}
212228
}

UI++Editor/ViewModels/Actions/Children/SoftwareRefViewModel.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ namespace UI__Editor.ViewModels.Actions.Children
2222
public class SoftwareRefViewModel : PropertyChangedBase, IAction, IHandle<EventAggregators.ChangeUI>
2323
{
2424
public IPreview PreviewViewModel { get; set; }
25-
private SoftwareViewModel svm;
2625

2726
public object ModelClass { get; set; }
2827
public string ActionTitle { get { return "Software Ref"; } }
@@ -37,7 +36,6 @@ public SoftwareRefViewModel(SoftwareRef r)
3736
ModelClass = r;
3837
eventAggregator = Globals.EventAggregator;
3938
eventAggregator.Subscribe(this);
40-
svm = Globals.SoftwareViewModel;
4139
}
4240

4341
public bool Hidden
@@ -209,7 +207,7 @@ public List<ISoftware> XMLSoftware
209207
{
210208
get
211209
{
212-
return svm.XMLSoftware.ToList();
210+
return Globals.SoftwareViewModel.XMLSoftware.ToList();
213211
}
214212
}
215213

0 commit comments

Comments
 (0)