static public RunTypeAddWindow Show(Gtk.Window parent, bool simple) { if (RunTypeAddWindowBox == null) { RunTypeAddWindowBox = new RunTypeAddWindow(parent, simple); } RunTypeAddWindowBox.run_type_add.Show(); RunTypeAddWindowBox.fillDialog(simple); return(RunTypeAddWindowBox); }
private void on_run_simple_type_add_activate(object o, EventArgs args) { Log.WriteLine("Add simple new run type"); runTypeAddWin = RunTypeAddWindow.Show(app1, true); //is simple runTypeAddWin.FakeButtonAccept.Clicked += new EventHandler(on_run_type_add_accepted); }
private void on_run_intervallic_type_add_activate(object o, EventArgs args) { Log.WriteLine("Add intervallic new run type"); runTypeAddWin = RunTypeAddWindow.Show(app1, false); //is intervallic runTypeAddWin.FakeButtonAccept.Clicked += new EventHandler(on_run_type_add_accepted); }
void on_delete_event(object o, DeleteEventArgs args) { RunTypeAddWindowBox.run_type_add.Hide(); RunTypeAddWindowBox = null; }
void on_button_cancel_clicked(object o, EventArgs args) { RunTypeAddWindowBox.run_type_add.Hide(); RunTypeAddWindowBox = null; }
void on_button_accept_clicked(object o, EventArgs args) { //Console.WriteLine(getEntriesString()); //check if this run type exists, and check it's name is not AllRunsName bool runTypeExists = Sqlite.Exists (Constants.RunTypeTable, Util.RemoveTildeAndColonAndDot(entry_name.Text)); if(Util.RemoveTildeAndColonAndDot(entry_name.Text) == Constants.AllRunsName) { runTypeExists = true; } if(runTypeExists) { string myString = string.Format(Catalog.GetString("Run type: '{0}' exists. Please, use another name"), Util.RemoveTildeAndColonAndDot(entry_name.Text) ); Log.WriteLine (myString); ErrorWindow.Show(myString); } else { RunType type = new RunType(); type.Name = Util.RemoveTildeAndColonAndDot(entry_name.Text); type.Description = Util.RemoveTildeAndColon(textview_description.Buffer.Text); if(radiobutton_dist_variable.Active) type.Distance = 0; else if(radiobutton_dist_fixed.Active) type.Distance = spin_distance_fixed.Value; else { //dist_different (only on intervallic) type.Distance = -1; type.DistancesString = getEntriesString(); } if(radiobutton_simple.Active) { SqliteRunType.Insert(type, Constants.RunTypeTable, false); //false, because dbcon is not opened InsertedSimple = true; } else { if(radiobutton_unlimited.Active) { //unlimited (but in runs do like if it's limited by seconds: TracksLimited = false //(explanation in sqlite/jumpType.cs) type.TracksLimited = false; type.FixedValue = 0; type.Unlimited = true; } else { type.TracksLimited = radiobutton_limited_tracks.Active; if(checkbutton_limited_fixed.Active) type.FixedValue = Convert.ToInt32(spin_fixed_tracks_or_time.Value); else type.FixedValue = 0; type.Unlimited = false; } SqliteRunIntervalType.Insert(type, Constants.RunIntervalTypeTable, false); //false, because dbcon is not opened InsertedSimple = false; } //Log.WriteLine(string.Format("Inserted: {0}", type)); fakeButtonAccept.Click(); RunTypeAddWindowBox.run_type_add.Hide(); RunTypeAddWindowBox = null; } }
public static RunTypeAddWindow Show(Gtk.Window parent, bool simple) { if (RunTypeAddWindowBox == null) { RunTypeAddWindowBox = new RunTypeAddWindow (parent, simple); } RunTypeAddWindowBox.run_type_add.Show (); RunTypeAddWindowBox.fillDialog (simple); return RunTypeAddWindowBox; }
void on_button_accept_clicked(object o, EventArgs args) { //ConsoleB.Information(getEntriesString()); string name = Util.RemoveTildeAndColonAndDot(entry_name.Text); //check if this run type exists, and check it's name is not AllRunsName bool runTypeExists = Sqlite.Exists(false, Constants.RunTypeTable, name); if (name == Constants.AllRunsName) { runTypeExists = true; } if (runTypeExists) { string myString = string.Format(Catalog.GetString("Race type: '{0}' exists. Please, use another name"), name); LogB.Information(myString); ErrorWindow.Show(myString); } else { RunType type = new RunType(); type.Name = name; type.Description = Util.RemoveTildeAndColon(textview_description.Buffer.Text); if (radiobutton_dist_variable.Active) { type.Distance = 0; } else if (radiobutton_dist_fixed.Active) { type.Distance = spin_distance_fixed.Value; } else { //dist_different (only on intervallic) type.Distance = -1; type.DistancesString = getEntriesString(); } if (radiobutton_simple.Active) { SqliteRunType.Insert(type, Constants.RunTypeTable, false); //false, because dbcon is not opened InsertedSimple = true; } else { if (radiobutton_unlimited.Active) { //unlimited (but in runs do like if it's limited by seconds: TracksLimited = false //(explanation in sqlite/jumpType.cs) type.TracksLimited = false; type.FixedValue = 0; type.Unlimited = true; } else { type.TracksLimited = radiobutton_limited_tracks.Active; if (checkbutton_limited_fixed.Active) { type.FixedValue = Convert.ToInt32(spin_fixed_tracks_or_time.Value); } else { type.FixedValue = 0; } type.Unlimited = false; } SqliteRunIntervalType.Insert(type, Constants.RunIntervalTypeTable, false); //false, because dbcon is not opened InsertedSimple = false; } //LogB.Information(string.Format("Inserted: {0}", type)); fakeButtonAccept.Click(); RunTypeAddWindowBox.run_type_add.Hide(); RunTypeAddWindowBox = null; } }