private void btnOpenUserMetadataForm_Click(object sender, EventArgs e)
        {
            var form = new TextForm(UserMetadata, txtUserMetadata.Text);

            if (form.ShowDialog() == DialogResult.OK)
            {
                txtUserMetadata.Text = form.Content;
            }
        }
        private void btnOpenActionForm_Click(object sender, EventArgs e)
        {
            var form = new TextForm(ActionExpression, txtAction.Text);

            if (form.ShowDialog() == DialogResult.OK)
            {
                txtAction.Text = form.Content;
            }
        }
        private void openOpenFilterForm_Click(object sender, EventArgs e)
        {
            var form = new TextForm(FilterExpression, txtFilter.Text);

            if (form.ShowDialog() == DialogResult.OK)
            {
                txtFilter.Text = form.Content;
            }
        }
Exemplo n.º 4
0
 private void btnOpen_Click(object sender, EventArgs e)
 {
     using (var form = new TextForm(MessageTextTitle, txtMessageText.Text))
     {
         if (form.ShowDialog() == DialogResult.OK)
         {
             txtMessageText.Text = form.Content;
         }
     }
 }
 private void btnOpenUserMetadataForm_Click(object sender, EventArgs e)
 {
     using (var form = new TextForm(UserMetadata, txtUserMetadata.Text))
     {
         if (form.ShowDialog() == DialogResult.OK)
         {
             txtUserMetadata.Text = form.Content;
         }
     }
 }
 private void pictFindDeadletter_Click(object sender, EventArgs e)
 {
     try
     {
         deadletterDataGridView.SuspendDrawing();
         deadletterDataGridView.SuspendLayout();
         if (deadletterBindingList == null)
         {
             return;
         }
         using (var form = new TextForm(FilterExpressionTitle, FilterExpressionLabel, deadletterFilterExpression))
         {
             form.Size = new Size(600, 200);
             if (form.ShowDialog() != DialogResult.OK)
             {
                 return;
             }
             deadletterFilterExpression = form.Content;
             if (string.IsNullOrWhiteSpace(deadletterFilterExpression))
             {
                 deadletterBindingSource.DataSource = deadletterBindingList;
                 deadletterDataGridView.DataSource = deadletterBindingSource;
                 writeToLog(FilterExpressionRemovedMessage);
             }
             else
             {
                 Filter filter;
                 try
                 {
                     var sqlFilter = new SqlFilter(deadletterFilterExpression);
                     sqlFilter.Validate();
                     filter = sqlFilter.Preprocess();
                 }
                 catch (Exception ex)
                 {
                     writeToLog(string.Format(FilterExpressionNotValidMessage, deadletterFilterExpression, ex.Message));
                     return;
                 }
                 var filteredList = deadletterBindingList.Where(filter.Match).ToList();
                 var bindingList = new SortableBindingList<BrokeredMessage>(filteredList)
                 {
                     AllowEdit = false,
                     AllowNew = false,
                     AllowRemove = false
                 };
                 deadletterBindingSource.DataSource = bindingList;
                 deadletterDataGridView.DataSource = deadletterBindingSource;
                 writeToLog(string.Format(FilterExpressionAppliedMessage, deadletterFilterExpression, bindingList.Count));
             }
         }
     }
     catch (Exception ex)
     {
         HandleException(ex);
     }
     finally
     {
         deadletterDataGridView.ResumeLayout();
         deadletterDataGridView.ResumeDrawing();
     }
 }
 private void btnOpenActionForm_Click(object sender, EventArgs e)
 {
     using (var form = new TextForm(ActionExpression, txtAction.Text))
     {
         if (form.ShowDialog() == DialogResult.OK)
         {
             txtAction.Text = form.Content;
         }
     }
 }
 private void openOpenFilterForm_Click(object sender, EventArgs e)
 {
     using (var form = new TextForm(FilterExpression, txtFilter.Text))
     {
         if (form.ShowDialog() == DialogResult.OK)
         {
             txtFilter.Text = form.Content;
         }
     }
 }
Exemplo n.º 9
0
 private void btnOpen_Click(object sender, EventArgs e)
 {
     using (var form = new TextForm(MessageTextTitle, txtMessageText.Text))
     {
         if (form.ShowDialog() == DialogResult.OK)
         {
             txtMessageText.Text = form.Content;
         }
     }
 }
 private void pictFindRegistrations_Click(object sender, EventArgs e)
 {
     try
     {
         registrationsDataGridView.SuspendDrawing();
         registrationsDataGridView.SuspendLayout();
         if (registrationPageList == null || registrationPageList.Count == 0)
         {
             return;
         }
         using (var form = new TextForm(FilterExpressionTitle, FilterExpressionLabel, registrationsFilterExpression))
         {
             form.Size = new Size(600, 200);
             if (form.ShowDialog() != DialogResult.OK)
             {
                 return;
             }
             registrationsFilterExpression = form.Content;
             if (string.IsNullOrWhiteSpace(registrationsFilterExpression))
             {
                 currentRegistrationPage = 0;
                 SetRegistrationPage();
                 writeToLog(FilterExpressionRemovedMessage);
             }
             else
             {
                 IEnumerable<RegistrationDescription> filteredCollection;
                 try
                 {
                     var expressionBuilder = new ExpressionBuilder<RegistrationDescription>();
                     var predicate = expressionBuilder.GetExpression(registrationsFilterExpression).Compile();
                     filteredCollection = registrationPageList.SelectMany(rd => rd).Where(predicate).ToList();
                 }
                 catch (Exception ex)
                 {
                     writeToLog(string.Format(FilterExpressionNotValidMessage, registrationsFilterExpression));
                     HandleException(ex);
                     return;
                 }
                 RegistrationInfo.SetRegistrations(filteredCollection);
                 var bindingList = new SortableBindingList<RegistrationInfo>(RegistrationInfo.Registrations)
                 {
                     AllowEdit = false,
                     AllowNew = false,
                     AllowRemove = false
                 };
                 registrationsBindingSource.DataSource = bindingList;
                 registrationsDataGridView.DataSource = registrationsBindingSource;
                 writeToLog(string.Format(FilterExpressionAppliedMessage, registrationsFilterExpression, bindingList.Count));
             }
         }
     }
     catch (Exception ex)
     {
         HandleException(ex);
     }
     finally
     {
         registrationsDataGridView.ResumeLayout();
         registrationsDataGridView.ResumeDrawing();
     }
 }