public static bool StartEditing(Window owner, ReportConfig items) { ReportConfigEditor editor = new ReportConfigEditor(); editor.Model = items; editor.DataContext = items; editor.Owner = owner; editor.ShowDialog(); return(editor.ApplyChanges); }
private void BtnEdit_Click(object sender, RoutedEventArgs e) { ImageButton button = (ImageButton)sender; ReportConfig config = (ReportConfig)button.DataContext; ReportConfig clone = ReportConfigSerializer.Clone(config); if (ReportConfigEditor.StartEditing(this, clone)) { int index = Model.IndexOf(config); Model[index] = clone; } }
private void BtnAdd_Click(object sender, RoutedEventArgs e) { ReportConfig config = new ReportConfig { Guid = Guid.NewGuid(), Name = "New report", Description = "", Type = ReportType.ListResources, }; if (ReportConfigEditor.StartEditing(this, config)) { Model.Add(config); } }