Ejemplo n.º 1
0
        public ContainerForm(ServiceBusHelper serviceBusHelper, MainForm mainForm, SubscriptionWrapper subscriptionWrapper)
        {
            try
            {
                InitializeComponent();
                this.mainForm        = mainForm;
                mainSplitterDistance = mainSplitContainer.SplitterDistance;
                SuspendLayout();
                panelMain.SuspendDrawing();
                panelMain.Controls.Clear();
                panelMain.BackColor = SystemColors.GradientInactiveCaption;

                testSubscriptionControl = new TestSubscriptionControl(mainForm, WriteToLog, new ServiceBusHelper(WriteToLog, serviceBusHelper), subscriptionWrapper)
                {
                    Location = new Point(1, panelMain.HeaderHeight + 1)
                };

                testSubscriptionControl.btnCancel.Click -= testSubscriptionControl.btnCancel_Click;
                testSubscriptionControl.btnCancel.Click += BtnCancelOnClick;
                testSubscriptionControl.Focus();

                Text = string.Format(TestSubscriptionFormat, subscriptionWrapper.SubscriptionDescription.Name);

                panelMain.HeaderText = string.Format(HeaderTextTestSubscriptionFormat, subscriptionWrapper.SubscriptionDescription.Name);
                panelMain.Controls.Add(testSubscriptionControl);
                SetStyle(ControlStyles.ResizeRedraw, true);
            }
            finally
            {
                panelMain.ResumeDrawing();
                ResumeLayout();
            }
        }
Ejemplo n.º 2
0
        private void TestSubscription(SubscriptionWrapper subscriptionWrapper, bool sdi)
        {
            if (sdi)
            {
                TestSubscriptionControl subscriptionControl = null;

                try
                {
                    panelMain.SuspendDrawing();
                    panelMain.Controls.Clear();
                    panelMain.BackColor = SystemColors.GradientInactiveCaption;
                    subscriptionControl = new TestSubscriptionControl(this, WriteToLog, serviceBusHelper, subscriptionWrapper);
                    subscriptionControl.SuspendDrawing();
                    subscriptionControl.Location = new Point(1, panelLog.HeaderHeight + 1);
                    panelMain.Controls.Add(subscriptionControl);
                    SetControlSize(subscriptionControl);
                    subscriptionControl.OnCancel += MainForm_OnCancel;
                }
                catch (Exception ex)
                {
                    HandleException(ex);
                }
                finally
                {
                    panelMain.ResumeDrawing();
                    if (subscriptionControl != null)
                    {
                        subscriptionControl.ResumeDrawing();
                    }
                }
            }
            else
            {
                var form = new ContainerForm(serviceBusHelper, this, subscriptionWrapper);
                form.Show();
            }
        }
Ejemplo n.º 3
0
        public ContainerForm(ServiceBusHelper serviceBusHelper, MainForm mainForm, SubscriptionWrapper subscriptionWrapper)
        {
            try
            {
                InitializeComponent();
                this.mainForm = mainForm;
                mainSplitterDistance = mainSplitContainer.SplitterDistance;
                SuspendLayout();
                panelMain.SuspendDrawing();
                panelMain.Controls.Clear();
                panelMain.BackColor = SystemColors.GradientInactiveCaption;

                testSubscriptionControl = new TestSubscriptionControl(mainForm, WriteToLog, new ServiceBusHelper(WriteToLog, serviceBusHelper), subscriptionWrapper)
                                              {
                                                  Location = new Point(1, panelMain.HeaderHeight + 1)
                                              };

                testSubscriptionControl.btnCancel.Click -= testSubscriptionControl.btnCancel_Click;
                testSubscriptionControl.btnCancel.Click += BtnCancelOnClick;
                testSubscriptionControl.Focus();

                Text = string.Format(TestSubscriptionFormat, subscriptionWrapper.SubscriptionDescription.Name);

                panelMain.HeaderText = string.Format(HeaderTextTestSubscriptionFormat, subscriptionWrapper.SubscriptionDescription.Name);
                panelMain.Controls.Add(testSubscriptionControl);
                SetStyle(ControlStyles.ResizeRedraw, true);
            }
            finally
            {
                panelMain.ResumeDrawing();
                ResumeLayout();
            }
        }