Example #1
0
        private static void StartDebugTools()
        {
            new DebugOutput(0);

            var debugVm = new LogTraceListener()
            {
                FilterContains = Diagnosis.Server.App.Properties.Settings.Default.DebugFilter ?? "",
                FilterOn       = Diagnosis.Server.App.Properties.Settings.Default.DebugFilterOn
            };

            debugVm.PropertyChanged += (s, e1) =>
            {
                switch (e1.PropertyName)
                {
                case "FilterContains":
                    Diagnosis.Server.App.Properties.Settings.Default.DebugFilter = debugVm.FilterContains;
                    break;
                }
            };
            var debWin = new DebugWindow(debugVm);

            debWin.Closing += (s, e1) =>
            {
                Diagnosis.Server.App.Properties.Settings.Default.DebugFilterOn = debugVm.FilterOn;
            };
            debWin.Show();

            // NHibernateHelper.Default.ShowSql = !NHibernateHelper.Default.InMemory;
        }
Example #2
0
        public DebugWindow(LogTraceListener debugListener)
        {
            InitializeComponent();

            var uiScheduler   = TaskScheduler.FromCurrentSynchronizationContext();
            var uiTaskFactory = new TaskFactory(uiScheduler);

            debugListener.LogEntries.CollectionChanged += (s, e) =>
            {
                if (e.NewItems != null)
                {
                    // scroll to new
                    uiTaskFactory.StartNew(() =>
                                           items.ScrollIntoView(e.NewItems[0]));
                }
            };
            debugListener.PropertyChanged += (s, e) =>
            {
                if (e.PropertyName == "FilterOn")
                {
                    // scroll to selected
                    if (items.SelectedItem != null)
                    {
                        uiTaskFactory.StartNew(() =>
                                               { items.ScrollIntoView(items.SelectedItem); });
                    }
                }
            };

            DataContext = debugListener;
            System.Diagnostics.Debug.Listeners.Add(debugListener);

            Loaded += (s, e) =>
            {
                if (this.Left == 0)
                {
                    this.Left = SystemParameters.PrimaryScreenWidth - this.Width;
                }
            };

            this.Height = SystemParameters.MaximizedPrimaryScreenHeight;
            this.Top    = 0;
        }
Example #3
0
        public ContainerForm(ServiceBusHelper serviceBusHelper, MainForm mainForm)
        {
            try
            {
                InitializeComponent();
                logTask = Task.Factory.StartNew(AsyncWriteToLog).ContinueWith(t =>
                {
                    if (t.IsFaulted && t.Exception != null)
                    {
                        WriteToLog(t.Exception.Message);
                    }
                });
                this.mainForm        = mainForm;
                mainSplitterDistance = mainSplitContainer.SplitterDistance;
                SuspendLayout();
                panelMain.SuspendDrawing();
                panelMain.Controls.Clear();
                panelMain.BackColor = SystemColors.GradientInactiveCaption;
                var metricMonitorControl = new MetricMonitorControl(WriteToLog, new ServiceBusHelper(WriteToLog, serviceBusHelper), null, null, null)
                {
                    Location = new Point(1, panelMain.HeaderHeight + 1),
                    Size     = new Size(panelMain.Size.Width - 3, panelMain.Size.Height - 26),
                    Anchor   = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right
                };


                Text             = MetricsHeader;
                logTraceListener = new LogTraceListener(WriteToLog);
                Trace.Listeners.Add(logTraceListener);
                metricMonitorControl.Focus();

                panelMain.Controls.Add(metricMonitorControl);
                SetStyle(ControlStyles.ResizeRedraw, true);
            }
            finally
            {
                panelMain.ResumeDrawing();
                ResumeLayout();
            }
        }
