Wire up the views.
This commit is contained in:
parent
257e3e8568
commit
b59c9f2898
@ -69,7 +69,7 @@ namespace Tests.ViewModels
|
|||||||
_settingsVM.AddElementViewModel(viewModel);
|
_settingsVM.AddElementViewModel(viewModel);
|
||||||
viewModel.IsSelected = true;
|
viewModel.IsSelected = true;
|
||||||
int oldViewModelChildrenCount = viewModel.Elements.Count;
|
int oldViewModelChildrenCount = viewModel.Elements.Count;
|
||||||
int oldModelChildrenCount = model.FormatElements.Count;
|
int oldModelChildrenCount = model.Children.Count;
|
||||||
_settingsVM.AddChildElementMessage.Sent += (sender, args) =>
|
_settingsVM.AddChildElementMessage.Sent += (sender, args) =>
|
||||||
{
|
{
|
||||||
messageSent = true;
|
messageSent = true;
|
||||||
@ -84,7 +84,7 @@ namespace Tests.ViewModels
|
|||||||
Assert.IsTrue(messageSent, "Message was not sent");
|
Assert.IsTrue(messageSent, "Message was not sent");
|
||||||
Assert.AreEqual(oldViewModelChildrenCount + 1, viewModel.Elements.Count,
|
Assert.AreEqual(oldViewModelChildrenCount + 1, viewModel.Elements.Count,
|
||||||
"Count of children in ViewModel was not increased by 1");
|
"Count of children in ViewModel was not increased by 1");
|
||||||
Assert.AreEqual(oldModelChildrenCount + 1, model.FormatElements.Count,
|
Assert.AreEqual(oldModelChildrenCount + 1, model.Children.Count,
|
||||||
"Count of children in Model was not increased by 1");
|
"Count of children in Model was not increased by 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ namespace Tests.ViewModels
|
|||||||
ElementViewModel elementVM = ((ControlElementViewModel)settingsVM.Elements.First())
|
ElementViewModel elementVM = ((ControlElementViewModel)settingsVM.Elements.First())
|
||||||
.Elements.First();
|
.Elements.First();
|
||||||
ElementBase element = elementVM.RevealModelObject() as ElementBase;
|
ElementBase element = elementVM.RevealModelObject() as ElementBase;
|
||||||
Assert.IsTrue(((ControlElementBase)settings.Elements[0]).FormatElements.Contains(element),
|
Assert.IsTrue(((ControlElementBase)settings.Elements[0]).Children.Contains(element),
|
||||||
"Settings object does not contain the model that the VM revealed?!");
|
"Settings object does not contain the model that the VM revealed?!");
|
||||||
elementVM.IsSelected = true;
|
elementVM.IsSelected = true;
|
||||||
Assert.IsTrue(settingsVM.DeleteElementCommand.CanExecute(null),
|
Assert.IsTrue(settingsVM.DeleteElementCommand.CanExecute(null),
|
||||||
@ -149,7 +149,7 @@ namespace Tests.ViewModels
|
|||||||
Assert.AreEqual(oldCount - 1, parent.Elements.Count);
|
Assert.AreEqual(oldCount - 1, parent.Elements.Count);
|
||||||
Assert.IsFalse(parent.Elements.Contains(elementVM),
|
Assert.IsFalse(parent.Elements.Contains(elementVM),
|
||||||
"Elements collection still contains the deleted element view model.");
|
"Elements collection still contains the deleted element view model.");
|
||||||
Assert.IsFalse(((ControlElementBase)settings.Elements[0]).FormatElements.Contains(element),
|
Assert.IsFalse(((ControlElementBase)settings.Elements[0]).Children.Contains(element),
|
||||||
"Settings' collection of FormatElement children still contains the element model.");
|
"Settings' collection of FormatElement children still contains the element model.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace zaaReloaded2.Controller.Elements
|
namespace zaaReloaded2.Controller.Elements
|
||||||
{
|
{
|
||||||
@ -29,19 +30,29 @@ namespace zaaReloaded2.Controller.Elements
|
|||||||
/// Gets a list of child elements, all of which must be derived
|
/// Gets a list of child elements, all of which must be derived
|
||||||
/// from FormatElementBase.
|
/// from FormatElementBase.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IList<FormatElementBase> FormatElements { get; private set; }
|
public IList<FormatElementBase> Children { get; internal set; }
|
||||||
|
|
||||||
public ControlElementBase()
|
public ControlElementBase()
|
||||||
: this(new List<FormatElementBase>())
|
: this(new List<FormatElementBase>())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
public ControlElementBase(IList<FormatElementBase> formatElements)
|
public ControlElementBase(IList<FormatElementBase> children)
|
||||||
{
|
{
|
||||||
FormatElements = formatElements;
|
Children = children;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ControlElementBase(FormatElementBase formatElement)
|
public ControlElementBase(FormatElementBase children)
|
||||||
: this(new List<FormatElementBase>() { formatElement })
|
: this(new List<FormatElementBase>() { children })
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a clone of the Children list (for use in cloning
|
||||||
|
/// derived classes).
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Clone of the Children list.</returns>
|
||||||
|
protected IList<FormatElementBase> CloneChildren()
|
||||||
|
{
|
||||||
|
return Children.Select(child => child.Clone() as FormatElementBase).ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ namespace zaaReloaded2.Controller.Elements
|
|||||||
{
|
{
|
||||||
public override string Label
|
public override string Label
|
||||||
{
|
{
|
||||||
get { return "Jeden Tag auswählen"; }
|
get { return "Jeder Tag"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Run(Formatter.Formatter formatter)
|
public override void Run(Formatter.Formatter formatter)
|
||||||
@ -46,7 +46,7 @@ namespace zaaReloaded2.Controller.Elements
|
|||||||
|
|
||||||
protected override ElementBase CreateInstance()
|
protected override ElementBase CreateInstance()
|
||||||
{
|
{
|
||||||
return new SelectEachDay();
|
return new SelectEachDay(CloneChildren());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ namespace zaaReloaded2.Controller.Elements
|
|||||||
{
|
{
|
||||||
public override string Label
|
public override string Label
|
||||||
{
|
{
|
||||||
get { return "Ersten Tag auswählen"; }
|
get { return "Erster Tag"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Run(Formatter.Formatter formatter)
|
public override void Run(Formatter.Formatter formatter)
|
||||||
@ -50,7 +50,7 @@ namespace zaaReloaded2.Controller.Elements
|
|||||||
|
|
||||||
protected override ElementBase CreateInstance()
|
protected override ElementBase CreateInstance()
|
||||||
{
|
{
|
||||||
return new SelectFirstDay();
|
return new SelectFirstDay(CloneChildren());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ namespace zaaReloaded2.Controller.Elements
|
|||||||
{
|
{
|
||||||
public override string Label
|
public override string Label
|
||||||
{
|
{
|
||||||
get { return "Letzten Tag auswählen"; }
|
get { return "Letzter Tag"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Run(Formatter.Formatter formatter)
|
public override void Run(Formatter.Formatter formatter)
|
||||||
@ -51,7 +51,7 @@ namespace zaaReloaded2.Controller.Elements
|
|||||||
|
|
||||||
protected override ElementBase CreateInstance()
|
protected override ElementBase CreateInstance()
|
||||||
{
|
{
|
||||||
return new SelectLastDay();
|
return new SelectLastDay(CloneChildren());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,6 +87,7 @@ namespace zaaReloaded2.Controller
|
|||||||
Uid = Guid.NewGuid();
|
Uid = Guid.NewGuid();
|
||||||
Name = name;
|
Name = name;
|
||||||
Elements = initialElements;
|
Elements = initialElements;
|
||||||
|
ReferenceStyle = Properties.Settings.Default.ReferenceStyle;
|
||||||
if (Elements == null)
|
if (Elements == null)
|
||||||
{
|
{
|
||||||
Elements = new List<ElementBase>();
|
Elements = new List<ElementBase>();
|
||||||
|
@ -205,7 +205,7 @@ namespace zaaReloaded2.Formatter
|
|||||||
/// FormatElementBase children to process.</param>
|
/// FormatElementBase children to process.</param>
|
||||||
public void ProcessAllTimePoints(ControlElementBase controlElement)
|
public void ProcessAllTimePoints(ControlElementBase controlElement)
|
||||||
{
|
{
|
||||||
ProcessAllTimePoints(controlElement.FormatElements);
|
ProcessAllTimePoints(controlElement.Children);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -297,7 +297,7 @@ namespace zaaReloaded2.Formatter
|
|||||||
throw new ArgumentNullException("workingTimePoints");
|
throw new ArgumentNullException("workingTimePoints");
|
||||||
|
|
||||||
WorkingTimePoints = workingTimePoints;
|
WorkingTimePoints = workingTimePoints;
|
||||||
ProcessElements(controlElement.FormatElements);
|
ProcessElements(controlElement.Children);
|
||||||
if (_primaryBuffer.HasBufferedText)
|
if (_primaryBuffer.HasBufferedText)
|
||||||
{
|
{
|
||||||
_primaryBuffer.Prepend(
|
_primaryBuffer.Prepend(
|
||||||
|
@ -32,31 +32,31 @@ namespace zaaReloaded2.Formatter
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Never write normal ranges
|
/// Never write normal ranges
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Description("Referenzbereich nie ausgeben")]
|
[Description("Niemals")]
|
||||||
Never,
|
Never,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Write normal range if item is marked in dictionary
|
/// Write normal range if item is marked in dictionary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Description("Referenzbereich ausgeben, falls Parameter so markiert ist")]
|
[Description("Bei speziellen Parametern immer")]
|
||||||
IfSpecialItem,
|
IfSpecialItem,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Write normal range if value is abnormal
|
/// Write normal range if value is abnormal
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Description("Referenzbereich ausgeben, falls Wert nicht normal ist")]
|
[Description("Bei pathologischem Wert")]
|
||||||
IfAbnormal,
|
IfAbnormal,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Write normal range if item is marked in dictionary, or if value is abnormal
|
/// Write normal range if item is marked in dictionary, or if value is abnormal
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Description("Referenzbereich ausgeben, falls Parameter so markiert ist oder falls Wert nicht normal ist")]
|
[Description("Bei pathologischem Wert oder speziellem Parameter")]
|
||||||
IfSpecialOrAbnormal,
|
IfSpecialOrAbnormal,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Always write normal range reference
|
/// Always write normal range reference
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Description("Referenzbereich immer ausgeben")]
|
[Description("Immer")]
|
||||||
Always
|
Always
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
27
zaaReloaded2/Properties/Settings.Designer.cs
generated
27
zaaReloaded2/Properties/Settings.Designer.cs
generated
@ -254,5 +254,32 @@ namespace zaaReloaded2.Properties {
|
|||||||
return ((string)(this["ParagraphStyleName"]));
|
return ((string)(this["ParagraphStyleName"]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("IfSpecialOrAbnormal")]
|
||||||
|
public global::zaaReloaded2.Formatter.ReferenceStyle ReferenceStyle {
|
||||||
|
get {
|
||||||
|
return ((global::zaaReloaded2.Formatter.ReferenceStyle)(this["ReferenceStyle"]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("Ausgabe-Elemente")]
|
||||||
|
public string FormatElementLabel {
|
||||||
|
get {
|
||||||
|
return ((string)(this["FormatElementLabel"]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[global::System.Configuration.ApplicationScopedSettingAttribute()]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Configuration.DefaultSettingValueAttribute("Steuerungs-Elemente")]
|
||||||
|
public string ControlElementLabel {
|
||||||
|
get {
|
||||||
|
return ((string)(this["ControlElementLabel"]));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,5 +77,14 @@
|
|||||||
<Setting Name="ParagraphStyleName" Type="System.String" Scope="Application">
|
<Setting Name="ParagraphStyleName" Type="System.String" Scope="Application">
|
||||||
<Value Profile="(Default)">zaaReloaded2-Laborwerte</Value>
|
<Value Profile="(Default)">zaaReloaded2-Laborwerte</Value>
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="ReferenceStyle" Type="zaaReloaded2.Formatter.ReferenceStyle" Scope="Application">
|
||||||
|
<Value Profile="(Default)">IfSpecialOrAbnormal</Value>
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="FormatElementLabel" Type="System.String" Scope="Application">
|
||||||
|
<Value Profile="(Default)">Ausgabe-Elemente</Value>
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="ControlElementLabel" Type="System.String" Scope="Application">
|
||||||
|
<Value Profile="(Default)">Steuerungs-Elemente</Value>
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
@ -47,7 +47,7 @@ namespace zaaReloaded2.ViewModels
|
|||||||
Elements = new ObservableCollection<ElementViewModel>();
|
Elements = new ObservableCollection<ElementViewModel>();
|
||||||
if (controlElement != null)
|
if (controlElement != null)
|
||||||
{
|
{
|
||||||
foreach (FormatElementBase childElement in controlElement.FormatElements)
|
foreach (FormatElementBase childElement in controlElement.Children)
|
||||||
{
|
{
|
||||||
FormatElementViewModel childVM = new FormatElementViewModel(childElement);
|
FormatElementViewModel childVM = new FormatElementViewModel(childElement);
|
||||||
Elements.Add(childVM);
|
Elements.Add(childVM);
|
||||||
@ -55,6 +55,22 @@ namespace zaaReloaded2.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new instance by copying the Elements property from another
|
||||||
|
/// ControlElementViewModel and the Children property from the other
|
||||||
|
/// view model's model.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copyFrom">Other ControlElementViewModel to copy
|
||||||
|
/// from.</param>
|
||||||
|
public ControlElementViewModel(
|
||||||
|
ControlElementBase controlElement,
|
||||||
|
ControlElementViewModel copyFrom)
|
||||||
|
: this(controlElement)
|
||||||
|
{
|
||||||
|
Elements = copyFrom.Elements;
|
||||||
|
((ControlElementBase)Element).Children = controlElement.Children;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public methods
|
#region Public methods
|
||||||
@ -64,7 +80,7 @@ namespace zaaReloaded2.ViewModels
|
|||||||
Elements.Add(viewModel);
|
Elements.Add(viewModel);
|
||||||
viewModel.Parent = this;
|
viewModel.Parent = this;
|
||||||
ControlElementBase e = Element as ControlElementBase;
|
ControlElementBase e = Element as ControlElementBase;
|
||||||
e.FormatElements.Add(viewModel.RevealModelObject() as FormatElementBase);
|
e.Children.Add(viewModel.RevealModelObject() as FormatElementBase);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveChildElement(FormatElementViewModel viewModel)
|
public void RemoveChildElement(FormatElementViewModel viewModel)
|
||||||
@ -75,13 +91,15 @@ namespace zaaReloaded2.ViewModels
|
|||||||
"Cannot remove child view model that is not in the collection.");
|
"Cannot remove child view model that is not in the collection.");
|
||||||
}
|
}
|
||||||
Elements.Remove(viewModel);
|
Elements.Remove(viewModel);
|
||||||
((ControlElementBase)Element).FormatElements
|
((ControlElementBase)Element).Children
|
||||||
.Remove(viewModel.RevealModelObject() as FormatElementBase);
|
.Remove(viewModel.RevealModelObject() as FormatElementBase);
|
||||||
viewModel.Parent = null;
|
viewModel.Parent = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Overrides
|
||||||
|
|
||||||
public override object Clone()
|
public override object Clone()
|
||||||
{
|
{
|
||||||
ControlElementViewModel clone = new ControlElementViewModel();
|
ControlElementViewModel clone = new ControlElementViewModel();
|
||||||
@ -94,5 +112,7 @@ namespace zaaReloaded2.ViewModels
|
|||||||
}
|
}
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,9 @@ namespace zaaReloaded2.ViewModels
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// View model that presents a list of zaaReloaded2.Contorller.Elements.ElementBase
|
/// View model that presents a list of zaaReloaded2.Contorller.Elements.ElementBase
|
||||||
/// classes to choose from.
|
/// classes to choose from. Depending on which constructor is used, this view model
|
||||||
|
/// presents either a list of ControlElementBase-derived classes, a list of
|
||||||
|
/// FormatElementBase-derived classes, or both.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class ElementPickerViewModel : ViewModelBase
|
class ElementPickerViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
@ -98,7 +100,7 @@ namespace zaaReloaded2.ViewModels
|
|||||||
{
|
{
|
||||||
AddCategory(
|
AddCategory(
|
||||||
new CategoryViewModel(
|
new CategoryViewModel(
|
||||||
"Kontroll-Elemente",
|
Properties.Settings.Default.ControlElementLabel,
|
||||||
new Collection<ViewModelBase>()
|
new Collection<ViewModelBase>()
|
||||||
{
|
{
|
||||||
CreateControlElementViewModel(new SelectFirstDay()),
|
CreateControlElementViewModel(new SelectFirstDay()),
|
||||||
@ -108,13 +110,27 @@ namespace zaaReloaded2.ViewModels
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
CreateFormatElementViewModels();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new element picker for control elements only;
|
||||||
|
/// the selected ControlElementVieModel will copy the Elements
|
||||||
|
/// property from a source view model.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="copyFromViewModel">ControlElementViewModel
|
||||||
|
/// whose Elements property to copy.</param>
|
||||||
|
public ElementPickerViewModel(ControlElementViewModel copyFromViewModel)
|
||||||
|
{
|
||||||
|
Categories = new List<CategoryViewModel>();
|
||||||
AddCategory(
|
AddCategory(
|
||||||
new CategoryViewModel(
|
new CategoryViewModel(
|
||||||
"Ausgabe-Elemente",
|
Properties.Settings.Default.ControlElementLabel,
|
||||||
new Collection<ViewModelBase>()
|
new Collection<ViewModelBase>()
|
||||||
{
|
{
|
||||||
CreateFormatElementViewModel("Laborparameter", new Items()),
|
CreateControlElementViewModel(new SelectFirstDay(), copyFromViewModel),
|
||||||
CreateFormatElementViewModel("Beliebiger Text", new CustomText()),
|
CreateControlElementViewModel(new SelectLastDay(), copyFromViewModel),
|
||||||
|
CreateControlElementViewModel(new SelectEachDay(), copyFromViewModel)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@ -124,6 +140,20 @@ namespace zaaReloaded2.ViewModels
|
|||||||
|
|
||||||
#region Private methods
|
#region Private methods
|
||||||
|
|
||||||
|
void CreateFormatElementViewModels()
|
||||||
|
{
|
||||||
|
AddCategory(
|
||||||
|
new CategoryViewModel(
|
||||||
|
Properties.Settings.Default.FormatElementLabel,
|
||||||
|
new Collection<ViewModelBase>()
|
||||||
|
{
|
||||||
|
CreateFormatElementViewModel("Laborparameter", new Items()),
|
||||||
|
CreateFormatElementViewModel("Beliebiger Text", new CustomText()),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
void AddCategory(CategoryViewModel category)
|
void AddCategory(CategoryViewModel category)
|
||||||
{
|
{
|
||||||
category.PropertyChanged += ElementViewModel_PropertyChanged;
|
category.PropertyChanged += ElementViewModel_PropertyChanged;
|
||||||
@ -143,6 +173,15 @@ namespace zaaReloaded2.ViewModels
|
|||||||
return vm;
|
return vm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ViewModelBase CreateControlElementViewModel(
|
||||||
|
ControlElementBase element, ControlElementViewModel copyFromViewModel)
|
||||||
|
{
|
||||||
|
ControlElementViewModel vm = new ControlElementViewModel(element, copyFromViewModel);
|
||||||
|
vm.DisplayString = element.Label;
|
||||||
|
vm.PropertyChanged += ElementViewModel_PropertyChanged;
|
||||||
|
return vm;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new FormatElementViewModel that wraps a FormatElementBase
|
/// Creates a new FormatElementViewModel that wraps a FormatElementBase
|
||||||
/// object and has a custom display string. The custom display string
|
/// object and has a custom display string. The custom display string
|
||||||
@ -176,6 +215,7 @@ namespace zaaReloaded2.ViewModels
|
|||||||
if (CanChooseElement())
|
if (CanChooseElement())
|
||||||
{
|
{
|
||||||
ElementChosenMessage.Send(new ViewModelMessageContent(Selected));
|
ElementChosenMessage.Send(new ViewModelMessageContent(Selected));
|
||||||
|
DoCloseView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +42,14 @@ namespace zaaReloaded2.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string DisplayString
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Label;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
@ -20,6 +20,7 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using Bovender.Mvvm;
|
||||||
using zaaReloaded2.Controller.Elements;
|
using zaaReloaded2.Controller.Elements;
|
||||||
|
|
||||||
namespace zaaReloaded2.ViewModels
|
namespace zaaReloaded2.ViewModels
|
||||||
@ -31,10 +32,10 @@ namespace zaaReloaded2.ViewModels
|
|||||||
public string Content
|
public string Content
|
||||||
{
|
{
|
||||||
[DebuggerStepThrough]
|
[DebuggerStepThrough]
|
||||||
get { return ((FormatElementBase)Element).Content; }
|
get { return _content; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
((FormatElementBase)Element).Content = value;
|
_content = value;
|
||||||
OnPropertyChanged("Content");
|
OnPropertyChanged("Content");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -47,6 +48,24 @@ namespace zaaReloaded2.ViewModels
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Commands
|
||||||
|
|
||||||
|
public DelegatingCommand SaveCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_saveCommand == null)
|
||||||
|
{
|
||||||
|
_saveCommand = new DelegatingCommand(
|
||||||
|
param => DoSave(),
|
||||||
|
param => CanSave());
|
||||||
|
}
|
||||||
|
return _saveCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
|
|
||||||
public FormatElementViewModel() : base() { }
|
public FormatElementViewModel() : base() { }
|
||||||
@ -55,10 +74,13 @@ namespace zaaReloaded2.ViewModels
|
|||||||
: this()
|
: this()
|
||||||
{
|
{
|
||||||
Element = formatElement;
|
Element = formatElement;
|
||||||
|
Content = ((FormatElementBase)Element).Content;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Overrides
|
||||||
|
|
||||||
public override object Clone()
|
public override object Clone()
|
||||||
{
|
{
|
||||||
FormatElementViewModel clone = new FormatElementViewModel();
|
FormatElementViewModel clone = new FormatElementViewModel();
|
||||||
@ -66,5 +88,52 @@ namespace zaaReloaded2.ViewModels
|
|||||||
clone.Element = Element;
|
clone.Element = Element;
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string DisplayString
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (String.IsNullOrEmpty(Content))
|
||||||
|
{
|
||||||
|
return _displayString;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return base.DisplayString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_displayString = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Private methods
|
||||||
|
|
||||||
|
void DoSave()
|
||||||
|
{
|
||||||
|
((FormatElementBase)Element).Content = _content;
|
||||||
|
// Writing the _content field to the model affects our
|
||||||
|
// DisplayString property; this is a hack to make it known.
|
||||||
|
OnPropertyChanged("DisplayString");
|
||||||
|
CloseViewCommand.Execute(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CanSave()
|
||||||
|
{
|
||||||
|
return !String.IsNullOrEmpty(Content);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
DelegatingCommand _saveCommand;
|
||||||
|
string _displayString;
|
||||||
|
string _content;
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -238,8 +238,9 @@ namespace zaaReloaded2.ViewModels
|
|||||||
Settings s = new Settings("Neu");
|
Settings s = new Settings("Neu");
|
||||||
SettingsViewModel vm = new SettingsViewModel(s);
|
SettingsViewModel vm = new SettingsViewModel(s);
|
||||||
_repository.SettingsList.Add(s);
|
_repository.SettingsList.Add(s);
|
||||||
SettingsList.Add(vm);
|
AddSettingsViewModel(vm);
|
||||||
vm.IsSelected = true;
|
vm.IsSelected = true;
|
||||||
|
EditSettingsMessage.Send(new ViewModelMessageContent(vm));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CanDeleteSettings()
|
bool CanDeleteSettings()
|
||||||
@ -291,6 +292,7 @@ namespace zaaReloaded2.ViewModels
|
|||||||
AddSettingsViewModel(copy);
|
AddSettingsViewModel(copy);
|
||||||
LastSelected.IsSelected = false;
|
LastSelected.IsSelected = false;
|
||||||
copy.IsSelected = true;
|
copy.IsSelected = true;
|
||||||
|
EditSettingsMessage.Send(new ViewModelMessageContent(copy));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@ using Bovender.Mvvm.Messaging;
|
|||||||
using zaaReloaded2.Controller;
|
using zaaReloaded2.Controller;
|
||||||
using zaaReloaded2.Controller.Elements;
|
using zaaReloaded2.Controller.Elements;
|
||||||
using zaaReloaded2.Formatter;
|
using zaaReloaded2.Formatter;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
|
||||||
namespace zaaReloaded2.ViewModels
|
namespace zaaReloaded2.ViewModels
|
||||||
{
|
{
|
||||||
@ -104,7 +105,12 @@ namespace zaaReloaded2.ViewModels
|
|||||||
{
|
{
|
||||||
if (_referenceStyle == null)
|
if (_referenceStyle == null)
|
||||||
{
|
{
|
||||||
_referenceStyle = new EnumProvider<ReferenceStyle>(_settings.ReferenceStyle);
|
_referenceStyle = new EnumProvider<ReferenceStyle>();
|
||||||
|
_referenceStyle.AsEnum = _settings.ReferenceStyle;
|
||||||
|
_referenceStyle.PropertyChanged += (sender, args) =>
|
||||||
|
{
|
||||||
|
_settings.ReferenceStyle = _referenceStyle.AsEnum;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
return _referenceStyle;
|
return _referenceStyle;
|
||||||
}
|
}
|
||||||
@ -122,7 +128,7 @@ namespace zaaReloaded2.ViewModels
|
|||||||
: base()
|
: base()
|
||||||
{
|
{
|
||||||
_settings = settings;
|
_settings = settings;
|
||||||
Elements = new List<ElementViewModel>();
|
Elements = new ObservableCollection<ElementViewModel>();
|
||||||
foreach (ElementBase element in settings.Elements)
|
foreach (ElementBase element in settings.Elements)
|
||||||
{
|
{
|
||||||
ElementViewModel vm;
|
ElementViewModel vm;
|
||||||
@ -177,6 +183,30 @@ namespace zaaReloaded2.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Message<ViewModelMessageContent> EditElementMessage
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_editElementMessage == null)
|
||||||
|
{
|
||||||
|
_editElementMessage = new Message<ViewModelMessageContent>();
|
||||||
|
}
|
||||||
|
return _editElementMessage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Message<ViewModelMessageContent> ChangeControlElementMessage
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_changeControlElementMessage == null)
|
||||||
|
{
|
||||||
|
_changeControlElementMessage = new Message<ViewModelMessageContent>();
|
||||||
|
}
|
||||||
|
return _changeControlElementMessage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Commands
|
#region Commands
|
||||||
@ -208,6 +238,20 @@ namespace zaaReloaded2.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DelegatingCommand EditElementCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_editElementCommand == null)
|
||||||
|
{
|
||||||
|
_editElementCommand = new DelegatingCommand(
|
||||||
|
param => DoEditElement(),
|
||||||
|
param => CanEditElement());
|
||||||
|
}
|
||||||
|
return _editElementCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public DelegatingCommand DeleteElementCommand
|
public DelegatingCommand DeleteElementCommand
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -275,6 +319,8 @@ namespace zaaReloaded2.ViewModels
|
|||||||
{
|
{
|
||||||
ElementViewModel newVM = args.Content.ViewModel as ElementViewModel;
|
ElementViewModel newVM = args.Content.ViewModel as ElementViewModel;
|
||||||
AddElementViewModel(newVM);
|
AddElementViewModel(newVM);
|
||||||
|
newVM.IsSelected = true;
|
||||||
|
DoEditElement();
|
||||||
};
|
};
|
||||||
AddElementMessage.Send(new ViewModelMessageContent(picker));
|
AddElementMessage.Send(new ViewModelMessageContent(picker));
|
||||||
}
|
}
|
||||||
@ -290,6 +336,8 @@ namespace zaaReloaded2.ViewModels
|
|||||||
{
|
{
|
||||||
FormatElementViewModel newVM = args.Content.ViewModel as FormatElementViewModel;
|
FormatElementViewModel newVM = args.Content.ViewModel as FormatElementViewModel;
|
||||||
AddChildElementViewModel(LastSelectedElement as ControlElementViewModel, newVM);
|
AddChildElementViewModel(LastSelectedElement as ControlElementViewModel, newVM);
|
||||||
|
newVM.IsSelected = true;
|
||||||
|
DoEditElement();
|
||||||
};
|
};
|
||||||
AddChildElementMessage.Send(new ViewModelMessageContent(picker));
|
AddChildElementMessage.Send(new ViewModelMessageContent(picker));
|
||||||
}
|
}
|
||||||
@ -300,6 +348,41 @@ namespace zaaReloaded2.ViewModels
|
|||||||
return LastSelectedElement is ControlElementViewModel;
|
return LastSelectedElement is ControlElementViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DoEditElement()
|
||||||
|
{
|
||||||
|
if (CanEditElement())
|
||||||
|
{
|
||||||
|
if (LastSelectedElement is ControlElementViewModel)
|
||||||
|
{
|
||||||
|
ElementPickerViewModel picker = new ElementPickerViewModel(
|
||||||
|
LastSelectedElement as ControlElementViewModel);
|
||||||
|
picker.ElementChosenMessage.Sent += (sender, args) =>
|
||||||
|
{
|
||||||
|
// Replace the previously selected element with the new
|
||||||
|
// one that we get from the ElementPickerViewModel.
|
||||||
|
ElementViewModel newVM = args.Content.ViewModel as ElementViewModel;
|
||||||
|
Elements.Insert(
|
||||||
|
Elements.IndexOf(LastSelectedElement),
|
||||||
|
newVM);
|
||||||
|
Elements.Remove(LastSelectedElement);
|
||||||
|
newVM.PropertyChanged += ElementViewModel_PropertyChanged;
|
||||||
|
newVM.IsSelected = true;
|
||||||
|
};
|
||||||
|
ChangeControlElementMessage.Send(
|
||||||
|
new ViewModelMessageContent(picker));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EditElementMessage.Send(new ViewModelMessageContent(LastSelectedElement));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CanEditElement()
|
||||||
|
{
|
||||||
|
return LastSelectedElement != null && LastSelectedElement.IsSelected;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deletes the selected element.
|
/// Deletes the selected element.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -403,10 +486,13 @@ namespace zaaReloaded2.ViewModels
|
|||||||
Settings _settings;
|
Settings _settings;
|
||||||
DelegatingCommand _addElementCommand;
|
DelegatingCommand _addElementCommand;
|
||||||
DelegatingCommand _addChildElementCommand;
|
DelegatingCommand _addChildElementCommand;
|
||||||
|
DelegatingCommand _editElementCommand;
|
||||||
DelegatingCommand _deleteElementCommand;
|
DelegatingCommand _deleteElementCommand;
|
||||||
DelegatingCommand _copyElementCommand;
|
DelegatingCommand _copyElementCommand;
|
||||||
Message<ViewModelMessageContent> _addElementMessage;
|
Message<ViewModelMessageContent> _addElementMessage;
|
||||||
Message<ViewModelMessageContent> _addChildElementMessage;
|
Message<ViewModelMessageContent> _addChildElementMessage;
|
||||||
|
Message<ViewModelMessageContent> _editElementMessage;
|
||||||
|
Message<ViewModelMessageContent> _changeControlElementMessage;
|
||||||
ElementViewModel _selectedElement;
|
ElementViewModel _selectedElement;
|
||||||
EnumProvider<ReferenceStyle> _referenceStyle;
|
EnumProvider<ReferenceStyle> _referenceStyle;
|
||||||
|
|
||||||
|
@ -26,28 +26,25 @@
|
|||||||
Title="Neues Element auswählen"
|
Title="Neues Element auswählen"
|
||||||
>
|
>
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<ResourceDictionary>
|
|
||||||
<ResourceDictionary.MergedDictionaries>
|
|
||||||
<ResourceDictionary Source="/zaaReloaded2;component/Style.xaml" />
|
<ResourceDictionary Source="/zaaReloaded2;component/Style.xaml" />
|
||||||
<ResourceDictionary>
|
|
||||||
<DataTemplate x:Key="ChildElement">
|
|
||||||
<TextBlock Text="{Binding DisplayString}" />
|
|
||||||
</DataTemplate>
|
|
||||||
<HierarchicalDataTemplate x:Key="CategoriesTree"
|
|
||||||
ItemsSource="{Binding Children}"
|
|
||||||
ItemTemplate="{StaticResource ResourceKey=ChildElement}">
|
|
||||||
<TextBlock Text="{Binding DisplayString}" />
|
|
||||||
</HierarchicalDataTemplate>
|
|
||||||
</ResourceDictionary>
|
|
||||||
</ResourceDictionary.MergedDictionaries>
|
|
||||||
</ResourceDictionary>
|
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
<StackPanel Margin="10">
|
<StackPanel Margin="10">
|
||||||
<Label Content="Verfügbare Elemente:" Target="{Binding ElementName=ElementsTreeView}" />
|
<Label Content="Verfügbare Elemente:" Target="{Binding ElementName=ElementsTreeView}" />
|
||||||
<!-- TODO: Expand tree by default. -->
|
<!-- TODO: Expand tree by default. -->
|
||||||
<TreeView ItemsSource="{Binding Categories}" ItemTemplate="{StaticResource ResourceKey=CategoriesTree}"
|
<TreeView ItemsSource="{Binding Categories}" Height="120">
|
||||||
Height="160" Width="240"/>
|
<TreeView.ItemContainerStyle>
|
||||||
<UniformGrid HorizontalAlignment="Right" Columns="2" Rows="1" Margin="0 10 0 0">
|
<Style TargetType="{x:Type TreeViewItem}">
|
||||||
|
<Setter Property="IsExpanded" Value="True" />
|
||||||
|
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
|
||||||
|
</Style>
|
||||||
|
</TreeView.ItemContainerStyle>
|
||||||
|
<TreeView.ItemTemplate>
|
||||||
|
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
|
||||||
|
<TextBlock Text="{Binding DisplayString}" />
|
||||||
|
</HierarchicalDataTemplate>
|
||||||
|
</TreeView.ItemTemplate>
|
||||||
|
</TreeView>
|
||||||
|
<UniformGrid Columns="2" Rows="1" Margin="0 10 0 0">
|
||||||
<Button Content="OK" Command="{Binding ChooseElementCommand}" IsDefault="True" Margin="0 0 10 0" />
|
<Button Content="OK" Command="{Binding ChooseElementCommand}" IsDefault="True" Margin="0 0 10 0" />
|
||||||
<Button Content="Abbrechen" Command="{Binding CloseViewCommand}" IsCancel="True" Margin="10 0 0 0" />
|
<Button Content="Abbrechen" Command="{Binding CloseViewCommand}" IsCancel="True" Margin="10 0 0 0" />
|
||||||
</UniformGrid>
|
</UniformGrid>
|
||||||
|
@ -28,9 +28,10 @@
|
|||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<ResourceDictionary Source="/zaaReloaded2;component/Style.xaml" />
|
<ResourceDictionary Source="/zaaReloaded2;component/Style.xaml" />
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
<StackPanel Margin="20">
|
<StackPanel Margin="10">
|
||||||
<Label Content="Inhalt:" Target="{Binding ElementName=ContentTextBox}" />
|
<Label Content="Inhalt:" Target="{Binding ElementName=ContentTextBox}" />
|
||||||
<TextBox Text="{Binding Content}" x:Name="ContentTextBox" Margin="0 0 0 5"
|
<TextBox Text="{Binding Content,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
|
||||||
|
x:Name="ContentTextBox" Margin="0 0 0 5"
|
||||||
Width="300" Height="60" TextWrapping="Wrap" />
|
Width="300" Height="60" TextWrapping="Wrap" />
|
||||||
<UniformGrid HorizontalAlignment="Right" Columns="2" Rows="1" Margin="0 10 0 0">
|
<UniformGrid HorizontalAlignment="Right" Columns="2" Rows="1" Margin="0 10 0 0">
|
||||||
<Button Content="OK" Command="{Binding SaveCommand}" IsDefault="True" Margin="0 0 5 0" />
|
<Button Content="OK" Command="{Binding SaveCommand}" IsDefault="True" Margin="0 0 5 0" />
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
xmlns:b="clr-namespace:Bovender.Mvvm.Views.Settings;assembly=Bovender"
|
xmlns:b="clr-namespace:Bovender.Mvvm.Views.Settings;assembly=Bovender"
|
||||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||||
xmlns:action="clr-namespace:Bovender.Mvvm.Actions;assembly=Bovender"
|
xmlns:action="clr-namespace:Bovender.Mvvm.Actions;assembly=Bovender"
|
||||||
SizeToContent="WidthAndHeight" ResizeMode="CanResizeWithGrip" ShowInTaskbar="False"
|
Width="380" Height="340" ResizeMode="CanResizeWithGrip" ShowInTaskbar="False"
|
||||||
b:WindowState.CenterScreen="True" b:WindowState.Save="True"
|
b:WindowState.CenterScreen="True" b:WindowState.Save="True"
|
||||||
Title="Stil auswählen"
|
Title="Stil auswählen"
|
||||||
>
|
>
|
||||||
|
@ -23,26 +23,12 @@
|
|||||||
xmlns:b="clr-namespace:Bovender.Mvvm.Views.Settings;assembly=Bovender"
|
xmlns:b="clr-namespace:Bovender.Mvvm.Views.Settings;assembly=Bovender"
|
||||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||||
xmlns:action="clr-namespace:Bovender.Mvvm.Actions;assembly=Bovender"
|
xmlns:action="clr-namespace:Bovender.Mvvm.Actions;assembly=Bovender"
|
||||||
SizeToContent="WidthAndHeight" ResizeMode="CanResizeWithGrip" ShowInTaskbar="False"
|
Width="640" Height="480" ResizeMode="CanResizeWithGrip" ShowInTaskbar="False"
|
||||||
b:WindowState.CenterScreen="True" b:WindowState.Save="True"
|
b:WindowState.CenterScreen="True" b:WindowState.Save="True"
|
||||||
Title="Stil bearbeiten"
|
Title="Stil bearbeiten"
|
||||||
>
|
>
|
||||||
<Window.Resources>
|
<Window.Resources>
|
||||||
<ResourceDictionary>
|
|
||||||
<ResourceDictionary.MergedDictionaries>
|
|
||||||
<ResourceDictionary Source="/zaaReloaded2;component/Style.xaml" />
|
<ResourceDictionary Source="/zaaReloaded2;component/Style.xaml" />
|
||||||
<ResourceDictionary>
|
|
||||||
<DataTemplate x:Key="ChildElement">
|
|
||||||
<TextBlock Text="{Binding DisplayString}" />
|
|
||||||
</DataTemplate>
|
|
||||||
<HierarchicalDataTemplate x:Key="ElementsTree"
|
|
||||||
ItemsSource="{Binding Elements}"
|
|
||||||
ItemTemplate="{StaticResource ResourceKey=ChildElement}">
|
|
||||||
<TextBlock Text="{Binding DisplayString}" />
|
|
||||||
</HierarchicalDataTemplate>
|
|
||||||
</ResourceDictionary>
|
|
||||||
</ResourceDictionary.MergedDictionaries>
|
|
||||||
</ResourceDictionary>
|
|
||||||
</Window.Resources>
|
</Window.Resources>
|
||||||
<i:Interaction.Triggers>
|
<i:Interaction.Triggers>
|
||||||
<i:EventTrigger SourceObject="{Binding AddElementMessage}" EventName="Sent">
|
<i:EventTrigger SourceObject="{Binding AddElementMessage}" EventName="Sent">
|
||||||
@ -54,14 +40,17 @@
|
|||||||
<i:EventTrigger SourceObject="{Binding EditElementMessage}" EventName="Sent">
|
<i:EventTrigger SourceObject="{Binding EditElementMessage}" EventName="Sent">
|
||||||
<action:ShowViewDialogAction View="zaaReloaded2.Views.ElementView" Assembly="zaaReloaded2" />
|
<action:ShowViewDialogAction View="zaaReloaded2.Views.ElementView" Assembly="zaaReloaded2" />
|
||||||
</i:EventTrigger>
|
</i:EventTrigger>
|
||||||
|
<i:EventTrigger SourceObject="{Binding ChangeControlElementMessage}" EventName="Sent">
|
||||||
|
<action:ShowViewDialogAction View="zaaReloaded2.Views.ElementPickerView" Assembly="zaaReloaded2" />
|
||||||
|
</i:EventTrigger>
|
||||||
</i:Interaction.Triggers>
|
</i:Interaction.Triggers>
|
||||||
<StackPanel Margin="10">
|
<DockPanel Margin="10">
|
||||||
<DockPanel IsEnabled="{Binding IsNameEnabled}">
|
<DockPanel DockPanel.Dock="Top" IsEnabled="{Binding IsNameEnabled}">
|
||||||
<Label DockPanel.Dock="Left" Content="Name:" Target="{Binding ElementName=NameTextBox}"
|
<Label DockPanel.Dock="Left" Content="Name:" Target="{Binding ElementName=NameTextBox}"
|
||||||
Margin="0 0 10 0"/>
|
Margin="0 0 10 0"/>
|
||||||
<TextBox Text="{Binding Name}" x:Name="NameTextBox" HorizontalAlignment="Stretch" />
|
<TextBox Text="{Binding Name}" x:Name="NameTextBox" HorizontalAlignment="Stretch" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
<DockPanel>
|
<DockPanel DockPanel.Dock="Top">
|
||||||
<Label DockPanel.Dock="Left" Content="Referenzwerte anzeigen:" Margin="0 0 10 0"
|
<Label DockPanel.Dock="Left" Content="Referenzwerte anzeigen:" Margin="0 0 10 0"
|
||||||
Target="{Binding ElementName=ReferenceStyleChooser}" />
|
Target="{Binding ElementName=ReferenceStyleChooser}" />
|
||||||
<ComboBox ItemsSource="{Binding ReferenceStyle.Choices}"
|
<ComboBox ItemsSource="{Binding ReferenceStyle.Choices}"
|
||||||
@ -69,6 +58,10 @@
|
|||||||
SelectedItem="{Binding ReferenceStyle.SelectedItem}"
|
SelectedItem="{Binding ReferenceStyle.SelectedItem}"
|
||||||
x:Name="ReferenceStyleChooser" HorizontalAlignment="Stretch" />
|
x:Name="ReferenceStyleChooser" HorizontalAlignment="Stretch" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
|
<Button Command="{Binding CloseViewCommand}" Content="Schließen" IsDefault="True" IsCancel="True" Margin="0 10 0 0"
|
||||||
|
Width="{Binding ElementName=NewElementButton,Path=ActualWidth}"/>
|
||||||
|
</StackPanel>
|
||||||
<GroupBox Header="Elemente" Margin="0 10 0 0">
|
<GroupBox Header="Elemente" Margin="0 10 0 0">
|
||||||
<DockPanel LastChildFill="True">
|
<DockPanel LastChildFill="True">
|
||||||
<StackPanel DockPanel.Dock="Right" Margin="10 0 0 0">
|
<StackPanel DockPanel.Dock="Right" Margin="10 0 0 0">
|
||||||
@ -77,16 +70,22 @@
|
|||||||
<Button Command="{Binding AddChildElementCommand}" Content="Neues Kindelement" Margin="0 0 0 10" />
|
<Button Command="{Binding AddChildElementCommand}" Content="Neues Kindelement" Margin="0 0 0 10" />
|
||||||
<Button Command="{Binding EditElementCommand}" IsDefault="True" Content="Bearbeiten" Margin="0 0 0 10" />
|
<Button Command="{Binding EditElementCommand}" IsDefault="True" Content="Bearbeiten" Margin="0 0 0 10" />
|
||||||
<Button Command="{Binding CopyElementCommand}" Content="Kopieren" Margin="0 0 0 10" />
|
<Button Command="{Binding CopyElementCommand}" Content="Kopieren" Margin="0 0 0 10" />
|
||||||
<Button Command="{Binding RemoveElementCommand}" Content="Entfernen" Margin="0 0 0 10" />
|
<Button Command="{Binding DeleteElementCommand}" Content="Entfernen" Margin="0 0 0 10" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<TreeView ItemsSource="{Binding Elements}"
|
<TreeView ItemsSource="{Binding Elements}">
|
||||||
ItemTemplate="{StaticResource ResourceKey=ElementsTree}"
|
<TreeView.ItemContainerStyle>
|
||||||
MinWidth="200"/>
|
<Style TargetType="{x:Type TreeViewItem}">
|
||||||
|
<Setter Property="IsExpanded" Value="True" />
|
||||||
|
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
|
||||||
|
</Style>
|
||||||
|
</TreeView.ItemContainerStyle>
|
||||||
|
<TreeView.ItemTemplate>
|
||||||
|
<HierarchicalDataTemplate ItemsSource="{Binding Elements}">
|
||||||
|
<TextBlock Text="{Binding DisplayString}" />
|
||||||
|
</HierarchicalDataTemplate>
|
||||||
|
</TreeView.ItemTemplate>
|
||||||
|
</TreeView>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
</DockPanel>
|
||||||
<Button Command="{Binding CloseViewCommand}" Content="Schließen" IsCancel="True" Margin="0 10 0 0"
|
|
||||||
Width="{Binding ElementName=NewElementButton,Path=ActualWidth}"/>
|
|
||||||
</StackPanel>
|
|
||||||
</StackPanel>
|
|
||||||
</Window>
|
</Window>
|
||||||
|
@ -95,6 +95,15 @@
|
|||||||
<setting name="ParagraphStyleName" serializeAs="String">
|
<setting name="ParagraphStyleName" serializeAs="String">
|
||||||
<value>zaaReloaded2-Laborwerte</value>
|
<value>zaaReloaded2-Laborwerte</value>
|
||||||
</setting>
|
</setting>
|
||||||
|
<setting name="ReferenceStyle" serializeAs="String">
|
||||||
|
<value>IfSpecialOrAbnormal</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="FormatElementLabel" serializeAs="String">
|
||||||
|
<value>Ausgabe-Elemente</value>
|
||||||
|
</setting>
|
||||||
|
<setting name="ControlElementLabel" serializeAs="String">
|
||||||
|
<value>Steuerungs-Elemente</value>
|
||||||
|
</setting>
|
||||||
</zaaReloaded2.Properties.Settings>
|
</zaaReloaded2.Properties.Settings>
|
||||||
</applicationSettings>
|
</applicationSettings>
|
||||||
<userSettings>
|
<userSettings>
|
||||||
|
Loading…
Reference in New Issue
Block a user