private void BtnOK_Click(object sender, EventArgs e) { try { Guid apiKey; var parse = Guid.TryParse(txtAPIKey.Text.Trim(), out apiKey); if (parse) { _wakaTimeConfigFile.ApiKey = apiKey.ToString(); _wakaTimeConfigFile.Proxy = txtProxy.Text; if (cbbLogLevel.SelectedIndex > -1) { Logger.Debug("LogLevel set to {0}", cbbLogLevel.SelectedItem.ToString()); _wakaTimeConfigFile.logLevel = (LogLevel)Enum.Parse(typeof(LogLevel), cbbLogLevel.SelectedItem.ToString()); } else { _wakaTimeConfigFile.logLevel = LogLevel.None; } _wakaTimeConfigFile.PythonBinaryLocation = cbPythonAutolocate.Checked ? "" : txtPythonLocation.Text; _wakaTimeConfigFile.Save(); ConfigSaved?.Invoke(this, EventArgs.Empty); } else { MessageBox.Show("Please enter valid Api Key."); DialogResult = DialogResult.None; // do not close dialog box } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
internal static void Postfix(CameraPlus.Configuration.CameraConfig __instance) { // 保存したことはわかるがどのコンフィグなのかは不明なので今のところ使えない。 ConfigSaved?.Invoke(__instance); }