示例#1
0
        private void _btnSubmit_Click(object sender, System.EventArgs e)
        {
            string userName = Core.SettingStore.ReadString("ErrorReport", "UserName");
            string password = Core.SettingStore.ReadString("ErrorReport", "Password");

            if (userName.Length == 0 || password.Length == 0)
            {
                userName = "******";
                password = "******";
            }

            SubmissionResult result = null;

            IExceptionSubmitter submitter = new RPCExceptionSubmitter();

            submitter.SubmitProgress += new SubmitProgressEventHandler(OnSubmitProgress);
            foreach (ListViewItem lvItem in _lvExceptions.SelectedItems)
            {
                Exception ex = (Exception)lvItem.Tag;
                try
                {
                    result = submitter.SubmitException(ex, _excDescription, userName, password,
                                                       Assembly.GetExecutingAssembly().GetName().Version.Build, WebProxy.GetDefaultProxy());
                }
                catch (Exception ex1)
                {
                    MessageBox.Show(this, "Failed to submit exception: " + ex1.Message, Core.ProductFullName);
                    continue;
                }
                _backgroundExceptions.Remove(ex);
            }
            for (int i = _lvExceptions.SelectedItems.Count - 1; i >= 0; i--)
            {
                _lvExceptions.Items.Remove(_lvExceptions.SelectedItems [i]);
            }

            if (result != null)
            {
                ExceptionReportForm.ShowSubmissionResult(this, result, "OM");
            }
            if (_backgroundExceptions.Count == 0)
            {
                DialogResult = DialogResult.OK;
            }
        }