protected override void OnContentChanged()
 {
     base.OnContentChanged();
     SuppressEvents = true;
     try {
         if (Content == null)
         {
             timeLimitTextBox.Text = TimeSpanHelper.FormatNatural(TimeSpan.FromSeconds(60));
             snapshotsTextBox.Text = String.Empty;
             storeAlgorithmInEachSnapshotCheckBox.Checked = false;
             algorithmViewHost.Content = null;
             snapshotsView.Content     = null;
             runsView.Content          = null;
         }
         else
         {
             timeLimitTextBox.Text = TimeSpanHelper.FormatNatural(Content.MaximumExecutionTime);
             snapshotsTextBox.Text = String.Join(" ; ", Content.SnapshotTimes.Select(x => TimeSpanHelper.FormatNatural(x, true)));
             storeAlgorithmInEachSnapshotCheckBox.Checked = Content.StoreAlgorithmInEachSnapshot;
             algorithmViewHost.Content = Content.Algorithm;
             snapshotsView.Content     = Content.Snapshots;
             runsView.Content          = Content.Runs;
         }
     } finally { SuppressEvents = false; }
 }
        private void Content_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            switch (e.PropertyName)
            {
            case "MaximumExecutionTime":
                SuppressEvents = true;
                try {
                    timeLimitTextBox.Text = TimeSpanHelper.FormatNatural(Content.MaximumExecutionTime);
                } finally { SuppressEvents = false; }
                break;

            case "SnapshotTimes":
                SuppressEvents = true;
                try {
                    if (Content.SnapshotTimes.Any())
                    {
                        snapshotsTextBox.Text = String.Join(" ; ", Content.SnapshotTimes.Select(x => TimeSpanHelper.FormatNatural(x, true)));
                    }
                    else
                    {
                        snapshotsTextBox.Text = String.Empty;
                    }
                    Content.SnapshotTimes.ItemsAdded      += Content_SnapshotTimes_Changed;
                    Content.SnapshotTimes.ItemsMoved      += Content_SnapshotTimes_Changed;
                    Content.SnapshotTimes.ItemsRemoved    += Content_SnapshotTimes_Changed;
                    Content.SnapshotTimes.ItemsReplaced   += Content_SnapshotTimes_Changed;
                    Content.SnapshotTimes.CollectionReset += Content_SnapshotTimes_Changed;
                } finally { SuppressEvents = false; }
                break;

            case "StoreAlgorithmInEachSnapshot":
                SuppressEvents = true;
                try {
                    storeAlgorithmInEachSnapshotCheckBox.Checked = Content.StoreAlgorithmInEachSnapshot;
                } finally { SuppressEvents = false; }
                break;

            case "Algorithm":
                SuppressEvents = true;
                try {
                    algorithmViewHost.Content = Content.Algorithm;
                } finally { SuppressEvents = false; }
                break;

            case "Snapshots":
                SuppressEvents = true;
                try {
                    snapshotsView.Content = Content.Snapshots;
                } finally { SuppressEvents = false; }
                break;

            case "Runs":
                SuppressEvents = true;
                try {
                    runsView.Content = Content.Runs;
                } finally { SuppressEvents = false; }
                break;
            }
        }
 private void DefineArithmeticTimeSpanProgressionDialog_Load(object sender, System.EventArgs e)
 {
     minimumTextBox.Text  = TimeSpanHelper.FormatNatural(Minimum, true);
     maximumTextBox.Text  = TimeSpanHelper.FormatNatural(Maximum, true);
     stepSizeTextBox.Text = TimeSpanHelper.FormatNatural(Step, true);
 }
 private void Content_SnapshotTimes_Changed(object sender, EventArgs e)
 {
     SuppressEvents = true;
     try {
         if (Content.SnapshotTimes.Any())
         {
             snapshotsTextBox.Text = string.Join(" ; ", Content.SnapshotTimes.Select(x => TimeSpanHelper.FormatNatural(x, true)));
         }
         else
         {
             snapshotsTextBox.Text = String.Empty;
         }
     } finally { SuppressEvents = false; }
 }