コード例 #1
0
        private void btnOK_Click(object sender, System.EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;

            Bitmap bm = null;

            if (ParticipantImage.Image != null)
            {
                MemoryStream ms = new MemoryStream();
                ParticipantImage.Image.Save(ms, ImageFormat.Png);
                bm = new Bitmap(ms);
            }

            try
            {
                if (State == FormState.create)
                {
                    Conference.AddProfileOnServer(NameTextBox.Text, null, EmailTextBox.Text, bm, false);
                }
                else
                {
                    Conference.UpdateProfileOnServer(NameTextBox.Text, null, EmailTextBox.Text, bm, false);
                }
            }
            catch (System.Net.WebException)
            {
                MessageBox.Show(this,
                                "Your profile could not be updated on the server. \n" +
                                "Check that you have a connection to the venue server. \n",
                                "Error Connecting to Venue Server", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    "An unexpected error occurred connecting to the venue server. \n" +
                    "Try again when you have a connection to the venue server. \n" +
                    "\nException:\n" + ex.ToString(),
                    "Error Connecting to Venue Server", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }
コード例 #2
0
        private void btnOK_Click(object sender, System.EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            bool   BoolRole;
            Bitmap bm = null;

            if (ParticipantImage.Image != null)
            {
                MemoryStream ms = new MemoryStream();
                ParticipantImage.Image.Save(ms, ImageFormat.Png);
                bm = new Bitmap(ms);
            }

            try
            {
                if (State == FormState.create)
                {
                    Conference.AddProfileOnServer(NameTextBox.Text, null, EmailTextBox.Text, bm, false);
                }
                else
                {
                    Conference.UpdateProfileOnServer(NameTextBox.Text, null, EmailTextBox.Text, bm, false);
                }
            }
            catch (System.Net.WebException)
            {
                RtlAwareMessageBox.Show(this, Strings.ProfileCouldNotBeUpdated,
                                        Strings.ErrorConnectingToVenueServer, MessageBoxButtons.OK, MessageBoxIcon.Error,
                                        MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
            }
            catch (SoapException se)
            {
                if (se.Code.ToString() == "VSNameLengthException")
                {
                    RtlAwareMessageBox.Show(this, Strings.NameLengthErrorText,
                                            Strings.NameLengthErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error,
                                            MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
                }
                else if (se.Code.ToString() == "VSParticipantIconSizeException")
                {
                    RtlAwareMessageBox.Show(this, Strings.ParticipantIconSizeErrorText,
                                            Strings.ParticipantIconSizeErrorTitle, MessageBoxButtons.OK, MessageBoxIcon.Error,
                                            MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
                }
                else if (se.Code.ToString() == "VSEmailAddressException")
                {
                    RtlAwareMessageBox.Show(this, string.Format(CultureInfo.CurrentCulture,
                                                                Strings.EmailAddressInvalidText, EmailTextBox.Text),
                                            Strings.EmailAddressInvalidTitle, MessageBoxButtons.OK, MessageBoxIcon.Error,
                                            MessageBoxDefaultButton.Button1, (MessageBoxOptions)0);
                }
            }
            catch (Exception ex)
            {
                RtlAwareMessageBox.Show(this, string.Format(CultureInfo.CurrentCulture,
                                                            Strings.UnexpectedConnectionError, ex.ToString()), Strings.ErrorConnectingToVenueServer,
                                        MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1,
                                        (MessageBoxOptions)0);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }