private void ChkContextEntry_CheckedChanged(object sender, EventArgs e) { try { if (chkContextEntry.Checked && !RegistryUtil.IsAppRegistered()) { RegistryUtil.RegisterApp(); MessageBox.Show(Resources.str_message_register_context_menu_success, Resources.str_main_window_title, MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (!chkContextEntry.Checked && RegistryUtil.IsAppRegistered()) { RegistryUtil.UnRegisterApp(); MessageBox.Show(Resources.str_message_unregister_context_menu_success, Resources.str_main_window_title, MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message + "\n" + Resources.str_message_run_as_admin, Resources.str_main_window_title, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Run only config update /// </summary> /// <param name="args">Command line arguments</param> /// <returns>Exit code</returns> static int RunConfig(ArgsConfig args) { ApplyCommonArgs(args); try { if (args.Register) { RegistryUtil.RegisterApp(); } if (args.Unregister) { RegistryUtil.UnRegisterApp(); } } catch (Exception ex) { Console.Error.WriteLine(ex.Message + "\n" + Resources.str_message_run_as_admin); return(1); } return(0); }