public TemplateSub() { InitializeComponent(); NewTemplateInfo newTemplateInfo = new NewTemplateInfo(); newTemplateInfo.SetStatus(false); }
private void OK_Click(object sender, RoutedEventArgs e) { if (TemplateTitle.Text == "") { MessageBox.Show("テンプレートのタイトルを入力してください。", "", MessageBoxButton.OK, MessageBoxImage.Warning); return; } NewTemplateInfo newTemplateInfo = new NewTemplateInfo(); newTemplateInfo.SetStatus(true); newTemplateInfo.Set(TemplateTitle.Text, TemplateType.SelectedIndex); this.Close(); }
private void AddTemplate_Click(object sender, RoutedEventArgs e) { TemplateSub templateSub = new TemplateSub(); _ = templateSub.ShowDialog(); NewTemplateInfo newTemplateInfo = new NewTemplateInfo(); if (newTemplateInfo.GetStatus()) { AddTemplateItem(); } }
private void Window_PreviewKeyDown(object sender, KeyEventArgs e) { // テンプレート追加 if (Keyboard.IsKeyDown(Key.A) && (Keyboard.Modifiers & ModifierKeys.Alt) > 0) { TemplateSub templateSub = new TemplateSub(); _ = templateSub.ShowDialog(); NewTemplateInfo newTemplateInfo = new NewTemplateInfo(); if (newTemplateInfo.GetStatus()) { AddTemplateItem(); } } }
// テンプレート追加 private void AddTemplateItem(bool setup = false, string type = "", string p0 = "", string p1 = "", string p2 = "", string p3 = "", string p4 = "", string p5 = "") { System.Windows.Controls.GroupBox addingItem; if (setup) { if (type == "Text") { // p0 = headerTitle // p1 = isEnabled // p2 = targetExtension // p3 = defaultText // p4 = charasetIndex addingItem = AddTextTemplate(p0, totalCount, p1, p2, p3, int.Parse(p4)); } else { // p0 = headerTitle // p1 = isEnabled // p2 = targetExtension // p3 = sizeX // p4 = sizeY // p5 = backgroundColor addingItem = AddImageTemplate(p0, totalCount, p1, p2, int.Parse(p3), int.Parse(p4), p5); } } else { NewTemplateInfo newTemplateInfo = new NewTemplateInfo(); List <string> info = newTemplateInfo.Get(); if (int.Parse(info[1]) == 0) { addingItem = AddTextTemplate(info[0], totalCount); } else { addingItem = AddImageTemplate(info[0], totalCount); } } TemplatesField.Children.Add(addingItem); allTemplatesList.Add(addingItem); visualAllTemplatesListIndex.Add(totalCount); totalCount += 1; }