Example #1
0
 private void FormSettings_Load(object sender, EventArgs e)
 {
     LinkedTweaks.LoadValues();
     UpdateGamesTab();
     RefreshNMUI();
     if (IniFiles.Config.GetBool("NexusMods", "bAutoUpdateProfile", true))
     {
         UpdateNMProfile();
     }
     this.checkBoxHandleNXMLinks.Checked = NXMHandler.IsRegistered();
 }
Example #2
0
        private void checkBoxHandleNXMLinks_CheckedChanged(object sender, EventArgs e)
        {
            bool isRegistered = NXMHandler.IsRegistered();

            if (isRegistered == checkBoxHandleNXMLinks.Checked)
            {
                return;
            }

            try
            {
                if (isRegistered)
                {
                    NXMHandler.Unregister();
                }
                else
                {
                    NXMHandler.Register();
                }
            }
            catch (UnauthorizedAccessException ex)
            {
                if (!Utils.HasAdminRights())
                {
                    MsgBox.Show("Access denied", "Start the tool as admin and try again.", MessageBoxIcon.Error);
                }
                else
                {
                    MsgBox.Show(ex.GetType().ToString(), ex.ToString(), MessageBoxIcon.Error);
                }
                checkBoxHandleNXMLinks.Checked = isRegistered;
            }
            catch (Exception ex)
            {
                if (!Utils.HasAdminRights())
                {
                    MsgBox.Show("Unknown error", "Start the tool as admin and try again.", MessageBoxIcon.Error);
                }
                else
                {
                    MsgBox.Show(ex.GetType().ToString(), ex.ToString(), MessageBoxIcon.Error);
                }
                checkBoxHandleNXMLinks.Checked = isRegistered;
            }
        }