public override Xamarin.Forms.Animation CreateReverseAnimation() { double A = 0, R = 0, G = 0, B = 0; var Parent = new Xamarin.Forms.Animation((d) => Target.GetType().GetProperty(PropertyName).SetValue(Target, Xamarin.Forms.Color.FromRgba(R, G, B, A)), 0, 1, AnimationEasing); Parent.Add(0, 1, new Xamarin.Forms.Animation(d => { A = d; }, Xamarin.Forms.Color.FromHex(EndValue.ToString()).A, Xamarin.Forms.Color.FromHex(StartValue.ToString()).A)); Parent.Add(0, 1, new Xamarin.Forms.Animation(d => { R = d; }, Xamarin.Forms.Color.FromHex(EndValue.ToString()).R, Xamarin.Forms.Color.FromHex(StartValue.ToString()).R)); Parent.Add(0, 1, new Xamarin.Forms.Animation(d => { G = d; }, Xamarin.Forms.Color.FromHex(EndValue.ToString()).G, Xamarin.Forms.Color.FromHex(StartValue.ToString()).G)); Parent.Add(0, 1, new Xamarin.Forms.Animation(d => { B = d; }, Xamarin.Forms.Color.FromHex(EndValue.ToString()).B, Xamarin.Forms.Color.FromHex(StartValue.ToString()).B)); return(Parent); }
public string this[string columnName] { get { string error = null; switch (columnName) { case "TagName": error = ValidateStringCannotBeNull(columnName, TagName); break; case "Value": if (ShowEndValue) { error = ValidateStringCannotBeNull(columnName, Value?.ToString() ?? string.Empty); } break; case "EndValue": error = ValidateStringCannotBeNull(columnName, EndValue?.ToString() ?? string.Empty); break; default: throw new ArgumentException(ErrorResource.UnexpectedPropertyName, columnName); } return(error); } }
/// <summary> /// OnParametersSet 方法 /// </summary> protected override void OnParametersSet() { base.OnParametersSet(); Value ??= new DateTimeRangeValue(); StartValue = Value.Start; EndValue = Value.End; if (StartValue == DateTime.MinValue) { StartValue = DateTime.Now; } if (EndValue == DateTime.MinValue) { EndValue = StartValue.AddMonths(1); } SelectedValue.Start = StartValue; SelectedValue.End = EndValue; StartPlaceHolderText ??= Localizer[nameof(StartPlaceHolderText)]; EndPlaceHolderText ??= Localizer[nameof(EndPlaceHolderText)]; SeparateText ??= Localizer[nameof(SeparateText)]; ClearButtonText ??= Localizer[nameof(ClearButtonText)]; ConfirmButtonText ??= Localizer[nameof(ConfirmButtonText)]; TodayButtonText ??= Localizer[nameof(TodayButtonText)]; DateFormat ??= Localizer[nameof(DateFormat)]; if (StartValue.ToString("yyyy-MM") == EndValue.ToString("yyyy-MM")) { StartValue = StartValue.AddMonths(-1); } if (SidebarItems == null) { SidebarItems = new DateTimeRangeSidebarItem[] { new DateTimeRangeSidebarItem { Text = Localizer["Last7Days"], StartDateTime = DateTime.Today.AddDays(-7), EndDateTime = DateTime.Today }, new DateTimeRangeSidebarItem { Text = Localizer["Last30Days"], StartDateTime = DateTime.Today.AddDays(-30), EndDateTime = DateTime.Today }, new DateTimeRangeSidebarItem { Text = Localizer["ThisMonth"], StartDateTime = DateTime.Today.AddDays(1 - DateTime.Today.Day), EndDateTime = DateTime.Today.AddDays(1 - DateTime.Today.Day).AddMonths(1).AddDays(-1) }, new DateTimeRangeSidebarItem { Text = Localizer["LastMonth"], StartDateTime = DateTime.Today.AddDays(1 - DateTime.Today.Day).AddMonths(-1), EndDateTime = DateTime.Today.AddDays(1 - DateTime.Today.Day).AddDays(-1) }, }; } }
public override string ToString() { var s = StartValue.ToString(); var e = EndValue.ToString(); if (IsRange) { return(s + RangeDelimiter + e); } if (EndValue.Status != DateStatus.Unknown && string.IsNullOrEmpty(e)) { return(s); } return(s + IntervalDelimiter + e); }
public string ToLogString() { var sb = new StringBuilder() .AppendLine($"[{nameof(ParametersPack)}]") .AppendLine($"AnalysisProgramName: '{AnalysisProgramName}'") .AppendLine($"AlgorithmType: {AlgorithmType.ToLogString()}") .AppendLine($"StartValue: '{StartValue.ToString()}'") .AppendLine($"EndValue: '{EndValue.ToString()}'") .AppendLine($"ExtrapolationSegmentValue: '{ExtrapolationSegmentValue.ToString()}'") .AppendLine($"LaunchesNumber: '{LaunchesNumber.ToString()}'") .AppendLine($"Step: '{Step.ToString()}'") .AppendLine($"OutputFilenamePattern: '{OutputFilenamePattern}'") .AppendLine($"CommonAnalysisFilenameSuffix: '{CommonAnalysisFilenameSuffix}'") .AppendLine($"OutputFileExtension: '{OutputFileExtension}'"); return(sb.ToString()); }
public override void Validate() { base.Validate(); _structStartValues = StartValue.ToString().Split(','); _structEndValues = EndValue.ToString().Split(','); foreach (var startValue in _structStartValues) { if (!double.TryParse(startValue.ToString(), out double _)) { throw new Exception($"Invalid {nameof(StartValue)}."); } } foreach (var endValue in _structEndValues) { if (!double.TryParse(endValue.ToString(), out double _)) { throw new Exception($"Invalid {nameof(EndValue)}."); } } if (_structStartValues.Length != _structEndValues.Length) { throw new Exception($"{nameof(StartValue)} and {nameof(EndValue)} has different structure."); } switch (_structStartValues.Length) { case 1: case 2: case 4: break; default: throw new Exception($"Supported formats are 'double', 'double,double' and 'double,double,double,double'."); } }
/// <summary> /// 속성 중 Attribute Node로 표현해야 한다. /// </summary> /// <param name="writer"></param> public override void GenerateXmlAttributes(XmlWriter writer) { base.GenerateXmlAttributes(writer); if (StartValue.HasValue) { writer.WriteAttributeString("startValue", StartValue.ToString()); } if (EndValue.HasValue) { writer.WriteAttributeString("endValue", EndValue.ToString()); } if (ShowOnTop.HasValue) { writer.WriteAttributeString("showOnTop", ShowOnTop.GetHashCode().ToString()); } if (ValueOnRight.HasValue) { writer.WriteAttributeString("valueOnRight", ValueOnRight.GetHashCode().ToString()); } }
/// <summary> /// Export to XML document /// </summary> /// <param name="doc">xml document</param> /// <param name="parent">parent xml element</param> public override void ExportToXML(ref XmlDocument doc, XmlElement parent) { XmlElement brk = doc.CreateElement("Break"); XmlAttribute caption = doc.CreateAttribute("Caption"); XmlAttribute startValue = doc.CreateAttribute("StartValue"); XmlAttribute endValue = doc.CreateAttribute("EndValue"); XmlAttribute color = doc.CreateAttribute("Color"); XmlAttribute isNoData = doc.CreateAttribute("IsNoData"); caption.InnerText = Caption; startValue.InnerText = StartValue.ToString(); endValue.InnerText = EndValue.ToString(); color.InnerText = ColorTranslator.ToHtml(Color); isNoData.InnerText = IsNoData.ToString(); brk.Attributes.Append(caption); brk.Attributes.Append(startValue); brk.Attributes.Append(endValue); brk.Attributes.Append(color); brk.Attributes.Append(isNoData); parent.AppendChild(brk); }
public string this[string columnName] { get { string error = null; switch (columnName) { case "TagName": error = ValidateStringCannotBeNull(columnName, TagName); break; case "Value": if (ShowEndValue) { error = ValidateStringCannotBeNull(columnName, Value == null ? string.Empty : Value.ToString()); } break; case "EndValue": error = ValidateStringCannotBeNull(columnName, EndValue == null ? string.Empty : EndValue.ToString()); break; default: throw new ArgumentException(@"Unexpected property name encountered", columnName); } return(error); } }
/// <summary> /// 속성들을 Xml Attribute로 생성합니다. /// </summary> /// <param name="writer">Attribute를 쓸 Writer</param> public override void GenerateXmlAttributes(XmlWriter writer) { base.GenerateXmlAttributes(writer); if (StartValue.HasValue) { writer.WriteAttributeString("StartValue", StartValue.ToString()); } if (EndValue.HasValue) { writer.WriteAttributeString("EndValue", EndValue.ToString()); } if (DisplayValue.IsNotWhiteSpace()) { writer.WriteAttributeString("DisplayValue", DisplayValue); } if (ValueInside.HasValue) { writer.WriteAttributeString("ValueInside", ValueInside.GetHashCode().ToString()); } if (Color.HasValue) { writer.WriteAttributeString("Color", Color.Value.ToHexString()); } if (Thickness.HasValue) { writer.WriteAttributeString("Thickness", Thickness.ToString()); } if (ShowBorder.HasValue) { writer.WriteAttributeString("ShowBorder", ShowBorder.GetHashCode().ToString()); } if (BorderColor.HasValue) { writer.WriteAttributeString("BorderColor", BorderColor.Value.ToHexString()); } if (Radius.HasValue) { writer.WriteAttributeString("Radius", Radius.ToString()); } if (InnerRadius.HasValue) { writer.WriteAttributeString("InnerRadius", InnerRadius.ToString()); } if (Dashed.HasValue) { writer.WriteAttributeString("Dashed", Dashed.GetHashCode().ToString()); } if (DashLen.HasValue) { writer.WriteAttributeString("DashLen", DashLen.ToString()); } if (DashGap.HasValue) { writer.WriteAttributeString("DashGap", DashGap.ToString()); } if (UseMarker.HasValue) { writer.WriteAttributeString("UseMarker", UseMarker.GetHashCode().ToString()); } if (MarkerColor.HasValue) { writer.WriteAttributeString("MarkerColor", MarkerColor.Value.ToHexString()); } if (MarkerBorderColor.HasValue) { writer.WriteAttributeString("MarkerBorderColor", MarkerBorderColor.Value.ToHexString()); } if (MarkerRadius.HasValue) { writer.WriteAttributeString("MarkerRadius", MarkerRadius.ToString()); } if (MarkerTooltext.IsNotWhiteSpace()) { writer.WriteAttributeString("MarkerTooltext", MarkerTooltext); } }