示例#1
0
        /// <summary>
        /// Start instance message.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonClickIM_Click(object sender, EventArgs e)
        {
            if (this.uccControl == null)
            {
                WriteStatusMessage("Creating UCCP platform. Please try login later.");
                return;
            }

            if (this.uccControl.Endpoint == null)
            {
                WriteStatusMessage("ERROR: You must login first.");
                return;
            }

            if (this.uccControl.IMSession != null)
            {
                WriteStatusMessage("The App only supports one active IM session. " +
                                   "Please end current active seesion and try again.");
                return;
            }

            RemoteUriForm remoteUriForm = new RemoteUriForm();
            DialogResult  result        = remoteUriForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                try
                {
                    this.uccControl.StartIMSession(remoteUriForm.RemoteUri);
                    WriteStatusMessage("IM session is connecting with " + remoteUriForm.RemoteUri);
                }
                catch (COMException ex)
                {
                    WriteStatusMessage("IM connection failed. Error: " + ex.Message);
                    this.uccControl.IMSession = null;
                }
            }

            remoteUriForm.Dispose();
        }
        /// <summary>
        /// Start instance message.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonClickIM_Click(object sender, EventArgs e)
        {
            if (this.uccControl == null)
            {
                WriteStatusMessage("Creating UCCP platform. Please try login later.");
                return;
            }

            if (this.uccControl.Endpoint == null)
            {
                WriteStatusMessage("ERROR: You must login first.");
                return;
            }

            if (this.uccControl.IMSession != null)
            {
                WriteStatusMessage("The App only supports one active IM session. " +
                    "Please end current active seesion and try again.");
                return;
            }

            RemoteUriForm remoteUriForm = new RemoteUriForm();
            DialogResult result = remoteUriForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                try
                {
                    this.uccControl.StartIMSession(remoteUriForm.RemoteUri);
                    WriteStatusMessage("IM session is connecting with " + remoteUriForm.RemoteUri);
                }
                catch (COMException ex)
                {
                    WriteStatusMessage("IM connection failed. Error: " + ex.Message);
                    this.uccControl.IMSession = null;
                }
            }

            remoteUriForm.Dispose();
        }