private void on_edit_current_person_clicked(object o, EventArgs args) { Log.WriteLine("modify person"); //personAddModifyWin = PersonAddModifyWindow.Show(app1, currentSession, currentPerson.UniqueID, prefsDigitsNumber); personAddModifyWin = PersonAddModifyWindow.Show(app1, currentSession, currentPerson, prefsDigitsNumber, false, videoOn); //don't comes from recuperate window personAddModifyWin.FakeButtonAccept.Clicked += new EventHandler(on_edit_current_person_accepted); }
private void on_person_add_single_activate(object o, EventArgs args) { personAddModifyWin = PersonAddModifyWindow.Show(app1, currentSession, new Person(-1), prefsDigitsNumber, false, videoOn); //don't comes from recuperate window //-1 means we are adding a new person //if we were modifying it will be it's uniqueID personAddModifyWin.FakeButtonAccept.Clicked += new EventHandler(on_person_add_single_accepted); }
//void on_person_modify_delete_event (object o, EventArgs args) void on_person_win_delete_event(object o, DeleteEventArgs args) { PersonAddModifyWindowBox.person_win.Hide(); PersonAddModifyWindowBox = null; }
private void recordChanges() { //separate by '/' for not confusing with the ':' separation between the other values //string dateFull = dateTime.Day.ToString() + "/" + dateTime.Month.ToString() + "/" + // dateTime.Year.ToString(); double weight = (double) spinbutton_weight.Value; //convert margarias (it's power is calculated using weight and it's written on description) string [] myMargarias = SqliteRun.SelectRuns(false, currentSession.UniqueID, currentPerson.UniqueID, "Margaria", Sqlite.Orders_by.DEFAULT, -1); foreach(string myStr in myMargarias) { string [] margaria = myStr.Split(new char[] {':'}); Run mRun = SqliteRun.SelectRunData(Convert.ToInt32(margaria[1]), false); double distanceMeters = mRun.Distance / 1000; mRun.Description = "P = " + Util.TrimDecimals ( (weight * 9.8 * distanceMeters / mRun.Time).ToString(), pDN) + " (Watts)"; SqliteRun.Update(mRun.UniqueID, mRun.Type, mRun.Distance.ToString(), mRun.Time.ToString(), mRun.PersonID, mRun.Description); } if(adding) { //here we add rows in the database LogB.Information("Going to insert person"); currentPerson = new Person (entry1.Text, sex, dateTime, Constants.RaceUndefinedID, Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_countries), countries)), textview_description.Buffer.Text, Constants.ServerUndefinedID, false); //dbconOpened LogB.Information("Going to insert personSession"); currentPersonSession = new PersonSession ( currentPerson.UniqueID, currentSession.UniqueID, (double) spinbutton_height.Value, (double) weight, sport.UniqueID, Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_speciallities), speciallities)), Util.FetchID(UtilGtk.ComboGetActive(combo_levels)), textview_ps_comments.Buffer.Text, false); //dbconOpened LogB.Information("inserted both"); } else { //here we update rows in the database currentPerson = new Person (currentPerson.UniqueID, entry1.Text, sex, dateTime, Constants.RaceUndefinedID, Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_countries), countries)), textview_description.Buffer.Text, serverUniqueID); SqlitePerson.Update (currentPerson); //we only need to update personSession //1.- search uniqueID PersonSession ps = SqlitePersonSession.Select(currentPerson.UniqueID, currentSession.UniqueID); //2.- create new instance currentPersonSession = new PersonSession ( ps.UniqueID, currentPerson.UniqueID, currentSession.UniqueID, (double) spinbutton_height.Value, (double) weight, sport.UniqueID, Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_speciallities), speciallities)), Util.FetchID(UtilGtk.ComboGetActive(combo_levels)), textview_ps_comments.Buffer.Text); //3.- update in database SqlitePersonSession.Update (currentPersonSession); } PersonAddModifyWindowBox.person_win.Hide(); PersonAddModifyWindowBox = null; fakeButtonAccept.Click(); }
public static PersonAddModifyWindow Show(Gtk.Window parent, Session mySession, Person currentPerson, int pDN, Gtk.CheckButton app1_checkbutton_video, bool showPhotoStuff) { if (PersonAddModifyWindowBox == null) { PersonAddModifyWindowBox = new PersonAddModifyWindow (parent, mySession, currentPerson, showPhotoStuff); } PersonAddModifyWindowBox.pDN = pDN; PersonAddModifyWindowBox.app1_checkbutton_video = app1_checkbutton_video; PersonAddModifyWindowBox.person_win.Show (); PersonAddModifyWindowBox.fillDialog (); return PersonAddModifyWindowBox; }
void on_button_cancel_clicked(object o, EventArgs args) { PersonAddModifyWindowBox.person_win.Hide(); PersonAddModifyWindowBox = null; }
private void person_edit_single() { LogB.Information("modify person"); personAddModifyWin = PersonAddModifyWindow.Show(app1, currentSession, currentPerson, preferences.digitsNumber, checkbutton_video, useVideo ); personAddModifyWin.FakeButtonAccept.Clicked += new EventHandler(on_edit_current_person_accepted); }
private void person_add_single() { personAddModifyWin = PersonAddModifyWindow.Show(app1, currentSession, new Person(-1), preferences.digitsNumber, checkbutton_video, useVideo ); //-1 means we are adding a new person //if we were modifying it will be it's uniqueID personAddModifyWin.FakeButtonAccept.Clicked += new EventHandler(on_person_add_single_accepted); }
//void on_person_modify_delete_event (object o, EventArgs args) void on_person_win_delete_event(object o, DeleteEventArgs args) { //nice: this makes windows no destroyed, now nothing happens if(comesFromRecuperateWin) args.RetVal = true; else { PersonAddModifyWindowBox.person_win.Hide(); PersonAddModifyWindowBox = null; fakeButtonCancel.Click(); } }
public static PersonAddModifyWindow Show(Gtk.Window parent, Session mySession, Person currentPerson, int pDN, bool comesFromRecuperateWin, bool videoOn) { if (comesFromRecuperateWin) PersonAddModifyWindowBox = null; if (PersonAddModifyWindowBox == null) { PersonAddModifyWindowBox = new PersonAddModifyWindow (parent, mySession, currentPerson); } PersonAddModifyWindowBox.pDN = pDN; PersonAddModifyWindowBox.comesFromRecuperateWin = comesFromRecuperateWin; PersonAddModifyWindowBox.button_take_photo.Sensitive = videoOn; //No more hide cancel button. //Better to show it and allow to not recuperate if user changes his mind //if(comesFromRecuperateWin) //PersonAddModifyWindowBox.button_cancel.Hide(); PersonAddModifyWindowBox.person_win.Show (); PersonAddModifyWindowBox.fillDialog (); return PersonAddModifyWindowBox; }
protected virtual void on_button_recuperate_clicked(object o, EventArgs args) { if(selected != "-1") { Person person = SqlitePerson.Select(Convert.ToInt32(selected)); personAddModifyWin = PersonAddModifyWindow.Show( parent, currentSession, person, pDN, true, videoOn); //comes from recuperate window personAddModifyWin.FakeButtonAccept.Clicked += new EventHandler(on_edit_current_person_accepted); } }