From 285c6a25553725e5a7379521020bb7bd45914bf4 Mon Sep 17 00:00:00 2001 From: Daniel Kraus Date: Tue, 4 Aug 2015 23:26:21 +0200 Subject: [PATCH] Add CanRun property to Formatter. --- zaaReloaded2/Formatter/Formatter.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/zaaReloaded2/Formatter/Formatter.cs b/zaaReloaded2/Formatter/Formatter.cs index 86fae29..cb2724f 100755 --- a/zaaReloaded2/Formatter/Formatter.cs +++ b/zaaReloaded2/Formatter/Formatter.cs @@ -64,6 +64,12 @@ namespace zaaReloaded2.Formatter /// public Dictionary WorkingTimePoints { get; private set; } + /// + /// Is true if this Formatter object carries a Laboratory with + /// at least one time point. + /// + public bool CanRun { get { return Laboratory.TimePoints.Count > 0; } } + #endregion #region Constructors @@ -113,6 +119,8 @@ namespace zaaReloaded2.Formatter /// current position of the cursor). public void Run() { + if (!CanRun) throw new InvalidOperationException("No laboratory data to format."); + int current = 0; while (current < Settings.Elements.Count) {