コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var userProfile = fProfile as UserProfile;

            string password = string.Empty;

            if (!InputDlg.QueryPassword(this, CommunicatorCore.APP_NAME, "Password", ref password))
            {
                return;
            }
            fCore.Identify(userProfile, password);

            userProfile.UserName  = txtUserName.Text;
            userProfile.Country   = txtCountry.Text;
            userProfile.TimeZone  = txtTimeZone.Text;
            userProfile.Languages = txtLanguages.Text;
            userProfile.Email     = txtEmail.Text;

            userProfile.IsCountryVisible   = chkCountryVisible.Checked;
            userProfile.IsTimeZoneVisible  = chkTimeZoneVisible.Checked;
            userProfile.IsLanguagesVisible = chkLanguagesVisible.Checked;
            userProfile.IsEmailVisible     = chkEmailVisible.Checked;

            fCore.Database.SaveProfile(userProfile);

            Close();
        }
コード例 #2
0
        private void tbAcceptInvitation_Click(object sender, EventArgs e)
        {
            string nodeId = string.Empty;

            if (InputDlg.QueryText(this, CommunicatorCore.APP_NAME, "Friend's node id received by mail", ref nodeId))
            {
                fCore.AcceptInvitation(nodeId);
            }
        }
コード例 #3
0
        private void miAddPeer_Click(object sender, EventArgs e)
        {
            string endpoint = string.Empty;

            if (InputDlg.QueryText(this, CommunicatorCore.APP_NAME, "Peer endpoint", ref endpoint))
            {
                if (Utilities.IsValidIpAddress(endpoint))
                {
                    var peerEndPoint = Utilities.ParseIPEndPoint(endpoint);
                    fCore.UpdatePeer(peerEndPoint);
                    ((IChatForm)this).OnPeersListChanged();
                }
            }
        }
コード例 #4
0
        public static bool QueryPassword(object owner, string caption, string prompt, ref string value)
        {
            bool result = false;

            using (var inputBox = new InputDlg(caption, prompt, value, true)) {
                if (inputBox.ShowDialog((IWin32Window)owner) == DialogResult.OK)
                {
                    value  = inputBox.Value.Trim();
                    result = true;
                }
            }

            return(result);
        }
コード例 #5
0
 private void Authenticate()
 {
     if (fCore.Profile.IsIdentified)
     {
         string password = string.Empty;
         if (InputDlg.QueryPassword(this, CommunicatorCore.APP_NAME, "Password", ref password))
         {
             if (!fCore.Authenticate(password))
             {
                 MessageBox.Show("Authentication failed", CommunicatorCore.APP_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                 Close();
             }
         }
         else
         {
             Close();
         }
     }
     else
     {
         ShowProfile(fCore.Profile);
     }
 }