Wire up the views.

This commit is contained in:
Daniel Kraus 2015-08-09 13:24:44 +02:00
parent 257e3e8568
commit b59c9f2898
21 changed files with 363 additions and 84 deletions

View File

@ -69,7 +69,7 @@ namespace Tests.ViewModels
_settingsVM.AddElementViewModel(viewModel);
viewModel.IsSelected = true;
int oldViewModelChildrenCount = viewModel.Elements.Count;
int oldModelChildrenCount = model.FormatElements.Count;
int oldModelChildrenCount = model.Children.Count;
_settingsVM.AddChildElementMessage.Sent += (sender, args) =>
{
messageSent = true;
@ -84,7 +84,7 @@ namespace Tests.ViewModels
Assert.IsTrue(messageSent, "Message was not sent");
Assert.AreEqual(oldViewModelChildrenCount + 1, viewModel.Elements.Count,
"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");
}
@ -140,7 +140,7 @@ namespace Tests.ViewModels
ElementViewModel elementVM = ((ControlElementViewModel)settingsVM.Elements.First())
.Elements.First();
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?!");
elementVM.IsSelected = true;
Assert.IsTrue(settingsVM.DeleteElementCommand.CanExecute(null),
@ -149,7 +149,7 @@ namespace Tests.ViewModels
Assert.AreEqual(oldCount - 1, parent.Elements.Count);
Assert.IsFalse(parent.Elements.Contains(elementVM),
"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.");
}

View File

@ -16,6 +16,7 @@
* limitations under the License.
*/
using System.Collections.Generic;
using System.Linq;
namespace zaaReloaded2.Controller.Elements
{
@ -29,19 +30,29 @@ namespace zaaReloaded2.Controller.Elements
/// Gets a list of child elements, all of which must be derived
/// from FormatElementBase.
/// </summary>
public IList<FormatElementBase> FormatElements { get; private set; }
public IList<FormatElementBase> Children { get; internal set; }
public ControlElementBase()
: this(new List<FormatElementBase>())
{ }
public ControlElementBase(IList<FormatElementBase> formatElements)
public ControlElementBase(IList<FormatElementBase> children)
{
FormatElements = formatElements;
Children = children;
}
public ControlElementBase(FormatElementBase formatElement)
: this(new List<FormatElementBase>() { formatElement })
public ControlElementBase(FormatElementBase children)
: 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();
}
}
}

View File

@ -26,7 +26,7 @@ namespace zaaReloaded2.Controller.Elements
{
public override string Label
{
get { return "Jeden Tag auswählen"; }
get { return "Jeder Tag"; }
}
public override void Run(Formatter.Formatter formatter)
@ -46,7 +46,7 @@ namespace zaaReloaded2.Controller.Elements
protected override ElementBase CreateInstance()
{
return new SelectEachDay();
return new SelectEachDay(CloneChildren());
}
}
}

View File

@ -30,7 +30,7 @@ namespace zaaReloaded2.Controller.Elements
{
public override string Label
{
get { return "Ersten Tag auswählen"; }
get { return "Erster Tag"; }
}
public override void Run(Formatter.Formatter formatter)
@ -50,7 +50,7 @@ namespace zaaReloaded2.Controller.Elements
protected override ElementBase CreateInstance()
{
return new SelectFirstDay();
return new SelectFirstDay(CloneChildren());
}
}
}

View File

@ -31,7 +31,7 @@ namespace zaaReloaded2.Controller.Elements
{
public override string Label
{
get { return "Letzten Tag auswählen"; }
get { return "Letzter Tag"; }
}
public override void Run(Formatter.Formatter formatter)
@ -51,7 +51,7 @@ namespace zaaReloaded2.Controller.Elements
protected override ElementBase CreateInstance()
{
return new SelectLastDay();
return new SelectLastDay(CloneChildren());
}
}
}

View File

