public static Update ( string myName, string myValue, bool dbconOpened ) : void | ||
myName | string | |
myValue | string | |
dbconOpened | bool | |
return | void |
private void on_checkbutton_video_encoder_clicked(object o, EventArgs args) { if (checkbutton_video_encoder.Active) { if (preferences.videoDevice == "") //on mac can be "0"... || preferences.videoDevice == "0") { new DialogMessage(Constants.MessageTypes.WARNING, "Video device is not configured. Check Preferences / Multimedia."); checkbutton_video_encoder.Active = false; return; } preferences.videoOn = true; SqlitePreferences.Update("videoOn", "True", false); } else { preferences.videoOn = false; SqlitePreferences.Update("videoOn", "False", false); } //change contacts checkbox but don't raise the signal checkbutton_video.Clicked -= new EventHandler(on_checkbutton_video_clicked); checkbutton_video.Active = preferences.videoOn; checkbutton_video.Clicked += new EventHandler(on_checkbutton_video_clicked); changeVideoButtons(preferences.videoOn); //will start on record videoCapturePrepare(true); //if error, show message }
//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 void on_menuitem_view_persons_show_photo_toggled(object o, EventArgs args) { bool showPhoto = menuitem_view_persons_show_photo.Active; SqlitePreferences.Update("personPhoto", showPhoto.ToString(), false); preferences.personPhoto = showPhoto; showPersonPhoto(showPhoto); }
private void on_menuitem_view_persons_on_top_toggled(object o, EventArgs args) { bool personsOnTop = menuitem_view_persons_on_top.Active; LogB.Information("Toggled: " + personsOnTop.ToString()); SqlitePreferences.Update("personWinHide", personsOnTop.ToString(), false); preferences.personWinHide = personsOnTop; showPersonsOnTop(personsOnTop); }
//force sensor public void UpdateForceSensorTare(double tare) { if (tare == -1) { return; } //change preferences object and SqlitePreferences DateTime dt = DateTime.Now; forceSensorTareDateTime = UtilDate.ToFile(dt); SqlitePreferences.Update(SqlitePreferences.ForceSensorTareDateTimeStr, forceSensorTareDateTime, false); forceSensorTare = tare; SqlitePreferences.Update(SqlitePreferences.ForceSensorTareStr, Util.ConvertToPoint(tare), false); }
private void on_button_send_log_clicked(object o, EventArgs args) { string email = entry_send_log.Text.ToString(); //email can be validated with Util.IsValidEmail(string) //or other methods, but maybe there's no need of complexity now //1st save email on sqlite if (email != null && email != "" && email != "0" && email != emailStored) { SqlitePreferences.Update("email", email, false); } //2nd add language as comments string language = get_send_log_language(); SqlitePreferences.Update("crashLogLanguage", language, false); string comments = "Answer in: " + language + "\n"; //3rd if there are comments, add them at the beginning of the file comments += textview_comments.Buffer.Text; //4th send Json Json js = new Json(); bool success = js.PostCrashLog(email, comments); if (success) { button_send_log.Label = Catalog.GetString("Thanks"); button_send_log.Sensitive = false; image_send_log_yes.Show(); image_send_log_no.Hide(); LogB.Information(js.ResultMessage); } else { button_send_log.Label = Catalog.GetString("Try again"); image_send_log_yes.Hide(); image_send_log_no.Show(); LogB.Error(js.ResultMessage); } label_send_log_message.Text = js.ResultMessage; }
private static void createBlankDBServer() { LogB.SQL("Creating blank database for server"); if (Sqlite.CheckFileServer()) { LogB.Error("File already exists. Cannot create."); } else { Sqlite.ConnectServer(); Sqlite.CreateFile(); Sqlite.CreateTables(true); //server LogB.SQL("Created blank database! Exiting"); string myVersion = UtilAll.ReadVersion(); LogB.Warning("CAUTION: client info about versionAvailable (on server): ", myVersion); SqlitePreferences.Update("availableVersion", myVersion, false); LogB.Information("Maybe you don't want to show this version on pings, change it to last stable published version"); } }
//force sensor public void UpdateForceSensorCalibration(double weight, double calibrationFactor) { if (calibrationFactor == -1) { return; } //change preferences object and SqlitePreferences DateTime dt = DateTime.Now; forceSensorCalibrationDateTime = UtilDate.ToFile(dt); SqlitePreferences.Update(SqlitePreferences.ForceSensorCalibrationDateTimeStr, forceSensorCalibrationDateTime, false); forceSensorCalibrationWeight = weight; SqlitePreferences.Update(SqlitePreferences.ForceSensorCalibrationWeightStr, Util.ConvertToPoint(weight), false); forceSensorCalibrationFactor = calibrationFactor; SqlitePreferences.Update(SqlitePreferences.ForceSensorCalibrationFactorStr, Util.ConvertToPoint(calibrationFactor), false); }
public static void ServerUploadEvaluator() { try { ChronojumpServer myServer = new ChronojumpServer(); LogB.Information(myServer.ConnectDatabase()); ServerEvaluator myEval = SqliteServer.SelectEvaluator(1); bool success = false; int evalSID = Convert.ToInt32(SqlitePreferences.Select("evaluatorServerID")); if (evalSID == Constants.ServerUndefinedID) { string idCode = myServer.UploadEvaluator(myEval); myEval.Code = Util.FetchName(idCode); myEval.Update(false); evalSID = Util.FetchID(idCode); SqlitePreferences.Update("evaluatorServerID", evalSID.ToString(), false); success = true; } else { success = myServer.EditEvaluator(myEval, evalSID); } if (success) { new DialogMessage(Constants.MessageTypes.INFO, string.Format(Catalog.GetString("Successfully Uploaded evaluator with ID: {0}"), evalSID)); } else { new DialogMessage(Constants.MessageTypes.WARNING, string.Format(Catalog.GetString("Evaluator {0} has not been correctly uploaded. Maybe codes doesn't match."), evalSID)); } LogB.Information(myServer.DisConnectDatabase()); } catch { new DialogMessage(Constants.MessageTypes.WARNING, Constants.ServerOffline); } }
public bool EncoderChangeMinHeight(bool inertial, int minHeight) { bool changed = false; if (inertial && minHeight != encoderCaptureMinHeightInertial) { encoderCaptureMinHeightInertial = minHeight; SqlitePreferences.Update("encoderCaptureMinHeightInertial", minHeight.ToString(), false); changed = true; } else if (!inertial && minHeight != encoderCaptureMinHeightGravitatory) { encoderCaptureMinHeightGravitatory = minHeight; SqlitePreferences.Update("encoderCaptureMinHeightGravitatory", minHeight.ToString(), false); changed = true; } return(changed); }
protected void sqliteThings() { configChronojump = new Config(); configChronojump.Read(); bool badExit = checkIfChronojumpExitAbnormally(); if (badExit) { if (chronojumpIsExecutingNTimes()) { messageToShowOnBoot += Catalog.GetString("Chronojump is already running") + "\n\n" + Catalog.GetString("Chronojump will exit now."); chronojumpHasToExit = true; quitNowCjTwoTimes = true; LogB.Error("Chronojump is already running."); return; } else { chronojumpCrashedBefore(); } } //print version of chronojump progVersion = BuildInfo.chronojumpVersion; LogB.Information("Chronojump version: {0}", progVersion); //to store user videos and photos Util.CreateMultimediaDirsIfNeeded(); //to store (encoder, force sensor, run encoder) data and graphs UtilEncoder.CreateEncoderDirIfNeeded(); Util.CreateForceSensorDirIfNeeded(); Util.CreateRaceAnalyzerDirIfNeeded(); //TODO: when a session is deleted, encoder data has to be deleted, also multimedia videos, I suppose. Show message to user warning about it //TODO: encoder weight auto written depending on person loaded, and changes if it changes person or weight //move database to new location if chronojump version is before 0.7 moveDatabaseToNewLocationIfNeeded(); LogB.Information("move? ended"); splashMessageChange(1); //checking database /* * splashMessage = "pre-connect"; * needUpdateSplashMessage = true; * Console.ReadLine(); */ Sqlite.CreateDir(); bool defaultDBLocation = Sqlite.Connect(); LogB.SQL("sqlite connected"); /* * splashMessage = "post-connect" + defaultDBLocation.ToString(); * needUpdateSplashMessage = true; * Console.ReadLine(); */ //Chech if the DB file exists if (!Sqlite.CheckTables(defaultDBLocation)) { LogB.SQL(Catalog.GetString("no tables, creating ...")); creatingDB = true; splashMessageChange(2); //creating database /* * splashMessage = "pre-create"; * needUpdateSplashMessage = true; * Console.ReadLine(); */ Sqlite.CreateDir(); Sqlite.CreateFile(); //Sqlite.CreateFile(defaultDBLocation); /* * splashMessage = "post-create"; * needUpdateSplashMessage = true; * Console.ReadLine(); */ createRunningFileName(runningFileName); Sqlite.CreateTables(false); //not server creatingDB = false; } else { LogB.SQL("doing backup"); //backup the database Util.BackupDirCreateIfNeeded(); splashMessageChange(3); //making db backup Util.BackupDatabase(); LogB.SQL("made a database backup"); //not compressed yet, it seems System.IO.Compression.DeflateStream and //System.IO.Compression.GZipStream are not in mono if (!Sqlite.IsSqlite3()) { bool ok = Sqlite.ConvertFromSqlite2To3(); if (!ok) { LogB.Error("problem with sqlite"); //check (spanish) //http://mail.gnome.org/archives/chronojump-devel-list/2008-March/msg00011.html string errorMessage = Catalog.GetString("Failed database conversion, ensure you have libsqlite3-0 installed. \nIf problems persist ask in chronojump-list"); errorMessage += "\n\n" + string.Format(Catalog.GetString("If you have no data on your database (you just installed Chronojump), you can fix this problem deleting this file: {0}"), Util.GetDatabaseDir() + Path.DirectorySeparatorChar + "chronojump.db") + "\n" + Catalog.GetString("And starting Chronojump again."); LogB.Error(errorMessage); messageToShowOnBoot += errorMessage; chronojumpHasToExit = true; return; } Sqlite.Connect(); } splashMessageChange(4); //updating DB updatingDB = true; if (Sqlite.ChangeDjToDJna()) { messageToShowOnBoot += Catalog.GetString("All DJ jumps have been renamed as 'DJna' (Drop Jumps with No Arms).") + "\n\n" + Catalog.GetString("If your Drop Jumps were executed using the arms, please rename them manually as 'DJa'.") + "\n"; } bool softwareIsNew = Sqlite.ConvertToLastChronojumpDBVersion(); updatingDB = false; if (!softwareIsNew) { //Console.Clear(); string errorMessage = string.Format(Catalog.GetString("Sorry, this Chronojump version ({0}) is too old for your database."), progVersion) + "\n" + Catalog.GetString("Please update Chronojump") + ":\n"; errorMessage += "http://chronojump.org"; //errorMessage += "\n\n" + Catalog.GetString("Press any key"); LogB.Error(errorMessage); messageToShowOnBoot += errorMessage; chronojumpHasToExit = true; } LogB.Information(Catalog.GetString("tables already created")); //check for bad Rjs (activate if program crashes and you use it in the same db before v.0.41) //SqliteJump.FindBadRjs(); createRunningFileName(runningFileName); } //splashMessageChange(5); //check for new version splashMessageChange(5); //connecting to server messageToShowOnBoot += recuperateBrokenEvents(); //connect to server to Ping versionAvailable = ""; versionAvailable = Constants.ServerOffline; //doing ping using json methods /* * temporarily disabled on start * string machineID = SqlitePreferences.Select("machineID", false); * Json js = new Json(); * bool success = js.Ping(UtilAll.GetOS(), progVersion, machineID); * if(success) * LogB.Information(js.ResultMessage); * else * LogB.Error(js.ResultMessage); */ allSQLCallsDoneOnSqliteThingsThread = false; //wait until pinging ends (or it's cancelled) //while(! pingEnd) { //} Sqlite.Open(); //TODO: fix this to the new code string versionAvailableKnown = SqlitePreferences.Select("versionAvailable", true); if (versionAvailable != Constants.ServerOffline && new Version(versionAvailable) > new Version(progVersion)) { //check if available version is higher than known available version Version versionAvailableAsV = new Version(versionAvailable); Version versionAvailableKnownAsV; bool updateKnownVersion = false; if (versionAvailableKnown == "") { updateKnownVersion = true; } else { versionAvailableKnownAsV = new Version(versionAvailableKnown); if (versionAvailableAsV > versionAvailableKnownAsV) { updateKnownVersion = true; } } if (updateKnownVersion) { //is the first time we know about this new version //just write on db and show message to user SqlitePreferences.Update(Constants.PrefVersionAvailable, versionAvailable, true); versionAvailableKnown = versionAvailable; messageToShowOnBoot += string.Format(Catalog.GetString( "\nNew Chronojump version available on website.\nYour Chronojump version is: {1}"), versionAvailable, progVersion) + "\n\n" + Catalog.GetString("Please, update to new version.") + "\n"; } } //if chronojump chrashed before if (badExit) { if (versionAvailableKnown.Length > 0 && new Version(versionAvailableKnown) > new Version(progVersion)) { messageToShowOnBoot += "\n" + Catalog.GetString("Chronojump crashed before.") + "\n" + Catalog.GetString("Please, update to new version: ") + versionAvailableKnown + "\n"; } else { messageToShowOnBoot += messageCrashedBefore; //SqlitePreferences.Update("videoOn", "False", true); } } splashMessageChange(6); //preparing main window //start as "simulated" SqlitePreferences.Update("simulated", "True", true); //dbcon opened Sqlite.Close(); // Chronojump sqlite is in an initialized state, let's keep the Sqlite state here // to be re-used Sqlite.saveClassState(); allSQLCallsDoneOnSqliteThingsThread = true; LogB.SQL("all SQL calls done on sqliteThings thread"); UtilAll.IsWindows(); //only as additional info here //Application.Init(); needEndSplashWin = true; }
//change stuff in Sqlite and in preferences object that will be retrieved by GetPreferences void on_button_accept_clicked(object o, EventArgs args) { Sqlite.Open(); if (preferences.digitsNumber != Convert.ToInt32(UtilGtk.ComboGetActive(combo_decimals))) { SqlitePreferences.Update("digitsNumber", UtilGtk.ComboGetActive(combo_decimals), true); preferences.digitsNumber = Convert.ToInt32(UtilGtk.ComboGetActive(combo_decimals)); } if (preferences.showPower != PreferencesWindowBox.checkbutton_power.Active) { SqlitePreferences.Update("showPower", PreferencesWindowBox.checkbutton_power.Active.ToString(), true); preferences.showPower = PreferencesWindowBox.checkbutton_power.Active; } if (preferences.showStiffness != PreferencesWindowBox.checkbutton_stiffness.Active) { SqlitePreferences.Update("showStiffness", PreferencesWindowBox.checkbutton_stiffness.Active.ToString(), true); preferences.showStiffness = PreferencesWindowBox.checkbutton_stiffness.Active; } if (preferences.showInitialSpeed != PreferencesWindowBox.checkbutton_initial_speed.Active) { SqlitePreferences.Update("showInitialSpeed", PreferencesWindowBox.checkbutton_initial_speed.Active.ToString(), true); preferences.showInitialSpeed = PreferencesWindowBox.checkbutton_initial_speed.Active; } if (preferences.showAngle != PreferencesWindowBox.checkbutton_angle.Active) { SqlitePreferences.Update("showAngle", PreferencesWindowBox.checkbutton_angle.Active.ToString(), true); preferences.showAngle = PreferencesWindowBox.checkbutton_angle.Active; } if (PreferencesWindowBox.checkbutton_show_tv_tc_index.Active) { SqlitePreferences.Update("showQIndex", PreferencesWindowBox.radiobutton_show_q_index.Active.ToString(), true); SqlitePreferences.Update("showDjIndex", PreferencesWindowBox.radiobutton_show_dj_index.Active.ToString(), true); preferences.showQIndex = PreferencesWindowBox.radiobutton_show_q_index.Active; preferences.showDjIndex = PreferencesWindowBox.radiobutton_show_dj_index.Active; } else { SqlitePreferences.Update("showQIndex", "False", true); SqlitePreferences.Update("showDjIndex", "False", true); preferences.showQIndex = false; preferences.showDjIndex = false; } if (preferences.askDeletion != PreferencesWindowBox.checkbutton_ask_deletion.Active) { SqlitePreferences.Update("askDeletion", PreferencesWindowBox.checkbutton_ask_deletion.Active.ToString(), true); preferences.askDeletion = PreferencesWindowBox.checkbutton_ask_deletion.Active; } if (preferences.weightStatsPercent != PreferencesWindowBox.radio_weight_percent.Active) { SqlitePreferences.Update("weightStatsPercent", PreferencesWindowBox.radio_weight_percent.Active.ToString(), true); preferences.weightStatsPercent = PreferencesWindowBox.radio_weight_percent.Active; } if (preferences.heightPreferred != PreferencesWindowBox.radio_elevation_height.Active) { SqlitePreferences.Update("heightPreferred", PreferencesWindowBox.radio_elevation_height.Active.ToString(), true); preferences.heightPreferred = PreferencesWindowBox.radio_elevation_height.Active; } if (preferences.metersSecondsPreferred != PreferencesWindowBox.radio_speed_ms.Active) { SqlitePreferences.Update("metersSecondsPreferred", PreferencesWindowBox.radio_speed_ms.Active.ToString(), true); preferences.metersSecondsPreferred = PreferencesWindowBox.radio_speed_ms.Active; } if (preferences.runSpeedStartArrival != PreferencesWindowBox.radio_runs_speed_start_arrival.Active) { SqlitePreferences.Update("runSpeedStartArrival", PreferencesWindowBox.radio_runs_speed_start_arrival.Active.ToString(), true); preferences.runSpeedStartArrival = PreferencesWindowBox.radio_runs_speed_start_arrival.Active; } //start of double contacts stuff ---- //1 simple runs ---- //1.1 was FIRST or AVERAGE or LAST and now will be NONE if ((preferences.runDoubleContactsMode != Constants.DoubleContact.NONE) && !PreferencesWindowBox.checkbutton_runs_prevent_double_contact.Active) { SqlitePreferences.Update("runDoubleContactsMode", Constants.DoubleContact.NONE.ToString(), true); preferences.runDoubleContactsMode = Constants.DoubleContact.NONE; } else if (PreferencesWindowBox.checkbutton_runs_prevent_double_contact.Active) { //1.2 mode has changed between FIRST, AVERAGE or LAST if (PreferencesWindowBox.radio_runs_prevent_double_contact_first.Active && (preferences.runDoubleContactsMode != Constants.DoubleContact.FIRST)) { SqlitePreferences.Update("runDoubleContactsMode", Constants.DoubleContact.FIRST.ToString(), true); preferences.runDoubleContactsMode = Constants.DoubleContact.FIRST; } else if (PreferencesWindowBox.radio_runs_prevent_double_contact_average.Active && (preferences.runDoubleContactsMode != Constants.DoubleContact.AVERAGE)) { SqlitePreferences.Update("runDoubleContactsMode", Constants.DoubleContact.AVERAGE.ToString(), true); preferences.runDoubleContactsMode = Constants.DoubleContact.AVERAGE; } else if (PreferencesWindowBox.radio_runs_prevent_double_contact_last.Active && (preferences.runDoubleContactsMode != Constants.DoubleContact.LAST)) { SqlitePreferences.Update("runDoubleContactsMode", Constants.DoubleContact.LAST.ToString(), true); preferences.runDoubleContactsMode = Constants.DoubleContact.LAST; } if (preferences.runDoubleContactsMS != (int)PreferencesWindowBox.spinbutton_runs_prevent_double_contact.Value) { SqlitePreferences.Update("runDoubleContactsMS", PreferencesWindowBox.spinbutton_runs_prevent_double_contact.Value.ToString(), true); //saved as string preferences.runDoubleContactsMS = (int)spinbutton_runs_prevent_double_contact.Value; } } //2 intervallic runs ---- //2.1 was FIRST or AVERAGE or LAST and now will be NONE if ((preferences.runIDoubleContactsMode != Constants.DoubleContact.NONE) && !PreferencesWindowBox.checkbutton_runs_i_prevent_double_contact.Active) { SqlitePreferences.Update("runIDoubleContactsMode", Constants.DoubleContact.NONE.ToString(), true); preferences.runIDoubleContactsMode = Constants.DoubleContact.NONE; } else if (PreferencesWindowBox.checkbutton_runs_i_prevent_double_contact.Active) { //2.2 mode has changed between FIRST, AVERAGE or LAST if (PreferencesWindowBox.radio_runs_i_prevent_double_contact_first.Active && (preferences.runIDoubleContactsMode != Constants.DoubleContact.FIRST)) { SqlitePreferences.Update("runIDoubleContactsMode", Constants.DoubleContact.FIRST.ToString(), true); preferences.runIDoubleContactsMode = Constants.DoubleContact.FIRST; } else if (PreferencesWindowBox.radio_runs_i_prevent_double_contact_average.Active && (preferences.runIDoubleContactsMode != Constants.DoubleContact.AVERAGE)) { SqlitePreferences.Update("runIDoubleContactsMode", Constants.DoubleContact.AVERAGE.ToString(), true); preferences.runIDoubleContactsMode = Constants.DoubleContact.AVERAGE; } else if (PreferencesWindowBox.radio_runs_i_prevent_double_contact_last.Active && (preferences.runIDoubleContactsMode != Constants.DoubleContact.LAST)) { SqlitePreferences.Update("runIDoubleContactsMode", Constants.DoubleContact.LAST.ToString(), true); preferences.runIDoubleContactsMode = Constants.DoubleContact.LAST; } if (preferences.runIDoubleContactsMS != (int)PreferencesWindowBox.spinbutton_runs_i_prevent_double_contact.Value) { SqlitePreferences.Update("runIDoubleContactsMS", PreferencesWindowBox.spinbutton_runs_i_prevent_double_contact.Value.ToString(), true); //saved as string preferences.runIDoubleContactsMS = (int)spinbutton_runs_i_prevent_double_contact.Value; } } //---- end of double contacts stuff if (preferences.encoderPropulsive != PreferencesWindowBox.checkbutton_encoder_propulsive.Active) { SqlitePreferences.Update("encoderPropulsive", PreferencesWindowBox.checkbutton_encoder_propulsive.Active.ToString(), true); preferences.encoderPropulsive = PreferencesWindowBox.checkbutton_encoder_propulsive.Active; } if (preferences.encoderSmoothCon != (double)PreferencesWindowBox.spin_encoder_smooth_con.Value) { SqlitePreferences.Update("encoderSmoothCon", Util.ConvertToPoint( (double)PreferencesWindowBox.spin_encoder_smooth_con.Value), true); preferences.encoderSmoothCon = (double)PreferencesWindowBox.spin_encoder_smooth_con.Value; } if (preferences.videoDeviceNum != UtilGtk.ComboGetActivePos(combo_camera)) { SqlitePreferences.Update("videoDevice", UtilGtk.ComboGetActivePos(combo_camera).ToString(), true); preferences.videoDeviceNum = UtilGtk.ComboGetActivePos(combo_camera); } if (PreferencesWindowBox.radio_export_latin.Active) { SqlitePreferences.Update("CSVExportDecimalSeparator", "COMMA", true); preferences.CSVExportDecimalSeparator = "COMMA"; } else { SqlitePreferences.Update("CSVExportDecimalSeparator", "POINT", true); preferences.CSVExportDecimalSeparator = "POINT"; } string selectedLanguage = getSelectedLanguage(); //if there was a language on SQL but now "detected" is selected, put "" in language on SQL if (preferences.language != "" && radio_language_detected.Active) { SqlitePreferences.Update("language", "", true); preferences.language = ""; } //if force a language, and SQL language is != than selected language, change language on SQL else if (radio_language_force.Active && preferences.language != selectedLanguage) { SqlitePreferences.Update("language", selectedLanguage, true); preferences.language = selectedLanguage; } if (preferences.RGraphsTranslate != PreferencesWindowBox.radio_graphs_translate.Active) { SqlitePreferences.Update("RGraphsTranslate", PreferencesWindowBox.radio_graphs_translate.Active.ToString(), true); preferences.RGraphsTranslate = PreferencesWindowBox.radio_graphs_translate.Active; } if (preferences.useHeightsOnJumpIndexes != PreferencesWindowBox.radio_use_heights_on_jump_indexes.Active) { SqlitePreferences.Update("useHeightsOnJumpIndexes", PreferencesWindowBox.radio_use_heights_on_jump_indexes.Active.ToString(), true); preferences.useHeightsOnJumpIndexes = PreferencesWindowBox.radio_use_heights_on_jump_indexes.Active; } if (PreferencesWindowBox.radio_encoder_auto_save_curve_best.Active) { SqlitePreferences.Update("encoderAutoSaveCurve", Constants.EncoderAutoSaveCurve.BEST.ToString(), true); preferences.encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.BEST; } else if (PreferencesWindowBox.radio_encoder_auto_save_curve_all.Active) { SqlitePreferences.Update("encoderAutoSaveCurve", Constants.EncoderAutoSaveCurve.ALL.ToString(), true); preferences.encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.ALL; } else { SqlitePreferences.Update("encoderAutoSaveCurve", Constants.EncoderAutoSaveCurve.NONE.ToString(), true); preferences.encoderAutoSaveCurve = Constants.EncoderAutoSaveCurve.NONE; } Constants.Encoder1RMMethod encoder1RMMethod; if (PreferencesWindowBox.radio_encoder_1RM_nonweighted.Active) { encoder1RMMethod = Constants.Encoder1RMMethod.NONWEIGHTED; } else if (PreferencesWindowBox.radio_encoder_1RM_weighted.Active) { encoder1RMMethod = Constants.Encoder1RMMethod.WEIGHTED; } else if (PreferencesWindowBox.radio_encoder_1RM_weighted2.Active) { encoder1RMMethod = Constants.Encoder1RMMethod.WEIGHTED2; } else // (PreferencesWindowBox.radio_encoder_1RM_weighted3.Active) { encoder1RMMethod = Constants.Encoder1RMMethod.WEIGHTED3; } SqlitePreferences.Update("encoder1RMMethod", encoder1RMMethod.ToString(), true); preferences.encoder1RMMethod = encoder1RMMethod; Sqlite.Close(); PreferencesWindowBox.preferences_win.Hide(); PreferencesWindowBox = null; }
public void UpdateEncoderRhythm(EncoderRhythm er) { if ( encoderRhythmActive != er.Active || encoderRhythmRepsOrPhases != er.RepsOrPhases || encoderRhythmRepSeconds != er.RepSeconds || encoderRhythmEccSeconds != er.EccSeconds || encoderRhythmConSeconds != er.ConSeconds || encoderRhythmRestRepsSeconds != er.RestRepsSeconds || encoderRhythmRestAfterEcc != er.RestAfterEcc || encoderRhythmRepsCluster != er.RepsCluster || encoderRhythmRestClustersSeconds != er.RestClustersSeconds ) { Sqlite.Open(); } else { return; } if (encoderRhythmActive != er.Active) { encoderRhythmActive = er.Active; SqlitePreferences.Update(SqlitePreferences.EncoderRhythmActiveStr, er.Active.ToString(), true); //bool } if (encoderRhythmRepsOrPhases != er.RepsOrPhases) { encoderRhythmRepsOrPhases = er.RepsOrPhases; SqlitePreferences.Update(SqlitePreferences.EncoderRhythmRepsOrPhasesStr, er.RepsOrPhases.ToString(), true); //bool } if (encoderRhythmRepSeconds != er.RepSeconds) { encoderRhythmRepSeconds = er.RepSeconds; SqlitePreferences.Update(SqlitePreferences.EncoderRhythmRepSecondsStr, Util.ConvertToPoint(er.RepSeconds), true); //double to point } if (encoderRhythmEccSeconds != er.EccSeconds) { encoderRhythmEccSeconds = er.EccSeconds; SqlitePreferences.Update(SqlitePreferences.EncoderRhythmEccSecondsStr, Util.ConvertToPoint(er.EccSeconds), true); //double to point } if (encoderRhythmConSeconds != er.ConSeconds) { encoderRhythmConSeconds = er.ConSeconds; SqlitePreferences.Update(SqlitePreferences.EncoderRhythmConSecondsStr, Util.ConvertToPoint(er.ConSeconds), true); //double to point } if (encoderRhythmRestRepsSeconds != er.RestRepsSeconds) { encoderRhythmRestRepsSeconds = er.RestRepsSeconds; SqlitePreferences.Update(SqlitePreferences.EncoderRhythmRestRepsSecondsStr, Util.ConvertToPoint(er.RestRepsSeconds), true); //double to point } if (encoderRhythmRestAfterEcc != er.RestAfterEcc) { encoderRhythmRestAfterEcc = er.RestAfterEcc; SqlitePreferences.Update(SqlitePreferences.EncoderRhythmRestAfterEccStr, er.RestAfterEcc.ToString(), true); //bool } if (encoderRhythmRepsCluster != er.RepsCluster) { encoderRhythmRepsCluster = er.RepsCluster; SqlitePreferences.Update(SqlitePreferences.EncoderRhythmRepsClusterStr, er.RepsCluster.ToString(), true); //int } if (encoderRhythmRestClustersSeconds != er.RestClustersSeconds) { encoderRhythmRestClustersSeconds = er.RestClustersSeconds; SqlitePreferences.Update(SqlitePreferences.EncoderRhythmRestClustersSecondsStr, Util.ConvertToPoint(er.RestClustersSeconds), true); //double to point } Sqlite.Close(); }