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 void Save() { string[] values = new string[17]; values[0] = name; values[1] = imagePath; values[2] = anchor.ToString(); values[3] = increment.ToString(); values[4] = xPos.ToString(); values[5] = yPos.ToString(); values[6] = lastUsed.ToString(); values[7] = FontName; values[8] = FontSize.ToString(); values[9] = IsBold.ToString(); values[10] = IsCursive.ToString(); values[11] = FontColor.ToArgb().ToString(); values[12] = BorderSize.ToString(); values[13] = BorderColor.ToArgb().ToString(); DataHelper.SaveData(values, name); }
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; }
public CustomFontTestViewModel(INavigationService navigationService) { InputText = new ReactiveProperty <string>().SetValidateAttribute(() => this.InputText); InputError = InputText.ObserveErrorChanged .Select(x => x?.Cast <string>()?.FirstOrDefault()) .ToReadOnlyReactiveProperty(); SectionToggleCommand = InputText.ObserveHasErrors.Select(x => !x).ToAsyncReactiveCommand(); SectionToggleCommand.Subscribe(async _ => { InputSectionVisible.Value = !InputSectionVisible.Value; await Task.Delay(250); }); ToProfileCommand.Subscribe(async _ => { await navigationService.NavigateAsync("DummyPage"); }); foreach (var item in languages) { ItemsSource.Add(new Person() { Name = item, Age = 1 }); } SelectedItems.Add(ItemsSource[1]); SelectedItems.Add(ItemsSource[2]); SelectedItems.Add(ItemsSource[3]); IsHeaderFont.Subscribe(o => { HeaderFont.Value = o ? "Anzu" : null; }); IsFooterFont.Subscribe(o => { FooterFont.Value = o ? "Anzu" : null; }); IsParentTitle.Subscribe(o => { ParentTitle.Value = o ? "Anzu" : null; }); IsParentValue.Subscribe(o => { ParentValue.Value = o ? "Anzu" : null; }); IsParentDesc.Subscribe(o => { ParentDesc.Value = o ? "Anzu" : null; }); IsParentHint.Subscribe(o => { ParentHint.Value = o ? "Anzu" : null; }); IsTitle.Subscribe(o => { Title.Value = o ? "" : null; }); IsValue.Subscribe(o => { Value.Value = o ? "" : null; }); IsDesc.Subscribe(o => { Desc.Value = o ? "" : null; }); IsHint.Subscribe(o => { Hint.Value = o ? "" : null; }); IsParentBold.Merge(IsParentItalic).Subscribe(o => { if (IsParentBold.Value && IsParentItalic.Value) { ParentAttr.Value = FontAttributes.Bold | FontAttributes.Italic; } else if (IsParentBold.Value) { ParentAttr.Value = FontAttributes.Bold; } else if (IsParentItalic.Value) { ParentAttr.Value = FontAttributes.Italic; } else { ParentAttr.Value = FontAttributes.None; } }); IsBold.Merge(IsItalic).Subscribe(o => { if (IsBold.Value && IsItalic.Value) { ChildAttr.Value = FontAttributes.Bold | FontAttributes.Italic; } else if (IsBold.Value) { ChildAttr.Value = FontAttributes.Bold; } else if (IsItalic.Value) { ChildAttr.Value = FontAttributes.Italic; } else { ChildAttr.Value = FontAttributes.None; } }); }