@ -87,6 +87,7 @@ namespace zaaReloaded2.Controller
Uid = Guid.NewGuid();
Name = name;
Elements = initialElements;
ReferenceStyle = Properties.Settings.Default.ReferenceStyle;
if (Elements == null)
{
Elements = new List<ElementBase>();

View File

@ -205,7 +205,7 @@ namespace zaaReloaded2.Formatter
/// FormatElementBase children to process.</param>
public void ProcessAllTimePoints(ControlElementBase controlElement)
{
ProcessAllTimePoints(controlElement.FormatElements);
ProcessAllTimePoints(controlElement.Children);
}
/// <summary>
@ -297,7 +297,7 @@ namespace zaaReloaded2.Formatter
throw new ArgumentNullException("workingTimePoints");
WorkingTimePoints = workingTimePoints;
ProcessElements(controlElement.FormatElements);
ProcessElements(controlElement.Children);
if (_primaryBuffer.HasBufferedText)
{
_primaryBuffer.Prepend(

View File

@ -32,31 +32,31 @@ namespace zaaReloaded2.Formatter
/// <summary>
/// Never write normal ranges
/// </summary>
[Description("Referenzbereich nie ausgeben")]
[Description("Niemals")]
Never,
/// <summary>
/// Write normal range if item is marked in dictionary
/// </summary>
[Description("Referenzbereich ausgeben, falls Parameter so markiert ist")]
[Description("Bei speziellen Parametern immer")]
IfSpecialItem,
/// <summary>
/// Write normal range if value is abnormal
/// </summary>
[Description("Referenzbereich ausgeben, falls Wert nicht normal ist")]
[Description("Bei pathologischem Wert")]
IfAbnormal,
/// <summary>
/// Write normal range if item is marked in dictionary, or if value is abnormal
/// </summary>
[Description("Referenzbereich ausgeben, falls Parameter so markiert ist oder falls Wert nicht normal ist")]
[Description("Bei pathologischem Wert oder speziellem Parameter")]
IfSpecialOrAbnormal,
/// <summary>
/// Always write normal range reference
/// </summary>
[Description("Referenzbereich immer ausgeben")]
[Description("Immer")]
Always
}
}

View File

@ -254,5 +254,32 @@ namespace zaaReloaded2.Properties {
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"]));
}
}
}
}

View File

@ -77,5 +77,14 @@
<Setting Name="ParagraphStyleName" Type="System.String" Scope="Application">
<Value Profile="(Default)">zaaReloaded2-Laborwerte</Value>
</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>
</SettingsFile>

View File

@ -47,7 +47,7 @@ namespace zaaReloaded2.ViewModels
Elements = new ObservableCollection<ElementViewModel>();
if (controlElement != null)
{
foreach (FormatElementBase childElement in controlElement.FormatElements)
foreach (FormatElementBase childElement in controlElement.Children)
{
FormatElementViewModel childVM = new FormatElementViewModel(childElement);
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
#region Public methods
@ -64,7 +80,7 @@ namespace zaaReloaded2.ViewModels
Elements.Add(viewModel);
viewModel.Parent = this;
ControlElementBase e = Element as ControlElementBase;
e.FormatElements.Add(viewModel.RevealModelObject() as FormatElementBase);
e.Children.Add(viewModel.RevealModelObject() as FormatElementBase);
}
public void RemoveChildElement(FormatElementViewModel viewModel)
@ -75,13 +91,15 @@ namespace zaaReloaded2.ViewModels
"Cannot remove child view model that is not in the collection.");
}
Elements.Remove(viewModel);
((ControlElementBase)Element).FormatElements
((ControlElementBase)Element).Children
.Remove(viewModel.RevealModelObject() as FormatElementBase);
viewModel.Parent = null;
}
#endregion
#region Overrides
public override object Clone()
{
ControlElementViewModel clone = new ControlElementViewModel();
@ -94,5 +112,7 @@ namespace zaaReloaded2.ViewModels
}
return clone;
}
#endregion
}
}

View File

