Create rudimentary view models, default settings.

This commit is contained in:
Daniel Kraus
2015-07-31 17:19:49 +02:00
parent a725246f27
commit 12cd58180f
21 changed files with 937 additions and 43 deletions

View File

@ -31,17 +31,18 @@ namespace zaaReloaded2.Controller.Elements
/// to a Word document.
/// </summary>
[Serializable]
class Items : FormatElementBase
class Items : CustomText
{
#region ElementBase implementation
public override string Label
{
get { return Line; }
get { return Content; }
}
public override void Run(zaaReloaded2.Formatter.Formatter formatter)
{
ParseLine();
if (_items == null || _items.Count == 0) return;
bool _needComma = false;
@ -75,37 +76,14 @@ namespace zaaReloaded2.Controller.Elements
#endregion
#region Properties
/// <summary>
/// Gets or sets a text line that contains a comma-separated list of
/// parsable laboratory item names. The list may optionally be preceded
/// with a caption followed by a colon.
/// </summary>
public string Line
{
[DebuggerStepThrough]
get
{
return _line;
}
set
{
_line = value;
ParseLine();
}
}
#endregion
#region Constructors
public Items() : base() { }
public Items(string line)
public Items(string content)
: this()
{
Line = line;
Content = content;
}
#endregion
@ -121,7 +99,7 @@ namespace zaaReloaded2.Controller.Elements
_items = null;
_caption = null;
Regex r = new Regex(@"((?<caption>[^:]+):\s*)?((?<items>[^,]+),\s*)*(?<items>[^,]+)");
Match m = r.Match(Line);
Match m = r.Match(Content);
if (m.Success)
{
if (m.Groups["caption"].Success)
@ -203,7 +181,6 @@ namespace zaaReloaded2.Controller.Elements
#region Fields
string _line;
string _caption;
List<string> _items;
static Regex _wildcard = new Regex(@"(?<material>[^-]+-)?\*");