private void OnButtonSubmitClick(object sender, RoutedEventArgs e)
        {
            var mapidata = new Hashtable();

            mapidata.Add("email", emailData);
            mapidata.Add("company", companyData);
            mapidata.Add("defect", bug.IsChecked == true ? true : false);
            mapidata.Add("feature", feature.IsChecked == true ? true : false);
            mapidata.Add("description", descriptionData.Text);
            mapidata.Add("filepath", string.Empty);
            if (attachLog.IsChecked == true)
            {
                mapidata["filepath"] = TraceLog.FilePath;
            }

            // Run the default email client in a separate thread, freeing up
            // Visual Studio for the user.

            //_worker.DoWork += delegate(object s, DoWorkEventArgs args)
            //                      {
            Hashtable data = mapidata; //(Hashtable)args.Argument;
            var       mapi = new Mapi();

            foreach (string recipient in Settings.Default.FeedbackEmailRecipients.Split(','))
            {
                mapi.AddRecipientTo(recipient);
            }

            foreach (string email in emailData.Text.Split(','))
            {
                mapi.AddRecipientCc(email);
            }

            string feedbackType = string.Empty;

            if ((bool)data["defect"])
            {
                feedbackType = VisualStudio.Resources.FeedbackTypeDefect;
            }
            else if ((bool)data["feature"])
            {
                feedbackType = VisualStudio.Resources.FeedbackTypeFeature;
            }

            string subjectLine = string.Format(CultureInfo.CurrentCulture, "TSVC {0} - {1} - {2} ({3})",
                                               Assembly.GetExecutingAssembly().GetName().Version, feedbackType,
                                               ((string)data["description"]).Substring(0,
                                                                                       ((string)data["description"]).
                                                                                       Length > 50
                                                                                            ? 50
                                                                                            : ((string)
                                                                                               data["description"]).
                                                                                       Length),
                                               companyData.Text);

            if (!string.IsNullOrEmpty((string)data["filepath"]))
            {
                // Attach the log.
                mapi.AddAttachment(TraceLog.FilePath);
            }

            mapi.SendMailPopup(subjectLine, (string)data["description"]);
            //};

            //_worker.RunWorkerAsync(mapidata);

            emailData.Text       = string.Empty;
            companyData.Text     = string.Empty;
            descriptionData.Text = string.Empty;
            attachLog.IsChecked  = true;
            Close();
        }
        private void OnButtonSubmitClick(object sender, RoutedEventArgs e)
        {
            var mapidata = new Hashtable();

            mapidata.Add("email", emailData);
            mapidata.Add("company", companyData);
            mapidata.Add("defect", bug.IsChecked == true ? true : false);
            mapidata.Add("feature", feature.IsChecked == true ? true : false);
            mapidata.Add("description", descriptionData.Text);
            mapidata.Add("filepath", string.Empty);
            if (attachLog.IsChecked == true)
                mapidata["filepath"] = TraceLog.FilePath;

            // Run the default email client in a separate thread, freeing up
            // Visual Studio for the user.

            //_worker.DoWork += delegate(object s, DoWorkEventArgs args)
            //                      {
            Hashtable data = mapidata; //(Hashtable)args.Argument;
            var mapi = new Mapi();
            foreach (string recipient in Settings.Default.FeedbackEmailRecipients.Split(','))
                mapi.AddRecipientTo(recipient);

            foreach (string email in emailData.Text.Split(','))
                mapi.AddRecipientCc(email);

            string feedbackType = string.Empty;

            if ((bool) data["defect"]) feedbackType = VisualStudio.Resources.FeedbackTypeDefect;
            else if ((bool) data["feature"]) feedbackType = VisualStudio.Resources.FeedbackTypeFeature;

            string subjectLine = string.Format(CultureInfo.CurrentCulture, "TSVC {0} - {1} - {2} ({3})",
                                               Assembly.GetExecutingAssembly().GetName().Version, feedbackType,
                                               ((string) data["description"]).Substring(0,
                                                                                        ((string) data["description"]).
                                                                                            Length > 50
                                                                                            ? 50
                                                                                            : ((string)
                                                                                               data["description"]).
                                                                                                  Length),
                                               companyData.Text);

            if (!string.IsNullOrEmpty((string) data["filepath"]))
                // Attach the log.
                mapi.AddAttachment(TraceLog.FilePath);

            mapi.SendMailPopup(subjectLine, (string) data["description"]);
            //};

            //_worker.RunWorkerAsync(mapidata);

            emailData.Text = string.Empty;
            companyData.Text = string.Empty;
            descriptionData.Text = string.Empty;
            attachLog.IsChecked = true;
            Close();
        }