@ -29,7 +29,9 @@ namespace zaaReloaded2.ViewModels
{
/// <summary>
/// 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>
class ElementPickerViewModel : ViewModelBase
{
@ -98,7 +100,7 @@ namespace zaaReloaded2.ViewModels
{
AddCategory(
new CategoryViewModel(
"Kontroll-Elemente",
Properties.Settings.Default.ControlElementLabel,
new Collection<ViewModelBase>()
{
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(
new CategoryViewModel(
"Ausgabe-Elemente",
Properties.Settings.Default.ControlElementLabel,
new Collection<ViewModelBase>()
{
CreateFormatElementViewModel("Laborparameter", new Items()),
CreateFormatElementViewModel("Beliebiger Text", new CustomText()),
CreateControlElementViewModel(new SelectFirstDay(), copyFromViewModel),
CreateControlElementViewModel(new SelectLastDay(), copyFromViewModel),
CreateControlElementViewModel(new SelectEachDay(), copyFromViewModel)
}
)
);
@ -124,6 +140,20 @@ namespace zaaReloaded2.ViewModels
#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)
{
category.PropertyChanged += ElementViewModel_PropertyChanged;
@ -143,6 +173,15 @@ namespace zaaReloaded2.ViewModels
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>
/// Creates a new FormatElementViewModel that wraps a FormatElementBase
/// object and has a custom display string. The custom display string
@ -176,6 +215,7 @@ namespace zaaReloaded2.ViewModels
if (CanChooseElement())
{
ElementChosenMessage.Send(new ViewModelMessageContent(Selected));
DoCloseView();
}
}

View File

@ -42,6 +42,14 @@ namespace zaaReloaded2.ViewModels
}
}
public override string DisplayString
{
get
{
return Label;
}
}
#endregion
#region Constructors

View File

@ -20,6 +20,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Bovender.Mvvm;
using zaaReloaded2.Controller.Elements;
namespace zaaReloaded2.ViewModels
@ -31,10 +32,10 @@ namespace zaaReloaded2.ViewModels
public string Content
{
[DebuggerStepThrough]
get { return ((FormatElementBase)Element).Content; }
get { return _content; }
set
{
((FormatElementBase)Element).Content = value;
_content = value;
OnPropertyChanged("Content");
}
}
@ -47,6 +48,24 @@ namespace zaaReloaded2.ViewModels
#endregion
#region Commands
public DelegatingCommand SaveCommand
{
get
{
if (_saveCommand == null)
{
_saveCommand = new DelegatingCommand(
param => DoSave(),
param => CanSave());
}
return _saveCommand;
}
}
#endregion
#region Constructors
public FormatElementViewModel() : base() { }
@ -55,10 +74,13 @@ namespace zaaReloaded2.ViewModels
: this()
{
Element = formatElement;
Content = ((FormatElementBase)Element).Content;
}
#endregion
#region Overrides
public override object Clone()
{
FormatElementViewModel clone = new FormatElementViewModel();
@ -66,5 +88,52 @@ namespace zaaReloaded2.ViewModels
clone.Element = Element;
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
}
}

View File

@ -238,8 +238,9 @@ namespace zaaReloaded2.ViewModels
Settings s = new Settings("Neu");
SettingsViewModel vm = new SettingsViewModel(s);
_repository.SettingsList.Add(s);
SettingsList.Add(vm);
AddSettingsViewModel(vm);
vm.IsSelected = true;
EditSettingsMessage.Send(new ViewModelMessageContent(vm));
}
bool CanDeleteSettings()
@ -291,6 +292,7 @@ namespace zaaReloaded2.ViewModels
AddSettingsViewModel(copy);
LastSelected.IsSelected = false;
copy.IsSelected = true;
EditSettingsMessage.Send(new ViewModelMessageContent(copy));
}
}

View File

