Exemple #1
0
        } // btnAdd_Click

        private void btnRemove_Click(object sender, EventArgs e)
        {
            // 
            // Remove the selected callsign account from the local site.
            // 
            string strAccount = cmbAccount.Text.ToUpper().Trim();
            if ((Globals.SiteCallsign ?? "") == (strAccount ?? ""))
            {
                MessageBox.Show(
                    "The site callsign account cannot be removed from the Accounts menu!" + Globals.CR +
                    "Use the Properties menu to change the site callsign.", "Remove Account",
                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (MessageBox.Show(
                "Confirm removal of '" + strAccount + "' from the this site?",
                "Confirm Remove",
                MessageBoxButtons.YesNoCancel) == DialogResult.Cancel)
                return;
            string strAccountList = Globals.Settings.Get("Properties", "Account Names", "");
            while (strAccountList.IndexOf(strAccount + "|") != -1) // This added to delete multiples if they exist
                strAccountList = strAccountList.Replace(strAccount + "|", "");
            Globals.Settings.Save("Properties", "Account Names", strAccountList);

            var messageStore = new MessageStore(DatabaseFactory.Get());
            messageStore.DeleteAccountEmails(strAccount);

            Globals.Settings.DeleteGroup(strAccount);
            Accounts.RefreshAccountsList();
            FillAccountSelection();
        } // btnRemove_Click
Exemple #2
0
        } // AddRadioAccount

        public bool RemoveRadioAccount(string strCallsign)
        {
            string strAccountList = Globals.Settings.Get("Properties", "Account Names", "");

            strAccountList = strAccountList.Replace(strCallsign + "|", "");
            Globals.Settings.Save("Properties", "Site Callsign", "");
            Globals.Settings.Save("Properties", "Site Password", "");
            Globals.Settings.Save("Properties", "Secure Login Password", "");
            Globals.Settings.Save("Properties", "EMail Password", "");
            Globals.Settings.Save("Properties", "Account Names", strAccountList);
            Globals.Settings.DeleteGroup(strCallsign);

            // Remove callsign account directory...
            try
            {
                var messageStore = new MessageStore(DatabaseFactory.Get());
                messageStore.DeleteAccountEmails(strCallsign);
            }
            catch (Exception ex)
            {
                Log.Error("[Properties.RemoveRadioAccount] " + ex.Message);
            }

            return(default);