/// <summary>
        /// The update email status data grid.
        /// </summary>
        /// <param name="filterParametersData"></param>
        private void UpdateMonitorDataGrid(FilterParametersData filterParametersData)
        {
            var currentCursor = Cursor.Current;

            try
            {
                this.Cursor = Cursors.WaitCursor;
                Application.DoEvents();

                this.GetFilterParams();

                if (this.FolderComboBox.SelectedItem != null)
                {
                    var inboxFolder = (Outlook.MAPIFolder) this.FolderComboBox.SelectedItem;
                    ThisAddIn.thisApplication.ActiveExplorer().CurrentFolder = inboxFolder;
                    ThisAddIn.thisApplication.ActiveExplorer().CurrentFolder.Display();

                    this.emailParsingDataList          = GpiOutlookWrapper.GetMailBoxContent(inboxFolder, filterParametersData);
                    this.InfoToolStripStatusLabel.Text = $"Обнаружено: {this.emailParsingDataList.Count}";

                    this.MonitorStatusDataGridView.DataSource = this.emailParsingDataList;
                    if (this.emailParsingDataList.Count > 0)
                    {
                        this.MonitorStatusDataGridView.SelectedRows[0].Selected = true;
                        this.MonitorStatusDataGridViewSelectionChanged(null, null);
                    }
                }
            }
            catch (Exception ex)
            {
                this.InfoListBox.Items.Add("UpdateMonitorDataGrid " + ex.Message);
                this.InfoListBox.Items.Add(ex.StackTrace);
                foreach (var err in GpiOutlookWrapper.ErrorList)
                {
                    this.InfoListBox.Items.Add(err);
                }
            }
            finally
            {
                this.Cursor = currentCursor;
                Application.DoEvents();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// The update email status data grid.
        /// </summary>
        private void UpdateNdrDataGrid()
        {
            try
            {
                var inboxFolder = (Outlook.MAPIFolder) this.FolderComboBox.SelectedItem;
                ThisAddIn.thisApplication.ActiveExplorer().CurrentFolder = inboxFolder;
                ThisAddIn.thisApplication.ActiveExplorer().CurrentFolder.Display();

                var fp = FilterParametersData.GetDefault();
                this.emailParsingDataList          = GpiOutlookWrapper.GetMailBoxContent(inboxFolder, fp, "REPORT.IPM.Note.NDR");
                this.InfoToolStripStatusLabel.Text = string.Format("Обнаружено NDR: {0}", this.emailParsingDataList.Count);

                this.NdrDataGridView.DataSource = this.emailParsingDataList;
                if (this.emailParsingDataList.Count > 0)
                {
                    this.NdrDataGridView.SelectedRows[0].Selected = true;
                    this.EmailStatusDataGridViewSelectionChanged(null, null);
                }
            }
            catch (Exception ex)
            {
                this.InfoListBox.Items.Add("FolderComboBoxSelectedIndexChanged " + ex.Message);
            }
        }