@ -26,6 +26,7 @@ using Bovender.Mvvm.Messaging;
using zaaReloaded2.Controller;
using zaaReloaded2.Controller.Elements;
using zaaReloaded2.Formatter;
using System.Collections.ObjectModel;
namespace zaaReloaded2.ViewModels
{
@ -104,7 +105,12 @@ namespace zaaReloaded2.ViewModels
{
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;
}
@ -122,7 +128,7 @@ namespace zaaReloaded2.ViewModels
: base()
{
_settings = settings;
Elements = new List<ElementViewModel>();
Elements = new ObservableCollection<ElementViewModel>();
foreach (ElementBase element in settings.Elements)
{
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
#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
{
get
@ -275,6 +319,8 @@ namespace zaaReloaded2.ViewModels
{
ElementViewModel newVM = args.Content.ViewModel as ElementViewModel;
AddElementViewModel(newVM);
newVM.IsSelected = true;
DoEditElement();
};
AddElementMessage.Send(new ViewModelMessageContent(picker));
}
@ -290,6 +336,8 @@ namespace zaaReloaded2.ViewModels
{
FormatElementViewModel newVM = args.Content.ViewModel as FormatElementViewModel;
AddChildElementViewModel(LastSelectedElement as ControlElementViewModel, newVM);
newVM.IsSelected = true;
DoEditElement();
};
AddChildElementMessage.Send(new ViewModelMessageContent(picker));
}
@ -300,6 +348,41 @@ namespace zaaReloaded2.ViewModels
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>
/// Deletes the selected element.
/// </summary>
@ -403,10 +486,13 @@ namespace zaaReloaded2.ViewModels
Settings _settings;
DelegatingCommand _addElementCommand;
DelegatingCommand _addChildElementCommand;
DelegatingCommand _editElementCommand;
DelegatingCommand _deleteElementCommand;
DelegatingCommand _copyElementCommand;
Message<ViewModelMessageContent> _addElementMessage;
Message<ViewModelMessageContent> _addChildElementMessage;
Message<ViewModelMessageContent> _editElementMessage;
Message<ViewModelMessageContent> _changeControlElementMessage;
ElementViewModel _selectedElement;
EnumProvider<ReferenceStyle> _referenceStyle;

View File

@ -26,28 +26,25 @@
Title="Neues Element auswählen"
>
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<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>
<ResourceDictionary Source="/zaaReloaded2;component/Style.xaml" />
</Window.Resources>
<StackPanel Margin="10">
<Label Content="Verfügbare Elemente:" Target="{Binding ElementName=ElementsTreeView}" />
<!-- TODO: Expand tree by default. -->
<TreeView ItemsSource="{Binding Categories}" ItemTemplate="{StaticResource ResourceKey=CategoriesTree}"
Height="160" Width="240"/>
<UniformGrid HorizontalAlignment="Right" Columns="2" Rows="1" Margin="0 10 0 0">
<TreeView ItemsSource="{Binding Categories}" Height="120">
<TreeView.ItemContainerStyle>
<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="Abbrechen" Command="{Binding CloseViewCommand}" IsCancel="True" Margin="10 0 0 0" />
</UniformGrid>

View File

@ -28,9 +28,10 @@
<Window.Resources>
<ResourceDictionary Source="/zaaReloaded2;component/Style.xaml" />
</Window.Resources>
<StackPanel Margin="20">
<StackPanel Margin="10">
<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" />
<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" />

View File

@ -23,7 +23,7 @@
xmlns:b="clr-namespace:Bovender.Mvvm.Views.Settings;assembly=Bovender"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
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"
Title="Stil auswählen"
>

View File

@ -23,26 +23,12 @@
xmlns:b="clr-namespace:Bovender.Mvvm.Views.Settings;assembly=Bovender"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
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"
Title="Stil bearbeiten"
>
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<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>
<ResourceDictionary Source="/zaaReloaded2;component/Style.xaml" />
</Window.Resources>
<i:Interaction.Triggers>
<i:EventTrigger SourceObject="{Binding AddElementMessage}" EventName="Sent">
@ -54,14 +40,17 @@
<i:EventTrigger SourceObject="{Binding EditElementMessage}" EventName="Sent">
<action:ShowViewDialogAction View="zaaReloaded2.Views.ElementView" Assembly="zaaReloaded2" />
</i:EventTrigger>
<i:EventTrigger SourceObject="{Binding ChangeControlElementMessage}" EventName="Sent">
<action:ShowViewDialogAction View="zaaReloaded2.Views.ElementPickerView" Assembly="zaaReloaded2" />
</i:EventTrigger>
</i:Interaction.Triggers>
<StackPanel Margin="10">
<DockPanel IsEnabled="{Binding IsNameEnabled}">
<DockPanel Margin="10">
<DockPanel DockPanel.Dock="Top" IsEnabled="{Binding IsNameEnabled}">
<Label DockPanel.Dock="Left" Content="Name:" Target="{Binding ElementName=NameTextBox}"
Margin="0 0 10 0"/>
<TextBox Text="{Binding Name}" x:Name="NameTextBox" HorizontalAlignment="Stretch" />
</DockPanel>
<DockPanel>
<DockPanel DockPanel.Dock="Top">
<Label DockPanel.Dock="Left" Content="Referenzwerte anzeigen:" Margin="0 0 10 0"
Target="{Binding ElementName=ReferenceStyleChooser}" />
<ComboBox ItemsSource="{Binding ReferenceStyle.Choices}"
@ -69,6 +58,10 @@
SelectedItem="{Binding ReferenceStyle.SelectedItem}"
x:Name="ReferenceStyleChooser" HorizontalAlignment="Stretch" />
</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">
<DockPanel LastChildFill="True">
<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 EditElementCommand}" IsDefault="True" Content="Bearbeiten" 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>
<TreeView ItemsSource="{Binding Elements}"
ItemTemplate="{StaticResource ResourceKey=ElementsTree}"
MinWidth="200"/>
<TreeView ItemsSource="{Binding Elements}">
<TreeView.ItemContainerStyle>
<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>
</GroupBox>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Command="{Binding CloseViewCommand}" Content="Schließen" IsCancel="True" Margin="0 10 0 0"
Width="{Binding ElementName=NewElementButton,Path=ActualWidth}"/>
</StackPanel>
</StackPanel>
</DockPanel>
</Window>

View File

@ -95,6 +95,15 @@
<setting name="ParagraphStyleName" serializeAs="String">
<value>zaaReloaded2-Laborwerte</value>
</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>
</applicationSettings>
<userSettings>