Create new namespace zaaReloaded2.Formatter, move settings there.

This commit is contained in:
Daniel Kraus
2015-07-16 01:49:17 +02:00
parent 26766dbf81
commit e4e7f80ed2
8 changed files with 86 additions and 64 deletions

View File

@ -19,37 +19,28 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Interop.Word;
using zaaReloaded2.Formatter.Elements;
using zaaReloaded2.LabModel;
using System.Diagnostics;
using Microsoft.Office.Interop.Word;
using zaaReloaded2.LabModel;
using zaaReloaded2.Controller;
using zaaReloaded2.Controller.Elements;
namespace zaaReloaded2.Formatter
{
/// <summary>
/// Formats and writes a <see cref="Laboratory"/> to a Word document.
/// </summary>
[Serializable]
class Formatter
public class Formatter
{
#region Properties
/// <summary>
/// Gets a list of formatting elements (derived from
/// <see cref="ElementBase"/>).
/// </summary>
public ElementsList Elements { get; private set; }
public Settings Settings { get; set; }
/// <summary>
/// Gets the working Word document.
/// </summary>
public Document Document { get; private set; }
/// <summary>
/// Gets or sets the style of the normal range reference.
/// </summary>
public ReferenceStyle ReferenceStyle { get; set; }
/// <summary>
/// Gets or sets the <see cref="Laboratory"/> that shall be
/// formatted.
@ -67,7 +58,8 @@ namespace zaaReloaded2.Formatter
_timePointFormatters = new TimePointFormatterDictionary();
foreach (TimePoint tp in _laboratory.TimePoints.Values)
{
_timePointFormatters[tp.TimeStamp] = new TimePointFormatter(tp, ReferenceStyle);
_timePointFormatters[tp.TimeStamp] =
new TimePointFormatter(tp, Settings.ReferenceStyle);
}
}
}
@ -83,7 +75,7 @@ namespace zaaReloaded2.Formatter
public Formatter()
{
Elements = new ElementsList();
Settings = new Settings();
}
public Formatter(Document document)
@ -104,7 +96,7 @@ namespace zaaReloaded2.Formatter
public void Run()
{
WorkingTimePoints = _timePointFormatters;
foreach (ElementBase element in Elements)
foreach (ElementBase element in Settings.Elements)
{
element.Run(this);
}