Example #4
0
        public override bool OnStart()
        {
            Log.Trace();

            // Set the maximum number of concurrent connections
            HttpUtilities.SetServicePointDefaultConnectionLimit();

            LogTraceListener.Configure();

            if (!_config.ApplicationInsightsKey.IsNullOrWhiteSpace())
            {
                TelemetryConfiguration.Active.InstrumentationKey = _config.ApplicationInsightsKey;
                LogManager.TelemetryConsumers.Add(new AITelemetryConsumer(_config.ApplicationInsightsKey));
            }

            if (!_config.RaygunApiKey.IsNullOrWhiteSpace())
            {
                LogManager.TelemetryConsumers.Add(new RaygunTelemetryConsumer(_config.RaygunApiKey));
            }

            //if (!_config.StatHatKey.IsNullOrWhiteSpace()) {
            //  LogManager.TelemetryConsumers.Add(new StatHatTelemetryConsumer());
            //}

            // For information on handling configuration changes
            // see the MSDN topic at https://go.microsoft.com/fwlink/?LinkId=166357.
            RoleEnvironment.Changing += RoleEnvironmentChanging;
            AppDomain.CurrentDomain.UnhandledException +=
                (object sender, UnhandledExceptionEventArgs e) => {
                if (e.ExceptionObject is Exception ex)
                {
                    ex.Report("Unhandled exception in Orleans CloudServices Worker Role.");
                }
            };

            return(base.OnStart());
        }
        public ContainerForm(ServiceBusHelper serviceBusHelper, MainForm mainForm, FormTypeEnum formType, TopicDescription topicDescription, List <SubscriptionDescription> subscriptionList)
        {
            try
            {
                InitializeComponent();
                Task.Factory.StartNew(AsyncWriteToLog).ContinueWith(t =>
                {
                    if (t.IsFaulted && t.Exception != null)
                    {
                        WriteToLog(t.Exception.Message);
                    }
                });
                this.mainForm        = mainForm;
                mainSplitterDistance = mainSplitContainer.SplitterDistance;
                SuspendLayout();
                panelMain.SuspendDrawing();
                panelMain.Controls.Clear();
                panelMain.BackColor = SystemColors.GradientInactiveCaption;

                testTopicControl = new TestTopicControl(mainForm, WriteToLog, StopLog, StartLog, new ServiceBusHelper(WriteToLog, serviceBusHelper), topicDescription, subscriptionList)
                {
                    Location = new Point(1, panelMain.HeaderHeight + 1),
                    Size     = new Size(panelMain.Size.Width - 3, panelMain.Size.Height - 26),
                    Anchor   = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right
                };


                if (formType == FormTypeEnum.Send)
                {
                    testTopicControl.mainTabControl.TabPages.RemoveAt(2);
                    testTopicControl.receiverEnabledCheckBox.Checked = false;
                    testTopicControl.senderEnabledCheckBox.Checked   = true;
                    testTopicControl.senderEnabledCheckBox.Visible   = false;
                    testTopicControl.grouperMessage.Location         = new Point(testTopicControl.grouperMessage.Location.X, 8);
                    testTopicControl.grouperMessage.Size             = new Size(testTopicControl.grouperMessage.Size.Width,
                                                                                testTopicControl.grouperMessage.Size.Height + 16);
                    testTopicControl.grouperSender.Location = new Point(testTopicControl.grouperSender.Location.X, 8);
                    testTopicControl.grouperSender.Size     = new Size(testTopicControl.grouperSender.Size.Width,
                                                                       testTopicControl.grouperSender.Size.Height + 16);
                    Text = string.Format(SendMessagesFormat, topicDescription.Path);
                }
                else
                {
                    Text             = string.Format(TestTopicFormat, topicDescription.Path);
                    logTraceListener = new LogTraceListener(WriteToLog);
                    Trace.Listeners.Add(logTraceListener);
                }

                testTopicControl.btnCancel.Text   = CloseLabel;
                testTopicControl.btnCancel.Click -= testTopicControl.btnCancel_Click;
                testTopicControl.btnCancel.Click += BtnCancelOnClick;
                testTopicControl.Focus();

                panelMain.HeaderText = string.Format(HeaderTextTestTopicFormat, topicDescription.Path);
                panelMain.Controls.Add(testTopicControl);
                SetStyle(ControlStyles.ResizeRedraw, true);
            }
            finally
            {
                panelMain.ResumeDrawing();
                ResumeLayout();
            }
        }