private void AddPage(object sender, RoutedEventArgs e) { BookPage p = new BookPage(); int idx = pageList.Children.Count; pageList.Children.Insert(idx - 1, p); if (idx < 10) { p.pageIdx.Text = string.Format("第0{0}页", idx); } else { p.pageIdx.Text = string.Format("第{0}页", idx); } if (pageList.Children.Count == 51) { newPage.IsEnabled = false; } JsonEditor doc = p.doc; doc.Bold = bold; doc.Italic = italic; doc.Underlined = underlined; doc.Strikethrough = strikethrough; doc.Obfuscated = obfuscated; doc.ColorPicker = TextColor; doc.Window = (CmdGenerator.Parent as ContentControl).Parent as IMtbWindow; doc.EntitySelector = ES; doc.InitializeSettings(clearStyle, c, addSelector, addObjective, addEvent, TextColor, doc.Foreground); doc.GotFocus += FocusedChanged; }
public Book(CommandsGeneratorTemplate cmdGenerator) { InitializeComponent(); CmdGenerator = cmdGenerator; JsonEditor doc = Page1.doc; doc.Bold = bold; doc.Italic = italic; doc.Underlined = underlined; doc.Strikethrough = strikethrough; doc.Obfuscated = obfuscated; doc.ColorPicker = TextColor; doc.Window = (cmdGenerator.Parent as ContentControl).Parent as IMtbWindow; doc.EntitySelector = ES; doc.InitializeSettings(clearStyle, c, addSelector, addObjective, addEvent, TextColor, doc.Foreground); Page1.doc.GotFocus += FocusedChanged; editing = Page1.doc; }