/* Setups a Dialog Window, that reminds the User to safe */ public bool SaveWithDialog() { if (!SaveNecessary()) { return(true); } bool ret = true; var saveDiag = new SafeCallDialog("Soll die Änderung gespeichert werden?", "Speichern", 0, "Abbruch", 1); if (saveDiag.Run() == 0) // User wants to safe { if (!OnSave()) // But User has invalid input { var diag = new SafeCallDialog("Es konnte nicht gespeichert werden!", "Ok", 0, null, 1); diag.Run(); diag.Destroy(); ret = false; } } else // User does not want to safe; { ret = false; } saveDiag.Destroy(); return(ret); }
public override void AddChildEntry() // Add a Beschreibung { // Is there a active parent? TreeIter parentIter = editFrameAdapter.ActiveParentTreeIter; if (parentIter.Equals(TreeIter.Zero)) { var error = new SafeCallDialog("Kein Element ausgewählt", "Ok", 0, null, 1); error.Run(); error.Destroy(); return; } ComboBox cbTyp = new ComboBox(API_Contract.ProgrammDescrTypVal); cbTyp.Active = 2; // Default is 'All' Entry textEntry = new Entry(); var args = new GetUserArgs[] { new GetUserArgs(new Label("Text"), textEntry), new GetUserArgs(new Label("Typ"), cbTyp), }; var diag = new GetUserDataDialog(args, null, "Ok", 0, "Abbruch", 1); if (diag.Run() == 0) { var treeContent = CurrTreeStore; string text = textEntry.Text; string typString = GtkHelper.ComboBoxActiveString(cbTyp); int typ = cbTyp.Active; // Save on UI TreeIter insertIter, firstIter; insertIter = treeContent.AppendValues(parentIter, "└──", "\t" + text, typString); treeContent.IterNthChild(out firstIter, parentIter, 0); GtkHelper.SortInByColumn(treeContent, (int)ProgrammColumnID.Text, insertIter); // XXX: Save on Database string time = (string)treeContent.GetValue(parentIter, (int)ProgrammColumnID.Uhrzeit); var insert = new Table_Beschreibung(CurrTabIndex, time, text, typ); dbAdapter.InsertEntry(insert); } // Free Memory diag.Destroy(); foreach (var arg in args) { arg.Dispose(); } }
public bool ShowInvalidEntrys() { if (!finished) // Check Integrity first { CheckIntegrity(); } if (wrong_schema) { mainDiag = new SafeCallDialog(new Label("Datenbank wird nicht untersützt!"), "Ok"); } else if (no_file) { mainDiag = new SafeCallDialog(new Label("Keine solche Datei"), "Ok"); } else { // Save ressources and only init that once! sideDiag = new SafeCallDialog("Soll der Eintrag wirklich gelösch werden?", "Ja", 0, "Nein", 1); sideDiag.Hide(); // Pass invalid entrys to UI TreeView invalidItems = GenInvalidEntryView(); VBox content = new VBox(); content.PackStart(new Label("Inkonsistente Einträge:"), false, false, 5); content.PackStart(invalidItems, true, true, 2); mainDiag = new SafeCallDialog(content, "Ok"); } mainDiag.Run(); mainDiag.Destroy(); mainDiag = null; if (sideDiag != null) { sideDiag.Destroy(); } sideDiag = null; return(invalidEntrys.Count == 0); }