Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/DateTimeJsonItem.cs @ 17530

Last change on this file since 17530 was 17519, checked in by dpiringe, 5 years ago

#3026:

  • added error output for failed runner initialization
  • reorganised some final view models
  • TargetedJsonItemType (in JsonItemVMBase) now automatically returns the type of the defined JsonItem
  • code cleanup
  • refactored RegressionProblemDataConverter
  • added lots of comments
  • added new view for StringArrayJsonItem
  • added new UI component for concrete restricted items and used it in JsonItemConcreteItemArrayControl and JsonItemValidValuesControl
File size: 668 bytes
Line 
1using System;
2using Newtonsoft.Json.Linq;
3
4namespace HeuristicLab.JsonInterface {
5  public class DateTimeJsonItem : IntervalRestrictedValueJsonItem<DateTime> {
6   
7    public override JObject GenerateJObject() {
8      var obj = base.GenerateJObject();
9
10      if (Minimum.CompareTo(DateTime.MinValue) == 0)
11        obj.Property("Minimum").Remove();
12
13      if (Maximum.CompareTo(DateTime.MaxValue) == 0)
14        obj.Property("Maximum").Remove();
15
16      return obj;
17    }
18
19    public override void SetJObject(JObject jObject) {
20      Minimum = DateTime.MinValue;
21      Maximum = DateTime.MaxValue;
22      base.SetJObject(jObject);
23    }
24  }
25}
Note: See TracBrowser for help on using the repository browser.