Ejemplo n.º 1
0
        private void OnWidgetValidated(object sender, System.EventArgs e)
        {
            // general widget validated.
            UserIdentity         selectedUser   = this.GetSelectedUserIdentity();
            NntpServerDefinition selectedServer = this.GetSelectedNntpServerDefinition();

            if (sender == this.txtIdentityName)
            {
                if (selectedUser != null)
                {
                    selectedUser.Name = this.txtIdentityName.Text;
                }
            }
            if (sender == this.txtUserName)
            {
                if (selectedUser != null)
                {
                    selectedUser.RealName = this.txtUserName.Text;
                }
            }
            if (sender == this.txtUserOrg)
            {
                if (selectedUser != null)
                {
                    selectedUser.Organization = this.txtUserOrg.Text;
                }
            }
            if (sender == this.txtUserMail)
            {
                if (selectedUser != null)
                {
                    selectedUser.MailAddress = this.txtUserMail.Text;
                }
            }
            if (sender == this.txtUserMailResponse)
            {
                if (selectedUser != null)
                {
                    selectedUser.ResponseAddress = this.txtUserMailResponse.Text;
                }
            }
            if (sender == this.txtRefererUrl)
            {
                if (selectedUser != null)
                {
                    selectedUser.ReferrerUrl = this.txtRefererUrl.Text;
                }
            }
            if (sender == this.txtSignature)
            {
                if (selectedUser != null)
                {
                    selectedUser.Signature = this.txtSignature.Text;
                }
            }

            // Nntp server def. takeover

            if (sender == this.txtNewsAccountName)
            {
                if (selectedServer != null)
                {
                    selectedServer.Name = this.txtNewsAccountName.Text;
                }
            }
            if (sender == this.cboDefaultIdentities)
            {
                if (selectedServer != null)
                {
                    selectedServer.DefaultIdentity = this.cboDefaultIdentities.Text;
                }
            }
            if (sender == this.chkConsiderServerOnRefresh)
            {
                if (selectedServer != null)
                {
                    selectedServer.PreventDownloadOnRefreshSpecified = (!this.chkConsiderServerOnRefresh.Checked);
                    selectedServer.PreventDownloadOnRefresh          = !this.chkConsiderServerOnRefresh.Checked;
                }
            }
            if (sender == this.txtNewsServerName)
            {
                if (selectedServer != null)
                {
                    selectedServer.Server = this.txtNewsServerName.Text;
                }
            }
            if (sender == this.txtServerAuthName)
            {
                if (selectedServer != null)
                {
                    selectedServer.AuthUser = this.txtServerAuthName.Text;
                }
            }
            if (sender == this.txtServerAuthPassword)
            {
                if (selectedServer != null)
                {
                    FeedSource.SetNntpServerCredentials(
                        selectedServer, this.txtServerAuthName.Text, txtServerAuthPassword.Text);
                }
            }
            if (sender == this.txtServerPort)
            {
                if (selectedServer != null)
                {
                    int port = Int32.Parse(this.txtServerPort.Text);
                    if (port > 0 && port != NntpWebRequest.NntpDefaultServerPort)
                    {
                        selectedServer.Port          = port;
                        selectedServer.PortSpecified = true;
                    }
                    else
                    {
                        selectedServer.PortSpecified = false;
                    }
                }
            }
            if (sender == this.chkUseSSL)
            {
                if (selectedServer != null)
                {
                    selectedServer.UseSSLSpecified = (this.chkUseSSL.Checked);
                    selectedServer.UseSSL          = this.chkUseSSL.Checked;
                }
            }
            if (sender == this.trackBarServerTimeout)
            {
                if (selectedServer != null)
                {
                    selectedServer.TimeoutSpecified = false;
                    if (trackBarServerTimeout.Value > 0)
                    {
                        selectedServer.TimeoutSpecified = true;
                        selectedServer.Timeout          = trackBarServerTimeout.Value;
                    }
                }
            }

            this.btnApply.Enabled = true;
        }