public override int GetHashCode() { unchecked { var hashCode = Color.GetHashCode(); hashCode = (hashCode * 397) ^ Width.GetHashCode(); hashCode = (hashCode * 397) ^ Height.GetHashCode(); hashCode = (hashCode * 397) ^ BackgroundColor.GetHashCode(); hashCode = (hashCode * 397) ^ BorderLeftColor.GetHashCode(); hashCode = (hashCode * 397) ^ BorderLeftWidth.GetHashCode(); hashCode = (hashCode * 397) ^ BorderRightColor.GetHashCode(); hashCode = (hashCode * 397) ^ BorderTopColor.GetHashCode(); hashCode = (hashCode * 397) ^ BorderBottomColor.GetHashCode(); hashCode = (hashCode * 397) ^ BorderRightWidth.GetHashCode(); hashCode = (hashCode * 397) ^ BorderTopWidth.GetHashCode(); hashCode = (hashCode * 397) ^ BorderBottomWidth.GetHashCode(); hashCode = (hashCode * 397) ^ Font.GetHashCode(); hashCode = (hashCode * 397) ^ FontSize.GetHashCode(); hashCode = (hashCode * 397) ^ HAlign.GetHashCode(); hashCode = (hashCode * 397) ^ VAlign.GetHashCode(); hashCode = (hashCode * 397) ^ IsLineThrough.GetHashCode(); hashCode = (hashCode * 397) ^ IsOverline.GetHashCode(); hashCode = (hashCode * 397) ^ IsUnderline.GetHashCode(); hashCode = (hashCode * 397) ^ IsItalic.GetHashCode(); hashCode = (hashCode * 397) ^ IsBold.GetHashCode(); hashCode = (hashCode * 397) ^ BorderBottomStyle.GetHashCode(); hashCode = (hashCode * 397) ^ BorderLeftStyle.GetHashCode(); hashCode = (hashCode * 397) ^ BorderRightStyle.GetHashCode(); hashCode = (hashCode * 397) ^ BorderTopStyle.GetHashCode(); return(hashCode); } }
public virtual void WriteXml(XmlWriter writer) { if (!string.IsNullOrEmpty(Namespace)) { var name = string.IsNullOrEmpty(Prefix) ? "xmlns" : $"xmlns:{Prefix}"; writer.WriteAttributeString(name, Namespace); } writer.WriteAttributeString("index", Index.ToString()); writer.WriteAttributeString("name", Name); writer.WriteAttributeString("font", FontFamily); if (!Color.Equals(Transparent) && !Color.Equals(Automatic)) { writer.WriteAttributeString("fontColor", Color); } if (!Highlight.Equals(Transparent) && !Highlight.Equals(Automatic)) { writer.WriteAttributeString("highlightColor", Highlight); } writer.WriteAttributeString("fontSize", FontSize); if (IsBold) { writer.WriteAttributeString("bold", IsBold.ToString().ToLower()); } if (IsItalic) { writer.WriteAttributeString("italic", IsItalic.ToString().ToLower()); } if (IsUnderline) { writer.WriteAttributeString("underline", IsUnderline.ToString().ToLower()); } if (IsStrikethrough) { writer.WriteAttributeString("strikethrough", IsStrikethrough.ToString().ToLower()); } if (IsSuperscript) { writer.WriteAttributeString("superscript", IsSuperscript.ToString().ToLower()); } if (IsSubscript) { writer.WriteAttributeString("subscript", IsSubscript.ToString().ToLower()); } writer.WriteAttributeString("spaceBefore", SpaceBefore); writer.WriteAttributeString("spaceAfter", SpaceAfter); writer.WriteAttributeString("spacing", Spacing); }
public override int GetHashCode() { return(IsBold.GetHashCode() + IsItalic.GetHashCode() + IsStrikedOut.GetHashCode() + IsUnderlined.GetHashCode() + FontSize.GetHashCode() + (string.IsNullOrEmpty(BackgroundBrushString) ? 0 : BackgroundBrushString.GetHashCode()) + (string.IsNullOrEmpty(ForegroundBrushString) ? 0 : ForegroundBrushString.GetHashCode()) + (string.IsNullOrEmpty(FontFamilyString) ? 0 : FontFamilyString.GetHashCode())); }
public ViewModel() { OutputText = InputText.Merge(SelectedFont) .Select(i => (object)i) .Merge(FontSize.Select(i => (object)i)) .Merge(SubWidth.Select(i => (object)i)) .Merge(IsBold.Select(i => (object)i)) .Merge(IsItalic.Select(i => (object)i)) .Merge(SmallerBreaking.Select(i => (object)i)) .Merge(BreakPerChars.Select(i => (object)i)) .Throttle(TimeSpan.FromMilliseconds(500)) .Select(i => { if (InputText.Value != "" && FontSize.Value > 0 && SubWidth.Value > 10) { return(Model.Optimize(InputText.Value, SelectedFont.Value, FontSize.Value, IsBold.Value, IsItalic.Value, SubWidth.Value, breakPerElement: SmallerBreaking.Value, breakPerCharacter: BreakPerChars.Value)); } return(""); }) .ToReactiveProperty(); OutputText.Subscribe(_ => OnPropertyChanged(() => CopyResult)); IsBold.Subscribe(_ => OnPropertyChanged(() => FontWeight)); IsItalic.Subscribe(_ => OnPropertyChanged(() => FontStyle)); SelectedFont.Subscribe(_ => { if (Fonts.Contains(SelectedFont.Value) && Fonts.IndexOf(SelectedFont.Value) != SelectedFontIndex) { SelectedFontIndex = Fonts.IndexOf(SelectedFont.Value); } }); BreakPerBlock = true; }