Merge branch 'release-2.0.0-alpha.4'
This commit is contained in:
commit
305baf2402
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
Version 2.0.0-alpha.3 (2015-07-31)
|
Version 2.0.0-alpha.3 (2015-07-31)
|
||||||
========================================================================
|
========================================================================
|
||||||
|
|
||||||
|
@ -56,27 +56,5 @@ namespace Tests.Controller
|
|||||||
Assert.AreEqual(1, sr.SettingsList.Count);
|
Assert.AreEqual(1, sr.SettingsList.Count);
|
||||||
Assert.AreEqual(testName, sr.SettingsList[0].Name);
|
Assert.AreEqual(testName, sr.SettingsList[0].Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void CreateDefaultSettings()
|
|
||||||
{
|
|
||||||
SettingsRepository sr = new SettingsRepository();
|
|
||||||
sr.SettingsList.Add(new Settings("test1", null));
|
|
||||||
sr.SettingsList.Add(new Settings("test2", null));
|
|
||||||
sr.SettingsList.Add(new Settings("test3", null));
|
|
||||||
sr.ResetDefault();
|
|
||||||
|
|
||||||
// Assert that there are now only the 2 default settings
|
|
||||||
Assert.AreEqual(2, sr.SettingsList.Count);
|
|
||||||
|
|
||||||
Assert.AreEqual(
|
|
||||||
zaaReloaded2.Properties.Settings.Default.SettingsNameWard,
|
|
||||||
sr.SettingsList[0].Name,
|
|
||||||
"Settings for ward expected as #1 (index 0) in list");
|
|
||||||
Assert.AreEqual(
|
|
||||||
zaaReloaded2.Properties.Settings.Default.SettingsNameClinic,
|
|
||||||
sr.SettingsList[1].Name,
|
|
||||||
"Settings for outpatient clinic expected as #2 (index 1) in list");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@
|
|||||||
<Compile Include="Thesaurus\TestThesaurus.cs" />
|
<Compile Include="Thesaurus\TestThesaurus.cs" />
|
||||||
<Compile Include="Importer\ZaaImporter\TimePointTest.cs" />
|
<Compile Include="Importer\ZaaImporter\TimePointTest.cs" />
|
||||||
<Compile Include="TestHelpers.cs" />
|
<Compile Include="TestHelpers.cs" />
|
||||||
<Compile Include="ViewModels\SettingsRepositoryViewModel.cs" />
|
<Compile Include="ViewModels\SettingsRepositoryViewModelTest.cs" />
|
||||||
<Compile Include="ViewModels\SettingsViewModelTest.cs" />
|
<Compile Include="ViewModels\SettingsViewModelTest.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
72
Tests/ViewModels/SettingsRepositoryViewModelTest.cs
Executable file
72
Tests/ViewModels/SettingsRepositoryViewModelTest.cs
Executable file
@ -0,0 +1,72 @@
|
|||||||
|
/* SettingsRepositoryViewModel.cs
|
||||||
|
* part of zaaReloaded2
|
||||||
|
*
|
||||||
|
* Copyright 2015 Daniel Kraus
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using zaaReloaded2.Controller;
|
||||||
|
using zaaReloaded2.ViewModels;
|
||||||
|
|
||||||
|
namespace Tests.ViewModels
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
class SettingsRepositoryViewModelTest
|
||||||
|
{
|
||||||
|
SettingsRepositoryViewModel _vm;
|
||||||
|
const string TESTNAME = "hello world";
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp()
|
||||||
|
{
|
||||||
|
SettingsRepository rep = new SettingsRepository();
|
||||||
|
rep.SettingsList.Add(new Settings(TESTNAME));
|
||||||
|
_vm = new SettingsRepositoryViewModel(rep);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CanDeleteNonDefaultSettings()
|
||||||
|
{
|
||||||
|
_vm.SettingsList[_vm.SettingsList.Count - 1].IsSelected = true;
|
||||||
|
Assert.IsTrue(_vm.DeleteSettingsCommand.CanExecute(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CannotDeleteDefaultSettings()
|
||||||
|
{
|
||||||
|
_vm.SettingsList[0].IsSelected = true;
|
||||||
|
Assert.IsFalse(_vm.DeleteSettingsCommand.CanExecute(null));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void CopySettings()
|
||||||
|
{
|
||||||
|
SettingsViewModel orig = _vm.SettingsList[0];
|
||||||
|
orig.IsSelected = true;
|
||||||
|
_vm.CopySettingsCommand.Execute(null);
|
||||||
|
SettingsViewModel copy = _vm.SettingsList[_vm.SettingsList.Count-1];
|
||||||
|
|
||||||
|
// Make sure we have a new object
|
||||||
|
Assert.AreNotSame(orig, copy);
|
||||||
|
Assert.AreNotSame(orig.RevealModelObject(), copy.RevealModelObject());
|
||||||
|
|
||||||
|
Assert.AreEqual(String.Format("Kopie von {0}", orig.Name), copy.Name);
|
||||||
|
Assert.IsTrue(copy.IsSelected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -22,6 +22,7 @@ using System.Text;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using zaaReloaded2.ViewModels;
|
using zaaReloaded2.ViewModels;
|
||||||
using zaaReloaded2.Controller;
|
using zaaReloaded2.Controller;
|
||||||
|
using zaaReloaded2.Controller.Elements;
|
||||||
|
|
||||||
namespace Tests.ViewModels
|
namespace Tests.ViewModels
|
||||||
{
|
{
|
||||||
@ -51,7 +52,16 @@ namespace Tests.ViewModels
|
|||||||
[Test]
|
[Test]
|
||||||
public void CannotAddChildElementToFormatElement()
|
public void CannotAddChildElementToFormatElement()
|
||||||
{
|
{
|
||||||
|
ControlElementViewModel parent = new ControlElementViewModel(
|
||||||
|
new SelectFirstDay());
|
||||||
|
_settingsVM.AddElementViewModel(parent);
|
||||||
|
parent.IsSelected = true;
|
||||||
|
Assert.IsTrue(_settingsVM.AddChildElementCommand.CanExecute(null));
|
||||||
|
FormatElementViewModel child = new FormatElementViewModel(new Items());
|
||||||
|
parent.AddChildElement(child);
|
||||||
|
parent.IsSelected = false;
|
||||||
|
child.IsSelected = true;
|
||||||
|
Assert.IsFalse(_settingsVM.AddChildElementCommand.CanExecute(null));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
2.0.0-alpha.3
|
2.0.0-alpha.4
|
||||||
http://zaa.nephrowiki.de/downloads/zaaReloaded-2.0.0-alpha.3.exe
|
http://zaa.nephrowiki.de/downloads/zaaReloaded-2.0.0-alpha.4.exe
|
||||||
c9bb1062acdf2d8181a3915e34d5cfe96d26934a publish/release/zaaReloaded-2.0.0-alpha.3.exe
|
3f511ac90dbfbb14318948a3be1d1f9d2eb059d1 publish/release/zaaReloaded-2.0.0-alpha.4.exe
|
||||||
|
|
||||||
|
@ -36,5 +36,12 @@ namespace zaaReloaded2.Controller.Elements
|
|||||||
{
|
{
|
||||||
formatter.WriteParagraph(Content);
|
formatter.WriteParagraph(Content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override ElementBase CreateInstance()
|
||||||
|
{
|
||||||
|
CustomText clone = new CustomText();
|
||||||
|
clone.Content = Content;
|
||||||
|
return clone;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ namespace zaaReloaded2.Controller.Elements
|
|||||||
/// Base class for formatting elements.
|
/// Base class for formatting elements.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public abstract class ElementBase
|
public abstract class ElementBase : ICloneable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the label for this formatting element.
|
/// Returns the label for this formatting element.
|
||||||
@ -44,5 +44,16 @@ namespace zaaReloaded2.Controller.Elements
|
|||||||
/// Element belongs to. The Formatter object provides access
|
/// Element belongs to. The Formatter object provides access
|
||||||
/// to the current Word document etc.</param>
|
/// to the current Word document etc.</param>
|
||||||
abstract public void Run(zaaReloaded2.Formatter.Formatter formatter);
|
abstract public void Run(zaaReloaded2.Formatter.Formatter formatter);
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
return CreateInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new instance that can be used for cloning.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>New instance of a derived class.</returns>
|
||||||
|
protected abstract ElementBase CreateInstance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,5 +43,10 @@ namespace zaaReloaded2.Controller.Elements
|
|||||||
public SelectEachDay(IList<FormatElementBase> formatElements)
|
public SelectEachDay(IList<FormatElementBase> formatElements)
|
||||||
: base(formatElements)
|
: base(formatElements)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
protected override ElementBase CreateInstance()
|
||||||
|
{
|
||||||
|
return new SelectEachDay();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,5 +47,10 @@ namespace zaaReloaded2.Controller.Elements
|
|||||||
public SelectFirstDay(IList<FormatElementBase> formatElements)
|
public SelectFirstDay(IList<FormatElementBase> formatElements)
|
||||||
: base(formatElements)
|
: base(formatElements)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
protected override ElementBase CreateInstance()
|
||||||
|
{
|
||||||
|
return new SelectFirstDay();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,5 +48,10 @@ namespace zaaReloaded2.Controller.Elements
|
|||||||
public SelectLastDay(IList<FormatElementBase> formatElements)
|
public SelectLastDay(IList<FormatElementBase> formatElements)
|
||||||
: base(formatElements)
|
: base(formatElements)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
protected override ElementBase CreateInstance()
|
||||||
|
{
|
||||||
|
return new SelectLastDay();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ namespace zaaReloaded2.Controller
|
|||||||
/// Holds settings related to controlling laboratory output.
|
/// Holds settings related to controlling laboratory output.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class Settings
|
public class Settings : ICloneable
|
||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
@ -47,13 +47,26 @@ namespace zaaReloaded2.Controller
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public IList<ElementBase> Elements { get; private set; }
|
public IList<ElementBase> Elements { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the unique ID of this Settings object. The unique
|
||||||
|
/// ID is not included in deep-copying (cloning).
|
||||||
|
/// </summary>
|
||||||
|
public Guid Uid { get; private set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructor
|
#region Constructors
|
||||||
|
|
||||||
public Settings()
|
public Settings()
|
||||||
{
|
{
|
||||||
Elements = new List<ElementBase>();
|
Elements = new List<ElementBase>();
|
||||||
|
Uid = Guid.NewGuid();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Settings(string name)
|
||||||
|
: this()
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -94,5 +107,19 @@ namespace zaaReloaded2.Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Implementation of ICloneable
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
Settings clone = new Settings(
|
||||||
|
String.Format("Kopie von {0}", Name),
|
||||||
|
Elements.Select(e => e.Clone() as ElementBase).ToList()
|
||||||
|
);
|
||||||
|
clone.ReferenceStyle = ReferenceStyle;
|
||||||
|
return clone;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,22 +62,42 @@ namespace zaaReloaded2.Controller
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructor
|
#region Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new instance of a settings repository that will
|
||||||
|
/// contain a default set of settings.
|
||||||
|
/// </summary>
|
||||||
public SettingsRepository()
|
public SettingsRepository()
|
||||||
{
|
{
|
||||||
SettingsList = new List<Settings>();
|
SettingsList = new List<Settings>();
|
||||||
|
CreateDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public methods
|
#region Public methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a Settings object contained in this repository
|
||||||
|
/// by unique ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="uid">GUID to look for.</param>
|
||||||
|
/// <returns>Settings object with this GUID, or null if the
|
||||||
|
/// GUID was not found.</returns>
|
||||||
|
public Settings FindByGuid(Guid uid)
|
||||||
|
{
|
||||||
|
return SettingsList.FirstOrDefault(s => s.Uid == uid);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Private methods
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resets the Settings contained in this SettingsRepository
|
/// Resets the Settings contained in this SettingsRepository
|
||||||
/// to the default set of settings.
|
/// to the default set of settings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ResetDefault()
|
private void CreateDefault()
|
||||||
{
|
{
|
||||||
SettingsList.Clear();
|
SettingsList.Clear();
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.Office.Interop.Word;
|
using Microsoft.Office.Interop.Word;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace zaaReloaded2.Formatter
|
namespace zaaReloaded2.Formatter
|
||||||
{
|
{
|
||||||
@ -32,6 +33,7 @@ namespace zaaReloaded2.Formatter
|
|||||||
{
|
{
|
||||||
FixWords(document);
|
FixWords(document);
|
||||||
FormatDiagnoses(selection);
|
FormatDiagnoses(selection);
|
||||||
|
FixSalutation(document);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FormatDiagnoses(Selection selection)
|
static void FormatDiagnoses(Selection selection)
|
||||||
@ -59,6 +61,7 @@ namespace zaaReloaded2.Formatter
|
|||||||
static void FixWords(Document document)
|
static void FixWords(Document document)
|
||||||
{
|
{
|
||||||
Find find = document.Range().Find;
|
Find find = document.Range().Find;
|
||||||
|
find.Execute2007(FindText: "Körperlicher Untersuchungsbefund", ReplaceWith: "Körperl. Untersuchung", Replace: WdReplace.wdReplaceAll);
|
||||||
find.Execute2007(FindText: "Dr.D.Kraus", ReplaceWith: "Dr. D. Kraus", Replace: WdReplace.wdReplaceAll);
|
find.Execute2007(FindText: "Dr.D.Kraus", ReplaceWith: "Dr. D. Kraus", Replace: WdReplace.wdReplaceAll);
|
||||||
find.Execute2007(FindText: "Z. n.", ReplaceWith: "Z.n.", Replace: WdReplace.wdReplaceAll);
|
find.Execute2007(FindText: "Z. n.", ReplaceWith: "Z.n.", Replace: WdReplace.wdReplaceAll);
|
||||||
find.Execute2007(FindText: "Zust. n.", ReplaceWith: "Z.n.", Replace: WdReplace.wdReplaceAll);
|
find.Execute2007(FindText: "Zust. n.", ReplaceWith: "Z.n.", Replace: WdReplace.wdReplaceAll);
|
||||||
@ -66,6 +69,23 @@ namespace zaaReloaded2.Formatter
|
|||||||
find.Execute2007(FindText: "Assistent der Klinik", ReplaceWith: "Internist/Nephrologe", Replace: WdReplace.wdReplaceAll);
|
find.Execute2007(FindText: "Assistent der Klinik", ReplaceWith: "Internist/Nephrologe", Replace: WdReplace.wdReplaceAll);
|
||||||
find.Execute2007(FindText: "Professor Dr.", ReplaceWith: "Prof. Dr.", Replace: WdReplace.wdReplaceAll);
|
find.Execute2007(FindText: "Professor Dr.", ReplaceWith: "Prof. Dr.", Replace: WdReplace.wdReplaceAll);
|
||||||
find.Execute2007(FindText: "mmHg", ReplaceWith: "mm Hg", Replace: WdReplace.wdReplaceAll);
|
find.Execute2007(FindText: "mmHg", ReplaceWith: "mm Hg", Replace: WdReplace.wdReplaceAll);
|
||||||
|
find.Execute2007(FindText: "RR ", ReplaceWith: "", Replace: WdReplace.wdReplaceAll);
|
||||||
|
find.Execute2007(FindText: "HF ", ReplaceWith: "", Replace: WdReplace.wdReplaceAll);
|
||||||
|
find.Execute2007(FindText: "TAC-Spiegel", ReplaceWith: "Tacrolimus-Talspiegel", Replace: WdReplace.wdReplaceAll);
|
||||||
|
find.Execute2007(FindText: "4-7", ReplaceWith: "4 bis 7", Replace: WdReplace.wdReplaceAll);
|
||||||
|
find.Execute2007(FindText: "5-8", ReplaceWith: "5 bis 8", Replace: WdReplace.wdReplaceAll);
|
||||||
|
find.Execute2007(FindText: "8-10", ReplaceWith: "8 bis 10", Replace: WdReplace.wdReplaceAll);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void FixSalutation(Document document)
|
||||||
|
{
|
||||||
|
Regex sal = new Regex(@"^Mit.*(freundl|kolleg)");
|
||||||
|
Regex med = new Regex(@"^((Häusl|Empf).*Medikat)|Therapieempf");
|
||||||
|
foreach (Paragraph p in document.Paragraphs)
|
||||||
|
{
|
||||||
|
if (sal.IsMatch(p.Range.Text)) p.Range.Text = "Mit freundlichen, kollegialen Grüßen,";
|
||||||
|
if (med.IsMatch(p.Range.Text)) p.Range.Text = "Aktuelle Medikation:";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
2.0.0-alpha.3
|
2.0.0-alpha.4
|
||||||
2.0.0.3
|
2.0.0.4
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* SettingsRepositoryViewModel.cs
|
/* CategoryViewModel.cs
|
||||||
* part of zaaReloaded2
|
* part of zaaReloaded2
|
||||||
*
|
*
|
||||||
* Copyright 2015 Daniel Kraus
|
* Copyright 2015 Daniel Kraus
|
||||||
@ -19,18 +19,28 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using NUnit.Framework;
|
using Bovender.Mvvm.ViewModels;
|
||||||
using zaaReloaded2.Controller;
|
|
||||||
|
|
||||||
namespace Tests.ViewModels
|
namespace zaaReloaded2.ViewModels
|
||||||
{
|
{
|
||||||
[TestFixture]
|
/// <summary>
|
||||||
class SettingsRepositoryViewModel
|
/// A simple view model that can be used to categorize items
|
||||||
{
|
/// in a tree view. It has a custom DisplayString and holds
|
||||||
[Test]
|
/// a collection of child view model items.
|
||||||
public void CannotDeleteDefaultSettings()
|
/// </summary>
|
||||||
|
class CategoryViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
|
public IEnumerable<ViewModelBase> Children { get; private set; }
|
||||||
|
|
||||||
|
public CategoryViewModel(string name, IEnumerable<ViewModelBase> children)
|
||||||
|
{
|
||||||
|
DisplayString = name;
|
||||||
|
Children = children;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override object RevealModelObject()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -46,5 +46,16 @@ namespace zaaReloaded2.ViewModels
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Public methods
|
||||||
|
|
||||||
|
public void AddChildElement(FormatElementViewModel viewModel)
|
||||||
|
{
|
||||||
|
Elements.Add(viewModel);
|
||||||
|
ControlElementBase e = Element as ControlElementBase;
|
||||||
|
e.FormatElements.Add(viewModel.RevealModelObject() as FormatElementBase);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
122
zaaReloaded2/ViewModels/ElementPickerViewModel.cs
Executable file
122
zaaReloaded2/ViewModels/ElementPickerViewModel.cs
Executable file
@ -0,0 +1,122 @@
|
|||||||
|
/* ElementPickerViewModel.cs
|
||||||
|
* part of zaaReloaded2
|
||||||
|
*
|
||||||
|
* Copyright 2015 Daniel Kraus
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Bovender.Mvvm;
|
||||||
|
using Bovender.Mvvm.Messaging;
|
||||||
|
using Bovender.Mvvm.ViewModels;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using zaaReloaded2.Controller.Elements;
|
||||||
|
|
||||||
|
namespace zaaReloaded2.ViewModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// View model that presents a list of zaaReloaded2.Contorller.Elements.ElementBase
|
||||||
|
/// classes to choose from.
|
||||||
|
/// </summary>
|
||||||
|
class ElementPickerViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A two-dimensional tree
|
||||||
|
/// </summary>
|
||||||
|
public IList<CategoryViewModel> AvailableElements { get; private set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
public ElementPickerViewModel(SettingsViewModel caller, bool allowControlElements)
|
||||||
|
{
|
||||||
|
_caller = caller;
|
||||||
|
AvailableElements = new List<CategoryViewModel>();
|
||||||
|
if (allowControlElements)
|
||||||
|
{
|
||||||
|
AvailableElements.Add(
|
||||||
|
new CategoryViewModel(
|
||||||
|
"Kontroll-Elemente",
|
||||||
|
new Collection<ViewModelBase>()
|
||||||
|
{
|
||||||
|
CreateControlElementViewModel(new SelectFirstDay()),
|
||||||
|
CreateControlElementViewModel(new SelectLastDay()),
|
||||||
|
CreateControlElementViewModel(new SelectEachDay())
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
AvailableElements.Add(
|
||||||
|
new CategoryViewModel(
|
||||||
|
"Ausgabe-Elemente",
|
||||||
|
new Collection<ViewModelBase>()
|
||||||
|
{
|
||||||
|
CreateFormatElementViewModel("Laborparameter", new Items()),
|
||||||
|
CreateFormatElementViewModel("Beliebiger Text", new CustomText()),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Private methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new ControlElementViewModel that wraps a ControlElementBase
|
||||||
|
/// object. The display string of the ControlElementViewModel is taken
|
||||||
|
/// from the canonical Label of the control element.
|
||||||
|
/// </summary>
|
||||||
|
ViewModelBase CreateControlElementViewModel(ControlElementBase element)
|
||||||
|
{
|
||||||
|
ControlElementViewModel vm = new ControlElementViewModel(element);
|
||||||
|
vm.DisplayString = element.Label;
|
||||||
|
return vm;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new FormatElementViewModel that wraps a FormatElementBase
|
||||||
|
/// object and has a custom display string. The custom display string
|
||||||
|
/// is necessary because format elements do not have a canonical label.
|
||||||
|
/// </summary>
|
||||||
|
ViewModelBase CreateFormatElementViewModel(string name, FormatElementBase element)
|
||||||
|
{
|
||||||
|
FormatElementViewModel vm = new FormatElementViewModel(element);
|
||||||
|
vm.DisplayString = name;
|
||||||
|
return vm;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Implementation ov ViewModelBase
|
||||||
|
|
||||||
|
public override object RevealModelObject()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
SettingsViewModel _caller;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
@ -26,7 +26,7 @@ using System.Collections.ObjectModel;
|
|||||||
|
|
||||||
namespace zaaReloaded2.ViewModels
|
namespace zaaReloaded2.ViewModels
|
||||||
{
|
{
|
||||||
abstract class ElementViewModel : ViewModelBase
|
public abstract class ElementViewModel : ViewModelBase
|
||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
|
342
zaaReloaded2/ViewModels/SettingsRepositoryViewModel.cs
Executable file
342
zaaReloaded2/ViewModels/SettingsRepositoryViewModel.cs
Executable file
@ -0,0 +1,342 @@
|
|||||||
|
/* SettingsRepositoryViewModel.cs
|
||||||
|
* part of zaaReloaded2
|
||||||
|
*
|
||||||
|
* Copyright 2015 Daniel Kraus
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Bovender.Mvvm;
|
||||||
|
using Bovender.Mvvm.ViewModels;
|
||||||
|
using Bovender.Mvvm.Messaging;
|
||||||
|
using zaaReloaded2.Controller;
|
||||||
|
|
||||||
|
namespace zaaReloaded2.ViewModels
|
||||||
|
{
|
||||||
|
public class SettingsRepositoryViewModel : ViewModelBase
|
||||||
|
{
|
||||||
|
#region Properties
|
||||||
|
|
||||||
|
public IList<SettingsViewModel> SettingsList { get; private set; }
|
||||||
|
|
||||||
|
public SettingsViewModel Selected { get; private set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Commands
|
||||||
|
|
||||||
|
public DelegatingCommand AddSettingsCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_addSettingsCommand == null)
|
||||||
|
{
|
||||||
|
_addSettingsCommand = new DelegatingCommand(
|
||||||
|
param => DoAddSettings());
|
||||||
|
}
|
||||||
|
return _addSettingsCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public DelegatingCommand EditSettingsCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_editSettingsCommand == null)
|
||||||
|
{
|
||||||
|
_editSettingsCommand = new DelegatingCommand(
|
||||||
|
param => DoEditSettings(),
|
||||||
|
param => CanEditSettings());
|
||||||
|
}
|
||||||
|
return _editSettingsCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public DelegatingCommand UseSettingsCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_useSettingsCommand == null)
|
||||||
|
{
|
||||||
|
_useSettingsCommand = new DelegatingCommand(
|
||||||
|
param => DoUseSettings(),
|
||||||
|
param => CanUseSettings());
|
||||||
|
}
|
||||||
|
return _useSettingsCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public DelegatingCommand DeleteSettingsCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_deleteSettingsCommand == null)
|
||||||
|
{
|
||||||
|
_deleteSettingsCommand = new DelegatingCommand(
|
||||||
|
param => DoDeleteSettings(),
|
||||||
|
param => CanDeleteSettings());
|
||||||
|
}
|
||||||
|
return _deleteSettingsCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public DelegatingCommand CopySettingsCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_copySettingsCommand == null)
|
||||||
|
{
|
||||||
|
_copySettingsCommand = new DelegatingCommand(
|
||||||
|
param => DoCopySettings());
|
||||||
|
}
|
||||||
|
return _copySettingsCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public DelegatingCommand ResetSettingsCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_resetSettingsCommand == null)
|
||||||
|
{
|
||||||
|
_resetSettingsCommand = new DelegatingCommand(
|
||||||
|
param => DoResetSettings());
|
||||||
|
}
|
||||||
|
return _resetSettingsCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Messages
|
||||||
|
|
||||||
|
Message<ViewModelMessageContent> EditSettingsMessage
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_editSettingsMessage == null)
|
||||||
|
{
|
||||||
|
_editSettingsMessage = new Message<ViewModelMessageContent>();
|
||||||
|
}
|
||||||
|
return _editSettingsMessage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Message<ViewModelMessageContent> UseSettingsMessage
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_useSettingsMessage == null)
|
||||||
|
{
|
||||||
|
_useSettingsMessage = new Message<ViewModelMessageContent>();
|
||||||
|
}
|
||||||
|
return _useSettingsMessage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Message<ViewModelMessageContent> ConfirmDeleteSettingsMessage
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_confirmDeleteSettingsMessage == null)
|
||||||
|
{
|
||||||
|
_confirmDeleteSettingsMessage = new Message<ViewModelMessageContent>();
|
||||||
|
}
|
||||||
|
return _confirmDeleteSettingsMessage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Message<ViewModelMessageContent> ConfirmResetSettingsMessage
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_confirmResetSettingsMessage == null)
|
||||||
|
{
|
||||||
|
_confirmResetSettingsMessage = new Message<ViewModelMessageContent>();
|
||||||
|
}
|
||||||
|
return _confirmResetSettingsMessage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
public SettingsRepositoryViewModel(SettingsRepository repository)
|
||||||
|
{
|
||||||
|
_repository = repository;
|
||||||
|
SettingsList = new List<SettingsViewModel>();
|
||||||
|
foreach (Settings s in repository.SettingsList)
|
||||||
|
{
|
||||||
|
SettingsViewModel vm = new SettingsViewModel(s);
|
||||||
|
AddSettingsViewModel(vm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Private methods
|
||||||
|
|
||||||
|
void DoEditSettings()
|
||||||
|
{
|
||||||
|
if (CanEditSettings())
|
||||||
|
{
|
||||||
|
EditSettingsMessage.Send(new ViewModelMessageContent(Selected));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CanEditSettings()
|
||||||
|
{
|
||||||
|
return Selected != null && !IsDefaultSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoUseSettings()
|
||||||
|
{
|
||||||
|
UseSettingsMessage.Send(new ViewModelMessageContent(Selected));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CanUseSettings()
|
||||||
|
{
|
||||||
|
return Selected != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoAddSettings()
|
||||||
|
{
|
||||||
|
Settings s = new Settings("Neu");
|
||||||
|
SettingsViewModel vm = new SettingsViewModel(s);
|
||||||
|
_repository.SettingsList.Add(s);
|
||||||
|
SettingsList.Add(vm);
|
||||||
|
vm.IsSelected = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CanDeleteSettings()
|
||||||
|
{
|
||||||
|
return Selected != null && !IsDefaultSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoDeleteSettings()
|
||||||
|
{
|
||||||
|
if (CanDeleteSettings())
|
||||||
|
{
|
||||||
|
ConfirmDeleteSettingsMessage.Send(
|
||||||
|
new ViewModelMessageContent(Selected),
|
||||||
|
param => ConfirmDeleteSettings(param));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfirmDeleteSettings(ViewModelMessageContent content)
|
||||||
|
{
|
||||||
|
SettingsViewModel vm = content.ViewModel as SettingsViewModel;
|
||||||
|
if (CanDeleteSettings() && content.Confirmed)
|
||||||
|
{
|
||||||
|
_repository.SettingsList.Remove(vm.RevealModelObject() as Settings);
|
||||||
|
SettingsList.Remove(vm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoResetSettings()
|
||||||
|
{
|
||||||
|
ConfirmResetSettingsMessage.Send(
|
||||||
|
new ViewModelMessageContent(this),
|
||||||
|
param => ConfirmResetSettings(param));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfirmResetSettings(ViewModelMessageContent content)
|
||||||
|
{
|
||||||
|
if (content.Confirmed)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoCopySettings()
|
||||||
|
{
|
||||||
|
if (Selected != null)
|
||||||
|
{
|
||||||
|
SettingsViewModel copy = Selected.Clone() as SettingsViewModel;
|
||||||
|
_repository.SettingsList.Add(copy.RevealModelObject() as Settings);
|
||||||
|
AddSettingsViewModel(copy);
|
||||||
|
Selected.IsSelected = false;
|
||||||
|
copy.IsSelected = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SettingsViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
SettingsViewModel vm = sender as SettingsViewModel;
|
||||||
|
if (vm != null && e.PropertyName == "IsSelected")
|
||||||
|
{
|
||||||
|
Selected = vm.IsSelected ? vm : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the selected SettingsViewModel belongs
|
||||||
|
/// to one of the default settings.
|
||||||
|
/// </summary>
|
||||||
|
bool IsDefaultSettings()
|
||||||
|
{
|
||||||
|
if (Selected != null)
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(Selected.Name == zaaReloaded2.Properties.Settings.Default.SettingsNameClinic
|
||||||
|
|| Selected.Name == zaaReloaded2.Properties.Settings.Default.SettingsNameWard);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a settings view model to the collection and wires the
|
||||||
|
/// PropertyChanged event.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="settingsViewModel">SettingsViewModel to add.</param>
|
||||||
|
void AddSettingsViewModel(SettingsViewModel settingsViewModel)
|
||||||
|
{
|
||||||
|
settingsViewModel.PropertyChanged += SettingsViewModel_PropertyChanged;
|
||||||
|
SettingsList.Add(settingsViewModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Implementation of ViewModelBase
|
||||||
|
|
||||||
|
public override object RevealModelObject()
|
||||||
|
{
|
||||||
|
return _repository;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
SettingsRepository _repository;
|
||||||
|
DelegatingCommand _useSettingsCommand;
|
||||||
|
DelegatingCommand _addSettingsCommand;
|
||||||
|
DelegatingCommand _editSettingsCommand;
|
||||||
|
DelegatingCommand _deleteSettingsCommand;
|
||||||
|
DelegatingCommand _resetSettingsCommand;
|
||||||
|
DelegatingCommand _copySettingsCommand;
|
||||||
|
Message<ViewModelMessageContent> _confirmDeleteSettingsMessage;
|
||||||
|
Message<ViewModelMessageContent> _confirmResetSettingsMessage;
|
||||||
|
Message<ViewModelMessageContent> _editSettingsMessage;
|
||||||
|
Message<ViewModelMessageContent> _useSettingsMessage;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
@ -22,6 +22,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Bovender.Mvvm;
|
using Bovender.Mvvm;
|
||||||
using Bovender.Mvvm.ViewModels;
|
using Bovender.Mvvm.ViewModels;
|
||||||
|
using Bovender.Mvvm.Messaging;
|
||||||
using zaaReloaded2.Controller;
|
using zaaReloaded2.Controller;
|
||||||
using zaaReloaded2.Controller.Elements;
|
using zaaReloaded2.Controller.Elements;
|
||||||
using zaaReloaded2.Formatter;
|
using zaaReloaded2.Formatter;
|
||||||
@ -31,7 +32,7 @@ namespace zaaReloaded2.ViewModels
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// View model for the zaaReloaded2.Controller.Settings class.
|
/// View model for the zaaReloaded2.Controller.Settings class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class SettingsViewModel : ViewModelBase
|
public class SettingsViewModel : ViewModelBase, ICloneable
|
||||||
{
|
{
|
||||||
#region Properties
|
#region Properties
|
||||||
|
|
||||||
@ -161,6 +162,20 @@ namespace zaaReloaded2.ViewModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DelegatingCommand AddChildElementCommand
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_addChildElementCommand == null)
|
||||||
|
{
|
||||||
|
_addChildElementCommand = new DelegatingCommand(
|
||||||
|
param => DoAddChildElement(),
|
||||||
|
param => CanAddChildElement());
|
||||||
|
}
|
||||||
|
return _addChildElementCommand;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public DelegatingCommand DeleteElementCommand
|
public DelegatingCommand DeleteElementCommand
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -191,10 +206,31 @@ namespace zaaReloaded2.ViewModels
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Public methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wires the OnProperty changed event of an ElementViewModel's
|
||||||
|
/// wrapped model and adds the view model to the Elements collection.
|
||||||
|
/// </summary>
|
||||||
|
public void AddElementViewModel(ElementViewModel elementViewModel)
|
||||||
|
{
|
||||||
|
elementViewModel.PropertyChanged += ElementViewModel_PropertyChanged;
|
||||||
|
Elements.Add(elementViewModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Private methods
|
#region Private methods
|
||||||
|
|
||||||
void DoAddElement() { }
|
void DoAddElement() { }
|
||||||
|
|
||||||
|
void DoAddChildElement() { }
|
||||||
|
|
||||||
|
bool CanAddChildElement()
|
||||||
|
{
|
||||||
|
return SelectedElement is ControlElementViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
void DoDeleteElement() { }
|
void DoDeleteElement() { }
|
||||||
|
|
||||||
bool CanDeleteElement() { return _selectedElement != null; }
|
bool CanDeleteElement() { return _selectedElement != null; }
|
||||||
@ -203,17 +239,6 @@ namespace zaaReloaded2.ViewModels
|
|||||||
|
|
||||||
bool CanCopyElement() { return _selectedElement != null; }
|
bool CanCopyElement() { return _selectedElement != null; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Internal function that creates wires the OnProperty changed event
|
|
||||||
/// of an ElementViewModel's wrapped model and adds the view model
|
|
||||||
/// to the Elements collection.
|
|
||||||
/// </summary>
|
|
||||||
void AddElementViewModel(ElementViewModel elementViewModel)
|
|
||||||
{
|
|
||||||
elementViewModel.PropertyChanged += ElementViewModel_PropertyChanged;
|
|
||||||
Elements.Add(elementViewModel);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets or unsets the SelectedElement property whenever the IsSelected
|
/// Sets or unsets the SelectedElement property whenever the IsSelected
|
||||||
/// property of an ElementViewModel changes.
|
/// property of an ElementViewModel changes.
|
||||||
@ -238,12 +263,23 @@ namespace zaaReloaded2.ViewModels
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Implementation of ICloneable
|
||||||
|
|
||||||
|
public object Clone()
|
||||||
|
{
|
||||||
|
return new SettingsViewModel(_settings.Clone() as Settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Fields
|
#region Fields
|
||||||
|
|
||||||
Settings _settings;
|
Settings _settings;
|
||||||
DelegatingCommand _addElementCommand;
|
DelegatingCommand _addElementCommand;
|
||||||
|
DelegatingCommand _addChildElementCommand;
|
||||||
DelegatingCommand _deleteElementCommand;
|
DelegatingCommand _deleteElementCommand;
|
||||||
DelegatingCommand _copyElementCommand;
|
DelegatingCommand _copyElementCommand;
|
||||||
|
|
||||||
List<ElementViewModel> _elements;
|
List<ElementViewModel> _elements;
|
||||||
ElementViewModel _selectedElement;
|
ElementViewModel _selectedElement;
|
||||||
EnumProvider<ReferenceStyle> _referenceStyle;
|
EnumProvider<ReferenceStyle> _referenceStyle;
|
||||||
|
@ -219,9 +219,12 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Updater\Updater.cs" />
|
<Compile Include="Updater\Updater.cs" />
|
||||||
<Compile Include="ViewModels\AboutViewModel.cs" />
|
<Compile Include="ViewModels\AboutViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\CategoryViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\ElementPickerViewModel.cs" />
|
||||||
<Compile Include="ViewModels\ElementViewModel.cs" />
|
<Compile Include="ViewModels\ElementViewModel.cs" />
|
||||||
<Compile Include="ViewModels\FormatElementViewModel.cs" />
|
<Compile Include="ViewModels\FormatElementViewModel.cs" />
|
||||||
<Compile Include="ViewModels\ControlElementViewModel.cs" />
|
<Compile Include="ViewModels\ControlElementViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\SettingsRepositoryViewModel.cs" />
|
||||||
<Compile Include="Views\AboutView.xaml.cs">
|
<Compile Include="Views\AboutView.xaml.cs">
|
||||||
<DependentUpon>AboutView.xaml</DependentUpon>
|
<DependentUpon>AboutView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
Loading…
Reference in New Issue
Block a user