private void on_edit_session_activate(object o, EventArgs args) { Log.WriteLine("edit session"); sessionAddEditWin = SessionAddEditWindow.Show(app1, currentSession); sessionAddEditWin.Button_accept.Clicked += new EventHandler(on_edit_session_accepted); }
/* --------------------------------------------------------- * ---------------- SESSION NEW, LOAD, EXPORT, DELETE ----- * -------------------------------------------------------- */ private void on_new_activate(object o, EventArgs args) { Log.WriteLine("new session"); sessionAddEditWin = SessionAddEditWindow.Show(app1, new Session()); sessionAddEditWin.Button_accept.Clicked += new EventHandler(on_new_session_accepted); }
void on_button_cancel_clicked(object o, EventArgs args) { SessionAddEditWindowBox.session_add_edit.Hide(); SessionAddEditWindowBox = null; }
void on_session_add_edit_delete_event(object o, DeleteEventArgs args) { SessionAddEditWindowBox.session_add_edit.Hide(); SessionAddEditWindowBox = null; }
public void HideAndNull() { if (SessionAddEditWindowBox != null) { SessionAddEditWindowBox.session_add_edit.Hide(); SessionAddEditWindowBox = null; } }
public static SessionAddEditWindow Show(Gtk.Window parent, Session currentSession) { if (SessionAddEditWindowBox == null) { SessionAddEditWindowBox = new SessionAddEditWindow (parent, currentSession); } SessionAddEditWindowBox.session_add_edit.Show (); SessionAddEditWindowBox.fillDialog (); return SessionAddEditWindowBox; }
/* --------------------------------------------------------- * ---------------- SESSION NEW, LOAD, EXPORT, DELETE ----- * -------------------------------------------------------- */ private void on_new_activate(object o, EventArgs args) { LogB.Information("new session"); sessionAddEditWin = SessionAddEditWindow.Show(app1, new Session()); sessionAddEditWin.FakeButtonAccept.Clicked -= new EventHandler(on_new_session_accepted); sessionAddEditWin.FakeButtonAccept.Clicked += new EventHandler(on_new_session_accepted); }
private void on_edit_session_activate(object o, EventArgs args) { LogB.Information("edit session"); if(currentSession.Name == Constants.SessionSimulatedName) new DialogMessage(Constants.MessageTypes.INFO, Constants.SessionProtected); else { sessionAddEditWin = SessionAddEditWindow.Show(app1, currentSession); sessionAddEditWin.FakeButtonAccept.Clicked -= new EventHandler(on_edit_session_accepted); sessionAddEditWin.FakeButtonAccept.Clicked += new EventHandler(on_edit_session_accepted); } }
void on_button_accept_clicked(object o, EventArgs args) { //check if name of session exists (is owned by other session), //but all is ok if the name is the same as the old name (editing) bool sessionNameExists = Sqlite.Exists (Constants.SessionTable, Util.RemoveTildeAndColon(entry_name.Text)); if(sessionNameExists && Util.RemoveTildeAndColon(entry_name.Text) != currentSession.Name ) { string myString = string.Format(Catalog.GetString("Session: '{0}' exists. Please, use another name"), Util.RemoveTildeAndColonAndDot(entry_name.Text) ); ErrorWindow.Show(myString); } else { int sportID; if(radiobutton_diff_sports.Active) sportID = Constants.SportUndefinedID; else { sportID = Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_sports), sports)); } int speciallityID; if(!label_speciallity.Visible || radiobutton_diff_speciallities.Active) speciallityID = Constants.SpeciallityUndefinedID; else speciallityID = Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_speciallities), speciallities)); int levelID; if(!label_level.Visible || radiobutton_diff_levels.Active) levelID = Constants.LevelUndefinedID; else levelID = Util.FetchID(UtilGtk.ComboGetActive(combo_levels)); if(addSession) currentSession = new Session (Util.RemoveTildeAndColon(entry_name.Text), Util.RemoveTildeAndColon(entry_place.Text), dateTime, sportID, speciallityID, levelID, Util.RemoveTildeAndColon(textview.Buffer.Text), Constants.ServerUndefinedID); else { currentSession.Name = Util.RemoveTildeAndColon(entry_name.Text.ToString()); currentSession.Place = Util.RemoveTildeAndColon(entry_place.Text.ToString()); currentSession.Date = dateTime; currentSession.PersonsSportID = sportID; currentSession.PersonsSpeciallityID = speciallityID; currentSession.PersonsPractice = levelID; currentSession.Comments = Util.RemoveTildeAndColon(textview.Buffer.Text); SqliteSession.Update(currentSession.UniqueID, currentSession.Name, currentSession.Place, currentSession.Date, sportID, speciallityID, levelID, currentSession.Comments); } SessionAddEditWindowBox.session_add_edit.Hide(); SessionAddEditWindowBox = null; } }