protected void OnTreeviewPatternsRowActivated(object o, RowActivatedArgs args) { if (SelectedPattern != null) { EditPatternDialog.ShowForm(SelectedPattern, DataModel, "Edit Pattern"); } }
public static Boolean ShowForm(Pattern pattern, ApplicationDataModel data, string title) { EditPatternDialog form = new EditPatternDialog(); form.Title = title; form._Data = data; form._Pattern = pattern; //Object to controls form.entryName.Text = pattern.Name; form.Response += (object o, ResponseArgs args) => { if (args.ResponseId == ResponseType.Ok) { //Controls to object pattern.Name = form.entryName.Text; } }; Boolean result = form.Run() == (int)ResponseType.Ok; form.Destroy(); return(result); }
protected void OnTreeviewPatternsCursorChanged(object sender, EventArgs e) { TreeModel model; TreeIter iter; if ((sender as TreeView).Selection.GetSelected(out model, out iter)) { SelectedPattern = (Pattern)model.GetValue(iter, PatternColumn); if (ignoreNextClick) { ignoreNextClick = false; return; } TreePath path; TreeViewColumn column; (sender as TreeView).GetCursor(out path, out column); if (column == (sender as TreeView).Columns[4]) //Delete clicked { if (MainWindow.ConfirmDelete()) { ignoreNextClick = true; PatternListStore.Remove(ref iter); DataModel.Patterns.Remove(SelectedPattern); SelectedPattern = null; } } else if (column == (sender as TreeView).Columns[3]) //Copy clicked { Pattern pattern = new Pattern(); pattern.Assign(SelectedPattern); pattern.Name = DataModel.GetPatternName(SelectedPattern.Name, 2); if (EditPatternDialog.ShowForm(pattern, DataModel, "Copy Pattern " + SelectedPattern.Name)) { AddPattern(pattern); } } else if (column == (sender as TreeView).Columns[2]) //Edit clicked { EditPatternDialog.ShowForm(SelectedPattern, DataModel, "Edit Pattern"); } else if (column == (sender as TreeView).Columns[0]) //Play clicked { if (SelectedPattern == PlayingPattern) { StopPattern(); } else { PlayPattern(SelectedPattern); model.SetValue(iter, 0, "icon-dark-stop"); } } } }
protected void OnButtonAddPatternClicked(object sender, EventArgs e) { Pattern pattern = new Pattern(); pattern.Name = DataModel.GetPatternName(); if (EditPatternDialog.ShowForm(pattern, DataModel, "Add Pattern")) { AddPattern(pattern); } }