public DialogThreshold(Constants.Menuitem_modes m, int thresholdCurrent) { Glade.XML gladeXML; gladeXML = Glade.XML.FromAssembly(Util.GetGladePath() + "dialog_threshold.glade", "dialog_threshold", null); gladeXML.Autoconnect(this); //put an icon to window UtilGtk.IconWindow(dialog_threshold); FakeButtonClose = new Gtk.Button(); this.thresholdCurrent = thresholdCurrent; hscale_threshold.Value = Convert.ToInt32(thresholdCurrent / 10); label_threshold_value.Text = thresholdCurrent.ToString() + " ms"; writeTexts(); if (m == Constants.Menuitem_modes.JUMPSSIMPLE || m == Constants.Menuitem_modes.JUMPSREACTIVE) { label_threshold_name.Text = "<b>" + Catalog.GetString("Threshold for jumps") + "</b>"; notebook.CurrentPage = 0; } else if (m == Constants.Menuitem_modes.RUNSSIMPLE || m == Constants.Menuitem_modes.RUNSINTERVALLIC) { label_threshold_name.Text = "<b>" + Catalog.GetString("Threshold for runs") + "</b>"; notebook.CurrentPage = 1; } else //other { label_threshold_name.Text = "<b>" + Catalog.GetString("Threshold for other tests") + "</b>"; notebook.CurrentPage = 2; } label_threshold_name.UseMarkup = true; }
//called on test execution public void UpdateAtDatabaseIfNeeded(Constants.Menuitem_modes m) { if (t != t_previous_on_this_mode) { SqlitePreferences.Update(nameAtSQL(m), t.ToString(), false); t_previous_on_this_mode = t; } }
private string nameAtSQL(Constants.Menuitem_modes m) { if (m == Constants.Menuitem_modes.JUMPSSIMPLE || m == Constants.Menuitem_modes.JUMPSREACTIVE) { return("thresholdJumps"); } else if (m == Constants.Menuitem_modes.RUNSSIMPLE || m == Constants.Menuitem_modes.RUNSINTERVALLIC) { return("thresholdRuns"); } else // (m == Constants.Menuitem_modes.OTHER) { return("thresholdOther"); } }
//called when menuitem mode changes public bool SelectTresholdForThisMode(Constants.Menuitem_modes m) { //declare it with default value to solve potential SQL problems string newThreshold = "5"; //check current mode. Power modes doesn't use threshold newThreshold = SqlitePreferences.Select(nameAtSQL(m), false); if (Util.IsNumber(newThreshold, false)) { t = Convert.ToInt32(newThreshold); t_previous_on_this_mode = t; return(true); } return(false); }
/* * TESTS START */ private void chronojumpWindowTestsMode(Constants.Menuitem_modes m) { LogB.TestStart("chronojumpWindowTestsMode", m.ToString()); //disable autodetect //configAutodetectPort = Config.AutodetectPortEnum.INACTIVE; if (m == Constants.Menuitem_modes.JUMPSSIMPLE) { if (radio_menuitem_mode_jumps_simple.Active) { //needed if people select again the same option select_menuitem_mode_toggled(Constants.Menuitem_modes.JUMPSSIMPLE); } else { radio_menuitem_mode_jumps_simple.Active = true; } } else if (m == Constants.Menuitem_modes.JUMPSREACTIVE) { if (radio_menuitem_mode_jumps_reactive.Active) { select_menuitem_mode_toggled(Constants.Menuitem_modes.JUMPSREACTIVE); } else { radio_menuitem_mode_jumps_reactive.Active = true; } } else if (m == Constants.Menuitem_modes.RUNSSIMPLE) { if (radio_menuitem_mode_runs_simple.Active) { select_menuitem_mode_toggled(Constants.Menuitem_modes.RUNSSIMPLE); } else { radio_menuitem_mode_runs_simple.Active = true; } } LogB.TestEnd("chronojumpWindowTestsMode"); }
public DialogThreshold(Constants.Menuitem_modes m) { Glade.XML gladeXML; gladeXML = Glade.XML.FromAssembly(Util.GetGladePath() + "dialog_threshold.glade", "dialog_threshold", null); gladeXML.Autoconnect(this); //put an icon to window UtilGtk.IconWindow(dialog_threshold); writeTexts(); if (m == Constants.Menuitem_modes.JUMPSSIMPLE || m == Constants.Menuitem_modes.JUMPSREACTIVE) { notebook.CurrentPage = 0; } else if (m == Constants.Menuitem_modes.RUNSSIMPLE || m == Constants.Menuitem_modes.RUNSINTERVALLIC) { notebook.CurrentPage = 1; } else //other { notebook.CurrentPage = 2; } }
public void Read() { string contents = Util.ReadFile(UtilAll.GetConfigFileName(), false); if (contents != null && contents != "") { string line; using (StringReader reader = new StringReader(contents)) { do { line = reader.ReadLine(); if (line == null) { break; } if (line == "" || line[0] == '#') { continue; } string [] parts = line.Split(new char[] { '=' }); if (parts.Length != 2) { continue; } if (parts[0] == "Compujump" && Util.StringToBool(parts[1])) { Compujump = true; } else if (parts[0] == "CompujumpServerURL" && parts[1] != "") { CompujumpServerURL = parts[1]; } else if (parts[0] == "CompujumpStationID" && parts[1] != "" && Util.IsNumber(parts[1], false)) { CompujumpStationID = Convert.ToInt32(parts[1]); } else if (parts[0] == "CompujumpAdminID" && parts[1] != "" && Util.IsNumber(parts[1], false)) { CompujumpAdminID = Convert.ToInt32(parts[1]); } else if (parts[0] == "CompujumpAdminEmail" && parts[1] != "") { CompujumpAdminEmail = parts[1]; } else if (parts[0] == "CompujumpStationMode" && Enum.IsDefined(typeof(Constants.Menuitem_modes), parts[1])) { CompujumpStationMode = (Constants.Menuitem_modes) Enum.Parse(typeof(Constants.Menuitem_modes), parts[1]); } else if (parts[0] == "SessionMode" && Enum.IsDefined(typeof(SessionModeEnum), parts[1])) { SessionMode = (SessionModeEnum) Enum.Parse(typeof(SessionModeEnum), parts[1]); } else if (parts[0] == "PlaySoundsFromFile" && Util.StringToBool(parts[1])) { PlaySoundsFromFile = true; } else if (parts[0] == "Exhibition" && Util.StringToBool(parts[1])) { Exhibition = true; } else if (parts[0] == "ExhibitionStationType" && Enum.IsDefined(typeof(ExhibitionTest.testTypes), parts[1])) { ExhibitionStationType = (ExhibitionTest.testTypes) Enum.Parse(typeof(ExhibitionTest.testTypes), parts[1]); } /* * else if(parts[0] == "ExhibitionServerURL" && parts[1] != "") * ExhibitionServerURL = parts[1]; * else if(parts[0] == "ExhibitionStationID" && parts[1] != "" && Util.IsNumber(parts[1], false)) * ExhibitionStationID = Convert.ToInt32(parts[1]); */ } while(true); } } }
private void select_menuitem_mode_toggled(Constants.Menuitem_modes m) { menuitem_mode_selected_jumps_simple.Visible = false; menuitem_mode_selected_jumps_reactive.Visible = false; menuitem_mode_selected_runs_simple.Visible = false; menuitem_mode_selected_runs_intervallic.Visible = false; menuitem_mode_selected_power_gravitatory.Visible = false; menuitem_mode_selected_power_inertial.Visible = false; menuitem_mode_selected_other.Visible = false; LogB.Information("MODE", m.ToString()); //default for everythong except encoder menuitem_encoder_session_overview.Visible = false; menuitem_export_encoder_signal.Visible = false; menuitem_export_csv.Visible = true; hbox_other.Visible = false; vbox_last_test_buttons.Sensitive = false; if(m == Constants.Menuitem_modes.JUMPSSIMPLE || m == Constants.Menuitem_modes.JUMPSREACTIVE) { notebook_sup.CurrentPage = 0; notebook_capture_analyze.ShowTabs = true; if(m == Constants.Menuitem_modes.JUMPSSIMPLE) { menuitem_mode_selected_jumps_simple.Visible = true; notebooks_change(0); on_extra_window_jumps_test_changed(new object(), new EventArgs()); hbox_results_legend.Visible = true; notebook_capture_analyze.GetNthPage(2).Show(); //show jumpsProfile on jumps simple } else { menuitem_mode_selected_jumps_reactive.Visible = true; notebooks_change(1); on_extra_window_jumps_rj_test_changed(new object(), new EventArgs()); hbox_results_legend.Visible = false; notebook_capture_analyze.GetNthPage(2).Hide(); //hide jumpsProfile on jumps reactive } } else if(m == Constants.Menuitem_modes.RUNSSIMPLE || m == Constants.Menuitem_modes.RUNSINTERVALLIC) { notebook_sup.CurrentPage = 0; notebook_capture_analyze.ShowTabs = true; if(m == Constants.Menuitem_modes.RUNSSIMPLE) { menuitem_mode_selected_runs_simple.Visible = true; notebooks_change(2); on_extra_window_runs_test_changed(new object(), new EventArgs()); hbox_results_legend.Visible = true; } else { menuitem_mode_selected_runs_intervallic.Visible = true; notebooks_change(3); on_extra_window_runs_interval_test_changed(new object(), new EventArgs()); hbox_results_legend.Visible = false; } notebook_capture_analyze.GetNthPage(2).Hide(); //hide jumpsProfile on runs } else if(m == Constants.Menuitem_modes.POWERGRAVITATORY || m == Constants.Menuitem_modes.POWERINERTIAL) { menuitem_encoder_session_overview.Visible = true; menuitem_export_encoder_signal.Visible = true; menuitem_export_csv.Visible = false; //on OSX R is not installed by default. Check if it's installed. Needed for encoder if( UtilAll.GetOSEnum() == UtilAll.OperatingSystems.MACOSX && ! Util.FileExists(Constants.ROSX) ) { new DialogMessage(Constants.MessageTypes.WARNING, Catalog.GetString("Sorry, R software is not installed.") + "\n" + Catalog.GetString("Please, install it from here:") + "\n\nhttp://cran.cnr.berkeley.edu/bin/macosx/R-latest.pkg"); return; } notebook_sup.CurrentPage = 1; /* * If there's a signal on gravitatory and we move to inertial, * interface has to change to YESPERSON (meaning no_signal). * But, if there's no person shoud continue on NOPERSON */ if(selectRowTreeView_persons(treeview_persons, treeview_persons_store, 0)) encoderButtonsSensitive(encoderSensEnum.YESPERSON); blankEncoderInterface(); bool changed = false; if(m == Constants.Menuitem_modes.POWERGRAVITATORY) { menuitem_mode_selected_power_gravitatory.Visible = true; //change encoderConfigurationCurrent if needed if(encoderConfigurationCurrent.has_inertia) { encoderConfigurationCurrent = new EncoderConfiguration(); //LINEAR, not INERTIAL changed = true; } currentEncoderGI = Constants.EncoderGI.GRAVITATORY; hbox_capture_1RM.Visible = true; notebook_encoder_capture_extra_mass.CurrentPage = 0; if(radio_encoder_analyze_individual_current_set.Active || radio_encoder_analyze_individual_current_session.Active) { radiobutton_encoder_analyze_1RM.Visible = true; if(radiobutton_encoder_analyze_1RM.Active) hbox_combo_encoder_analyze_1RM.Visible=true; radiobutton_encoder_analyze_neuromuscular_profile.Visible = true; } hbox_encoder_capture_1_or_cont.Visible = true; } else { menuitem_mode_selected_power_inertial.Visible = true; //change encoderConfigurationCurrent if needed if(! encoderConfigurationCurrent.has_inertia) { encoderConfigurationCurrent = new EncoderConfiguration( Constants.EncoderConfigurationNames.ROTARYAXISINERTIAL); encoderConfigurationCurrent.SetInertialDefaultOptions(); changed = true; } currentEncoderGI = Constants.EncoderGI.INERTIAL; hbox_capture_1RM.Visible = false; notebook_encoder_capture_extra_mass.CurrentPage = 1; radiobutton_encoder_analyze_1RM.Visible = false; hbox_combo_encoder_analyze_1RM.Visible=false; radiobutton_encoder_analyze_neuromuscular_profile.Visible = false; radio_encoder_capture_1set.Active = true; hbox_encoder_capture_1_or_cont.Visible = false; } encoderGuiChangesAfterEncoderConfigurationWin(true); if(changed) { prepareAnalyzeRepetitions (); } } else { //m == Constants.Menuitem_modes.OTHER (contacts / other) notebook_sup.CurrentPage = 0; hbox_other.Visible = true; menuitem_mode_selected_other.Visible = true; notebooks_change(4); on_extra_window_reaction_times_test_changed(new object(), new EventArgs()); radio_mode_reaction_times_small.Active = true; notebook_capture_analyze.CurrentPage = 0; notebook_capture_analyze.ShowTabs = false; //only capture tab is shown (only valid for "OTHER" tests) //notebook_capture_analyze.GetNthPage(2).Hide(); //hide jumpsProfile on other tests } //show the program notebook_start.CurrentPage = 1; //it's not visible at startup main_menu.Visible = true; if(m != Constants.Menuitem_modes.POWERGRAVITATORY && m != Constants.Menuitem_modes.POWERINERTIAL) { //don't change threshold if changing from jumpssimple to jumpsreactive ... if(last_menuitem_mode == null || ( m == Constants.Menuitem_modes.JUMPSSIMPLE && last_menuitem_mode != Constants.Menuitem_modes.JUMPSREACTIVE ) || ( m == Constants.Menuitem_modes.JUMPSREACTIVE && last_menuitem_mode != Constants.Menuitem_modes.JUMPSSIMPLE ) || ( m == Constants.Menuitem_modes.RUNSSIMPLE && last_menuitem_mode != Constants.Menuitem_modes.RUNSINTERVALLIC ) || ( m == Constants.Menuitem_modes.RUNSINTERVALLIC && last_menuitem_mode != Constants.Menuitem_modes.RUNSSIMPLE ) || m == Constants.Menuitem_modes.OTHER ) { if(threshold.SelectTresholdForThisMode(m)) { hscale_threshold.Value = threshold.SetHScaleValue(); last_menuitem_mode = m; } } } chronopicRegisterUpdate(false); chronojumpWindowTestsNext(); }
/* * in the past we pass here an string, and an option was ALL * now we use Menuitem_modes an UNDEFINED will work as ALL */ private void button_video_play_selected_test(Constants.Menuitem_modes m) { if (m == Constants.Menuitem_modes.JUMPSSIMPLE || m == Constants.Menuitem_modes.UNDEFINED) { button_video_play_selected_jump.Sensitive = (myTreeViewJumps.EventSelectedID > 0 && File.Exists(Util.GetVideoFileName( currentSession.UniqueID, Constants.TestTypes.JUMP, myTreeViewJumps.EventSelectedID))); } if (m == Constants.Menuitem_modes.JUMPSREACTIVE || m == Constants.Menuitem_modes.UNDEFINED) { button_video_play_selected_jump_rj.Sensitive = (myTreeViewJumpsRj.EventSelectedID > 0 && File.Exists(Util.GetVideoFileName( currentSession.UniqueID, Constants.TestTypes.JUMP_RJ, myTreeViewJumpsRj.EventSelectedID))); } if (m == Constants.Menuitem_modes.RUNSSIMPLE || m == Constants.Menuitem_modes.UNDEFINED) { button_video_play_selected_run.Sensitive = (myTreeViewRuns.EventSelectedID > 0 && File.Exists(Util.GetVideoFileName( currentSession.UniqueID, Constants.TestTypes.RUN, myTreeViewRuns.EventSelectedID))); } if (m == Constants.Menuitem_modes.RUNSINTERVALLIC || m == Constants.Menuitem_modes.UNDEFINED) { button_video_play_selected_run_interval.Sensitive = (myTreeViewRunsInterval.EventSelectedID > 0 && File.Exists(Util.GetVideoFileName( currentSession.UniqueID, Constants.TestTypes.RUN_I, myTreeViewRunsInterval.EventSelectedID))); } if (m == Constants.Menuitem_modes.RT || m == Constants.Menuitem_modes.UNDEFINED) { button_video_play_selected_reaction_time.Sensitive = (myTreeViewReactionTimes.EventSelectedID > 0 && File.Exists(Util.GetVideoFileName( currentSession.UniqueID, Constants.TestTypes.RT, myTreeViewReactionTimes.EventSelectedID))); } if (m == Constants.Menuitem_modes.OTHER || m == Constants.Menuitem_modes.UNDEFINED) { button_video_play_selected_pulse.Sensitive = (myTreeViewPulses.EventSelectedID > 0 && File.Exists(Util.GetVideoFileName( currentSession.UniqueID, Constants.TestTypes.PULSE, myTreeViewPulses.EventSelectedID))); button_video_play_selected_multi_chronopic.Sensitive = (myTreeViewMultiChronopic.EventSelectedID > 0 && File.Exists(Util.GetVideoFileName( currentSession.UniqueID, Constants.TestTypes.MULTICHRONOPIC, myTreeViewMultiChronopic.EventSelectedID))); } }