示例#1
0
        private void comboBoxLocation_SelectedIndexChanged(object sender, EventArgs e)
        {
            string selected = (string)comboBoxLocation.SelectedItem;

            if (selected == "Location manager...")
            {
                // launch location manager
                LocationManager lm = new LocationManager(KeePassRPCPlugin);

                if (lm.ShowDialog() == DialogResult.OK)
                    UpdateLocations();
            }
            else if (selected == "Anywhere")
            {
                // use default home group
                _location = "";
                _status = KeeFoxHomeStatus.Unknown;
                UpdateStatus();
            }
            else
            {
                // use custom home group for this location if it's been set
                //string klrgs = KeePassRPCPlugin._host.CustomConfig.GetString("KeePassRPC.knownLocations." + selected + ".RootGroups","");
                //if (!string.IsNullOrEmpty(klrgs))
                //{
                //    string[] rootGroups = new string[0];

                //    rootGroups = klrgs.Split(',');
                //foreach (string rootGroupId in rootGroups)
                //{
                //    PwUuid pwuuid = new PwUuid(KeePassLib.Utility.MemUtil.HexStringToByteArray(rootGroupId));
                //    PwGroup matchedGroup = KeePassRPCPlugin._host.Database.RootGroup.Uuid == pwuuid ? KeePassRPCPlugin._host.Database.RootGroup : KeePassRPCPlugin._host.Database.RootGroup.FindGroup(pwuuid, true);

                //    if (matchedGroup == null)
                //        continue;

                _location = selected;

                    // update our idea of what the root group is so we can then refresh the dialog details and update the required behaviour if the user clicks the "make root" button
                    _status = KeeFoxHomeStatus.Unknown;
                    UpdateStatus();
                    //host.Database.CustomData.Set("KeePassRPC.KeeFox.rootUUID", rootGroupId);
                    //host.MainWindow.UpdateUI(false, null, true, null, true, null, true);
                    //break;
               // }
               // }
            }
        }