Example #1
0
        /// <summary>Register for the FormClosing event.</summary>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (ParentForm != null)
            {
                // Save the settings on FormClosing.
                ParentForm.FormClosing += delegate(object sender2, FormClosingEventArgs e2)
                {
                    if (ParentForm.DialogResult == DialogResult.OK)
                    {
                        WinHelloUnlockExt.LockAfterAutoType = checkBox1.Checked;
                        if (checkBox1.Checked)
                        {
                            WinHelloUnlockExt.database.CustomData.Set(WinHelloUnlockExt.ProductName + "AT", "true");
                        }
                        else
                        {
                            WinHelloUnlockExt.database.CustomData.Set(WinHelloUnlockExt.ProductName + "AT", "false");
                        }

                        if (onOpenEnabled != checkBox.Checked.ToString())
                        {
                            if (checkBox.Checked)
                            {
                                WinHelloUnlockExt.database.CustomData.Set(WinHelloUnlockExt.ProductName, "true");
                                WinHelloUnlockExt.enablePlugin = true;
                            }
                            else
                            {
                                if (deleteButton.Enabled)
                                {
                                    UWPLibrary.DeleteHelloData(WinHelloUnlockExt.dbName);
                                }
                                WinHelloUnlockExt.database.CustomData.Set(WinHelloUnlockExt.ProductName, "false");
                                WinHelloUnlockExt.enablePlugin = false;
                            }
                        }

                        WinHelloUnlockExt.database.Modified = true;
                        try { WinHelloUnlockExt.database.Save(null); }
                        catch { }

                        //WinHelloUnlockExt.database.Save(null);
                    }
                };
            }
        }
Example #2
0
 /// <summary>
 /// When the plugin detects a change in the MasterKey, it uses this method to prompt the user to update or delete the data
 /// </summary>
 /// <param name="ioInfo">IOConnectionInfo that represents the database.</param>
 /// <param name="dbPath">Name of the credential to update or delete.</param>
 /// <param name="opening">If the masterkey change was detected during database unlock use true.</param>
 internal static async Task HandleMasterKeyChange(IOConnectionInfo ioInfo, string dbPath, bool opening)
 {
     if (opening)
     {
         string str = WinHelloUnlockExt.ProductName + " could not unlock this database." +
                      " MasterKey must have changed. Delete " + WinHelloUnlockExt.ProductName + " data?";
         if (MessageService.AskYesNo(str, WinHelloUnlockExt.ProductName))
         {
             UWPLibrary.DeleteHelloData(dbPath);
         }
         WinHelloUnlockExt.opened = true;
         WinHelloUnlockExt.Host.MainWindow.OpenDatabase(ioInfo, null, false);
     }
     else
     {
         string str = "A change in MasterKey has been detected. Do you want to update " +
                      WinHelloUnlockExt.ProductName + " data?";
         if (MessageService.AskYesNo(str, WinHelloUnlockExt.ProductName))
         {
             UWPLibrary.DeleteHelloData(dbPath);
             await UWPLibrary.CreateHelloData(dbPath);
         }
     }
 }
Example #3
0
 /// <summary>Deletes WinHelloUnock data when the Delete Button is clicked.</summary>
 private void DeleteteButton_Click(object sender, EventArgs e)
 {
     UWPLibrary.DeleteHelloData(WinHelloUnlockExt.dbName);
     RefreshOptions();
 }