public void EqualWithFromEqualAndToDurationUnequalShouldReturnFalse() { // Arrange var from = new DateTime(1111); var to1 = new DateTime(3333); var to2 = new DateTime(4444); var p1 = new Period(from, to1); var p2 = new Period(from, to2); // Act bool condition1 = p1.Equals((object)p2); bool condition2 = p1.Equals(p2); bool condition3 = Period.Equals(p1, p2); bool condition4 = p1 == p2; // Assert Assert.IsFalse(condition1); Assert.IsFalse(condition2); Assert.IsFalse(condition3); Assert.IsFalse(condition4); }
public void EqualWithDurationEqualAndFromToUnequalShouldReturnFalse() { // Arrange var from1 = new DateTime(1111); var from2 = new DateTime(2222); var duration = new TimeSpan(3333); var p1 = new Period(from1, duration); var p2 = new Period(from2, duration); // Act bool condition1 = p1.Equals((object)p2); bool condition2 = p1.Equals(p2); bool condition3 = Period.Equals(p1, p2); bool condition4 = p1 == p2; // Assert Assert.IsFalse(condition1); Assert.IsFalse(condition2); Assert.IsFalse(condition3); Assert.IsFalse(condition4); }
public void Period_DoesNotEqualDifferentPeriod() { var firstPeriod = new Period(new DateTime(2010, 1, 1), new DateTime(2010, 1, 31)); var secondPeriod = new Period(new DateTime(2009, 1, 1), new DateTime(2010, 1, 31)); Assert.False(firstPeriod.Equals(secondPeriod)); Assert.False(((object)firstPeriod).Equals(secondPeriod)); Assert.False(firstPeriod.Equals(new object())); Assert.NotEqual(firstPeriod.GetHashCode(), secondPeriod.GetHashCode()); Assert.True(firstPeriod != secondPeriod); }
private bool CheckTimeAndPeriod() { if (_period.Equals(Period.PRE_MATCH) && _minSecMillisec.Any(x => (Int32.Parse(x.ToString())) > 0)) { return(false); } if (_period.Equals(Period.SECOND_HALF) && !(Int32.Parse(_minSecMillisec[MINUTE].ToString()) >= 45)) { return(false); } return(true); }
public bool Equals(DestinyPostGameCarnageReportData input) { if (input == null) { return(false); } return (( Period == input.Period || (Period != null && Period.Equals(input.Period)) ) && ( StartingPhaseIndex == input.StartingPhaseIndex || (StartingPhaseIndex.Equals(input.StartingPhaseIndex)) ) && ( ActivityDetails == input.ActivityDetails || (ActivityDetails != null && ActivityDetails.Equals(input.ActivityDetails)) ) && ( Entries == input.Entries || (Entries != null && Entries.SequenceEqual(input.Entries)) ) && ( Teams == input.Teams || (Teams != null && Teams.SequenceEqual(input.Teams)) )); }
/// <summary> /// Return the strikes maintained by this matrix /// </summary> /// <returns></returns> public decimal[] GetStrikes() { if (dataPoints == null) { throw new ArgumentException("The matrix is malformed. No strikes available."); } // If we haven't collected the strikes then we should do so now // Once collected we can return them immediately if (_strike == null) { _strike = new List <decimal>(); Period tenor = null; // Loop through the points foreach (PricingStructurePoint p in dataPoints.point) { // Limit to only the first tenor if (tenor == null) { tenor = (Period)p.coordinate[0].term[0].Items[0]; } if (!tenor.Equals((Period)p.coordinate[0].term[0].Items[0])) { break; } // Add the next strike if (!_strike.Contains(p.coordinate[0].strike[0])) { _strike.Add(p.coordinate[0].strike[0]); } } } return(_strike.ToArray()); }
public void Equals_Null_ReturnsFalse() { var start = new DateTime(2018, 1, 1); var end = new DateTime(2018, 12, 31); var p1 = new Period(start, end); Assert.IsFalse(p1.Equals(null)); }
public void ValidationShouldPass() { string[] value = { "01.01.2000", "02.01.2000" }; var expectedResult = new Period(new DateTime(2000, 01, 01), new DateTime(2000, 01, 02)); var output = _inputProcessor.ProcessInput(value); Period.Equals(expectedResult, output); }
public void Period_EqualsSamePeriod() { var period = new Period(new DateTime(2010, 1, 1), new DateTime(2010, 1, 31)); Assert.True(period.Equals(period)); Assert.True(((object)period).Equals(period)); Assert.Equal(period.GetHashCode(), period.GetHashCode()); }
public void Equals_SamePeriods_ReturnsTrue() { var start = new DateTime(2018, 1, 1); var end = new DateTime(2018, 12, 31); Period p1 = new Period(start, end); Period p2 = new Period(start, end); Assert.IsTrue(p1.Equals(p2)); }
public void Equals_TwoDifferentPeriods_ReturnsFalse() { var start = new DateTime(2018, 1, 1); var end = new DateTime(2018, 12, 31); var p1 = new Period(start, end); var p2 = new Period(start, new DateTime(2018, 12, 30)); Assert.IsFalse(p1.Equals(p2)); }
/// <inheritdoc /> protected bool Equals(Orbit other) { return(MeanAnomoly.Equals(other.MeanAnomoly) && AscendingNode.Equals(other.AscendingNode) && ArgumentPerigee.Equals(other.ArgumentPerigee) && MeanMotion.Equals(other.MeanMotion) && RecoveredSemiMajorAxis.Equals(other.RecoveredSemiMajorAxis) && RecoveredMeanMotion.Equals(other.RecoveredMeanMotion) && Perigee.Equals(other.Perigee) && Apogee.Equals(other.Apogee) && Period.Equals(other.Period) && Epoch.Equals(other.Epoch) && BStar.Equals(other.BStar) && Eccentricity.Equals(other.Eccentricity) && Inclination.Equals(other.Inclination)); }
public void Period_EqualsEqualPeriod() { var firstPeriod = new Period(new DateTime(2010, 1, 1), new DateTime(2010, 1, 31)); var secondPeriod = new Period(new DateTime(2010, 1, 1), new DateTime(2010, 1, 31)); Assert.True(firstPeriod.Equals(secondPeriod)); Assert.True(((object)firstPeriod).Equals(secondPeriod)); Assert.Equal(firstPeriod.GetHashCode(), secondPeriod.GetHashCode()); Assert.True(firstPeriod == secondPeriod); }
Period GetCohesivePeriod(Period p1, Period p2, Period p3) { if (p1 != null && p1.Equals(p2) && p2.Equals(p3)) { return(p1); } else { return(null); } }
/// <summary> /// Returns true if ContactPoint instances are equal /// </summary> /// <param name="other">Instance of ContactPoint to be compared</param> /// <returns>Boolean</returns> public bool Equals(ContactPoint other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Uuid == other.Uuid || Uuid != null && Uuid.Equals(other.Uuid) ) && ( System == other.System || System != null && System.Equals(other.System) ) && ( Value == other.Value || Value != null && Value.Equals(other.Value) ) && ( Use == other.Use || Use != null && Use.Equals(other.Use) ) && ( Rank == other.Rank || Rank != null && Rank.Equals(other.Rank) ) && ( Period == other.Period || Period != null && Period.Equals(other.Period) ) && ( Creation == other.Creation || Creation != null && Creation.Equals(other.Creation) ) && ( LastUpdated == other.LastUpdated || LastUpdated != null && LastUpdated.Equals(other.LastUpdated) )); }
/// <summary> /// Returns true if Cost instances are equal /// </summary> /// <param name="other">Instance of Cost to be compared</param> /// <returns>Boolean</returns> public bool Equals(Cost other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Uuid == other.Uuid || Uuid != null && Uuid.Equals(other.Uuid) ) && ( Status == other.Status || Status != null && Status.Equals(other.Status) ) && ( HourPrice == other.HourPrice || HourPrice != null && HourPrice.Equals(other.HourPrice) ) && ( UsePrice == other.UsePrice || UsePrice != null && UsePrice.Equals(other.UsePrice) ) && ( Unit == other.Unit || Unit != null && Unit.Equals(other.Unit) ) && ( Period == other.Period || Period != null && Period.Equals(other.Period) ) && ( Creation == other.Creation || Creation != null && Creation.Equals(other.Creation) ) && ( LastUpdated == other.LastUpdated || LastUpdated != null && LastUpdated.Equals(other.LastUpdated) )); }
/// <summary> /// Checks if this tenor equals another tenor. /// <para> /// The comparison checks the tenor period. /// /// </para> /// </summary> /// <param name="obj"> the other tenor, null returns false </param> /// <returns> true if equal </returns> public override bool Equals(object obj) { if (obj == this) { return(true); } if (obj == null || this.GetType() != obj.GetType()) { return(false); } Tenor other = (Tenor)obj; return(period.Equals(other.period)); }
/// <summary> /// Returns true if ChartConfigBean instances are equal /// </summary> /// <param name="input">Instance of ChartConfigBean to be compared</param> /// <returns>Boolean</returns> public bool Equals(ChartConfigBean input) { if (input == null) { return(false); } return (( Id == input.Id || (Id != null && Id.Equals(input.Id)) ) && ( Name == input.Name || (Name != null && Name.Equals(input.Name)) ) && ( Title == input.Title || (Title != null && Title.Equals(input.Title)) ) && ( Icon == input.Icon || (Icon != null && Icon.Equals(input.Icon)) ) && ( Period == input.Period || (Period != null && Period.Equals(input.Period)) ) && ( Legend == input.Legend || (Legend != null && Legend.Equals(input.Legend)) ) && ( Items == input.Items || Items != null && Items.SequenceEqual(input.Items) ) && ( Axis == input.Axis || Axis != null && Axis.SequenceEqual(input.Axis) )); }
/// <summary> /// Returns true if Qualification instances are equal /// </summary> /// <param name="other">Instance of Qualification to be compared</param> /// <returns>Boolean</returns> public bool Equals(Qualification other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Uuid == other.Uuid || Uuid != null && Uuid.Equals(other.Uuid) ) && ( Code == other.Code || Code != null && Code.Equals(other.Code) ) && ( Text == other.Text || Text != null && Text.Equals(other.Text) ) && ( Period == other.Period || Period != null && Period.Equals(other.Period) ) && ( Issuer == other.Issuer || Issuer != null && Issuer.Equals(other.Issuer) ) && ( Creation == other.Creation || Creation != null && Creation.Equals(other.Creation) ) && ( LastUpdated == other.LastUpdated || LastUpdated != null && LastUpdated.Equals(other.LastUpdated) )); }
/// <summary> /// Returns true if OrgApacheSlingCommonsMetricsInternalLogReporterProperties instances are equal /// </summary> /// <param name="other">Instance of OrgApacheSlingCommonsMetricsInternalLogReporterProperties to be compared</param> /// <returns>Boolean</returns> public bool Equals(OrgApacheSlingCommonsMetricsInternalLogReporterProperties other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Period == other.Period || Period != null && Period.Equals(other.Period) ) && ( TimeUnit == other.TimeUnit || TimeUnit != null && TimeUnit.Equals(other.TimeUnit) ) && ( Level == other.Level || Level != null && Level.Equals(other.Level) ) && ( LoggerName == other.LoggerName || LoggerName != null && LoggerName.Equals(other.LoggerName) ) && ( Prefix == other.Prefix || Prefix != null && Prefix.Equals(other.Prefix) ) && ( Pattern == other.Pattern || Pattern != null && Pattern.Equals(other.Pattern) ) && ( RegistryName == other.RegistryName || RegistryName != null && RegistryName.Equals(other.RegistryName) )); }
/// <summary> /// Splits the time series into sub-series lasting sliceDuration.<br/> /// The current time series is split every splitDuration.<br/> /// The last sub-series may last less than sliceDuration. </summary> /// <param name="splitDuration"> the duration between 2 splits </param> /// <param name="sliceDuration"> the duration of each sub-series </param> /// <returns> a list of sub-series </returns> public virtual IList <TimeSeries> Split(Period splitDuration, Period sliceDuration) { var rc = new List <TimeSeries>(); if (splitDuration != null && !splitDuration.Equals(Period.Zero) && sliceDuration != null && !sliceDuration.Equals(Period.Zero)) { var beginIndexes = GetSplitBeginIndexes(splitDuration); foreach (var subseriesBegin in beginIndexes) { if (subseriesBegin != null) { rc.Add(Subseries(subseriesBegin.Value, sliceDuration)); } } } return(rc); }
/// <summary> /// Get the asset value at the expiry/tenor pair from the underlying grid /// </summary> /// <param name="expiry">The expiry term as an FpML Interval</param> /// <param name="tenor">The tenor term as an FpML Interval</param> /// <exception cref="ArgumentException">this exception is thrown if the expiry/tenor pair is invalid</exception> /// <returns></returns> public decimal GetAssetPrice(Period expiry, Period tenor) { foreach (PricingStructurePoint point in dataPoints.point) { Period intExp = (Period)point.coordinate[0].expiration[0].Items[0]; if (!expiry.Equals(intExp)) { continue; } Period intTen = (Period)point.coordinate[0].term[0].Items[0]; if (tenor.Equals(intTen)) { return(point.value); } } throw new ArgumentException("Invalid Expiry/Tenor pair supplied."); }
public void EqualObjectWithOtherObjectShouldReturnFalse() { // Arrange var from = new DateTime(1111); var to = new DateTime(3333); var period = new Period(from, to); // Act bool condition = period.Equals(new Object()); // Assert Assert.IsFalse(condition); }
static bool CheckPeriod(Instance a, Instance b) { Period periodA = null; Period periodB = null; if (a.Contexts != null && a.Contexts.Any()) { periodA = a.Contexts.First().Period; if (b.Contexts != null && b.Contexts.Any()) { periodB = b.Contexts.First().Period; } } return((periodA == null && periodB == null) || (periodA != null && periodA.Equals(periodB))); }
public bool Equals(DestinyHistoricalStatsPeriodGroup input) { if (input == null) { return(false); } return (( Period == input.Period || (Period != null && Period.Equals(input.Period)) ) && ( ActivityDetails == input.ActivityDetails || (ActivityDetails != null && ActivityDetails.Equals(input.ActivityDetails)) ) && ( Values == input.Values || (Values != null && Values.SequenceEqual(input.Values)) )); }
/// <summary>Indicates whether the current object is equal to another object of the same type.</summary> /// <returns>true if the current object is equal to the <paramref name="other" /> parameter; otherwise, false.</returns> /// <param name="other">An object to compare with this object.</param> public bool Equals(Alpha other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } if (Id == other.Id) { return(true); } return(Equals(Symbol, other.Symbol) && Direction == other.Direction && Type == other.Type && Confidence.Equals(other.Confidence) && Magnitude.Equals(other.Magnitude) && Period.Equals(other.Period)); }
/// <summary> /// Returns true if DutyTimes instances are equal /// </summary> /// <param name="other">Instance of DutyTimes to be compared</param> /// <returns>Boolean</returns> public bool Equals(DutyTimes other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Period == other.Period || Period != null && Period.Equals(other.Period) ) && ( RestTime == other.RestTime || RestTime.Equals(other.RestTime) )); }
private void UpdateCheckConflict(LocalTime timeToSet, Period periodToSet) { if (Time != java.time.temporal.TemporalAccessor_Fields.Null) { if (Time.Equals(timeToSet) == false) { throw new DateTimeException("Conflict found: Fields resolved to different times: " + Time + " " + timeToSet); } if (ExcessDays.Zero == false && periodToSet.Zero == false && ExcessDays.Equals(periodToSet) == false) { throw new DateTimeException("Conflict found: Fields resolved to different excess periods: " + ExcessDays + " " + periodToSet); } else { ExcessDays = periodToSet; } } else { Time = timeToSet; ExcessDays = periodToSet; } }
public bool Equals([AllowNull] AngularAxis other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return((Visible == other.Visible && Visible != null && other.Visible != null && Visible.Equals(other.Visible)) && (Type == other.Type && Type != null && other.Type != null && Type.Equals(other.Type)) && (CategoryOrder == other.CategoryOrder && CategoryOrder != null && other.CategoryOrder != null && CategoryOrder.Equals(other.CategoryOrder)) && (Equals(CategoryArray, other.CategoryArray) || CategoryArray != null && other.CategoryArray != null && CategoryArray.SequenceEqual(other.CategoryArray)) && (ThetaUnit == other.ThetaUnit && ThetaUnit != null && other.ThetaUnit != null && ThetaUnit.Equals(other.ThetaUnit)) && (Period == other.Period && Period != null && other.Period != null && Period.Equals(other.Period)) && (Direction == other.Direction && Direction != null && other.Direction != null && Direction.Equals(other.Direction)) && (Rotation == other.Rotation && Rotation != null && other.Rotation != null && Rotation.Equals(other.Rotation)) && (HoverFormat == other.HoverFormat && HoverFormat != null && other.HoverFormat != null && HoverFormat.Equals(other.HoverFormat)) && (UiRevision == other.UiRevision && UiRevision != null && other.UiRevision != null && UiRevision.Equals(other.UiRevision)) && (Color == other.Color && Color != null && other.Color != null && Color.Equals(other.Color)) && (ShowLine == other.ShowLine && ShowLine != null && other.ShowLine != null && ShowLine.Equals(other.ShowLine)) && (LineColor == other.LineColor && LineColor != null && other.LineColor != null && LineColor.Equals(other.LineColor)) && (LineWidth == other.LineWidth && LineWidth != null && other.LineWidth != null && LineWidth.Equals(other.LineWidth)) && (ShowGrid == other.ShowGrid && ShowGrid != null && other.ShowGrid != null && ShowGrid.Equals(other.ShowGrid)) && (GridColor == other.GridColor && GridColor != null && other.GridColor != null && GridColor.Equals(other.GridColor)) && (GridWidth == other.GridWidth && GridWidth != null && other.GridWidth != null && GridWidth.Equals(other.GridWidth)) && (TickMode == other.TickMode && TickMode != null && other.TickMode != null && TickMode.Equals(other.TickMode)) && (NTicks == other.NTicks && NTicks != null && other.NTicks != null && NTicks.Equals(other.NTicks)) && (Tick0 == other.Tick0 && Tick0 != null && other.Tick0 != null && Tick0.Equals(other.Tick0)) && (DTick == other.DTick && DTick != null && other.DTick != null && DTick.Equals(other.DTick)) && (Equals(TickVals, other.TickVals) || TickVals != null && other.TickVals != null && TickVals.SequenceEqual(other.TickVals)) && (Equals(TickText, other.TickText) || TickText != null && other.TickText != null && TickText.SequenceEqual(other.TickText)) && (Ticks == other.Ticks && Ticks != null && other.Ticks != null && Ticks.Equals(other.Ticks)) && (TickleN == other.TickleN && TickleN != null && other.TickleN != null && TickleN.Equals(other.TickleN)) && (TickWidth == other.TickWidth && TickWidth != null && other.TickWidth != null && TickWidth.Equals(other.TickWidth)) && (TickColor == other.TickColor && TickColor != null && other.TickColor != null && TickColor.Equals(other.TickColor)) && (ShowTickLabels == other.ShowTickLabels && ShowTickLabels != null && other.ShowTickLabels != null && ShowTickLabels.Equals(other.ShowTickLabels)) && (ShowTickPrefix == other.ShowTickPrefix && ShowTickPrefix != null && other.ShowTickPrefix != null && ShowTickPrefix.Equals(other.ShowTickPrefix)) && (TickPrefix == other.TickPrefix && TickPrefix != null && other.TickPrefix != null && TickPrefix.Equals(other.TickPrefix)) && (ShowTickSuffix == other.ShowTickSuffix && ShowTickSuffix != null && other.ShowTickSuffix != null && ShowTickSuffix.Equals(other.ShowTickSuffix)) && (TickSuffix == other.TickSuffix && TickSuffix != null && other.TickSuffix != null && TickSuffix.Equals(other.TickSuffix)) && (ShowExponent == other.ShowExponent && ShowExponent != null && other.ShowExponent != null && ShowExponent.Equals(other.ShowExponent)) && (ExponentFormat == other.ExponentFormat && ExponentFormat != null && other.ExponentFormat != null && ExponentFormat.Equals(other.ExponentFormat)) && (SeparateThousands == other.SeparateThousands && SeparateThousands != null && other.SeparateThousands != null && SeparateThousands.Equals(other.SeparateThousands)) && (TickFont == other.TickFont && TickFont != null && other.TickFont != null && TickFont.Equals(other.TickFont)) && (TickAngle == other.TickAngle && TickAngle != null && other.TickAngle != null && TickAngle.Equals(other.TickAngle)) && (TickFormat == other.TickFormat && TickFormat != null && other.TickFormat != null && TickFormat.Equals(other.TickFormat)) && (Equals(TickFormatStops, other.TickFormatStops) || TickFormatStops != null && other.TickFormatStops != null && TickFormatStops.SequenceEqual(other.TickFormatStops)) && (Layer == other.Layer && Layer != null && other.Layer != null && Layer.Equals(other.Layer)) && (CategoryArraySrc == other.CategoryArraySrc && CategoryArraySrc != null && other.CategoryArraySrc != null && CategoryArraySrc.Equals(other.CategoryArraySrc)) && (TickValsSrc == other.TickValsSrc && TickValsSrc != null && other.TickValsSrc != null && TickValsSrc.Equals(other.TickValsSrc)) && (TickTextSrc == other.TickTextSrc && TickTextSrc != null && other.TickTextSrc != null && TickTextSrc.Equals(other.TickTextSrc))); }
private void SpecialAssertEqual(Period period1, Period period2) { Assert.AreEqual(period1.GetHashCode(), period2.GetHashCode()); // Don't use Assert.Equals, which will iterate over the period Assert.IsTrue(period1.Equals(period2)); }
public bool Equals(PeriodViewModel other) { return(Period.Equals(other.Period)); }
public bool IsSatisfiedBy(RateNode candidate) { var actual = new Period(candidate.Dates.Select(e => e.Date.Date).Intersect(DesiredPeriod.DatesInPeriod).ToArray()); return(actual.Equals(DesiredPeriod)); }
/// <summary> /// Returns true if Address instances are equal /// </summary> /// <param name="other">Instance of Address to be compared</param> /// <returns>Boolean</returns> public bool Equals(Address other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Uuid == other.Uuid || Uuid != null && Uuid.Equals(other.Uuid) ) && ( Use == other.Use || Use != null && Use.Equals(other.Use) ) && ( Type == other.Type || Type != null && Type.Equals(other.Type) ) && ( Line == other.Line || Line != null && Line.SequenceEqual(other.Line) ) && ( City == other.City || City != null && City.Equals(other.City) ) && ( District == other.District || District != null && District.Equals(other.District) ) && ( State == other.State || State != null && State.Equals(other.State) ) && ( Country == other.Country || Country != null && Country.Equals(other.Country) ) && ( PostalCode == other.PostalCode || PostalCode != null && PostalCode.Equals(other.PostalCode) ) && ( Period == other.Period || Period != null && Period.Equals(other.Period) ) && ( Creation == other.Creation || Creation != null && Creation.Equals(other.Creation) ) && ( LastUpdated == other.LastUpdated || LastUpdated != null && LastUpdated.Equals(other.LastUpdated) )); }
protected override async void OnBindingContextChanged() { base.OnBindingContextChanged(); if (BindingContext != null) { LabelDate.Text = DatePay; string str = Period; FontAttributes fontAttributes = FontAttributes.Bold; double fontsize = 15; if (Period.Equals("")) { str = "Обрабатывается"; LabelPeriod.FontAttributes = FontAttributes.None; LabelPeriod.FontSize = 13; } LabelPeriod.Text = str; FormattedString formattedIdent = new FormattedString(); //double sum2 = Double.Parse(SumPay); //formattedIdent.Spans.Add(new Span //{ // Text = $"{sum2:0.00}".Replace(',','.'), // TextColor = Color.FromHex(Settings.MobileSettings.color), // FontSize = 15, // FontAttributes = FontAttributes.Bold //}); //formattedIdent.Spans.Add(new Span //{ // Text = $" {AppResources.Currency}", // TextColor = Color.Gray, // FontSize = 10 //}); double sum2; var parseSumpayOk = Double.TryParse(SumPay, NumberStyles.Float, new CultureInfo("ru-RU"), out sum2); if (parseSumpayOk) { formattedIdent.Spans.Add(new Span { Text = $"{sum2:0.00}".Replace(',', '.'), TextColor = (Color)Application.Current.Resources["MainColor"], FontAttributes = FontAttributes.Bold, FontSize = 15 }); formattedIdent.Spans.Add(new Span { Text = $" {AppResources.Currency}", TextColor = Color.Gray, FontSize = 10 }); } else { formattedIdent.Spans.Add(new Span { Text = $"{SumPay}".Replace(',', '.'), TextColor = (Color)Application.Current.Resources["MainColor"], FontAttributes = FontAttributes.Bold, FontSize = 15 }); formattedIdent.Spans.Add(new Span { Text = $" {AppResources.Currency}", TextColor = Color.Gray, FontSize = 10 }); } LabelSum.FormattedText = formattedIdent; } }