Exemplo n.º 1
0
        public override void DoCommand(object sender, EventArgs args) {
            var dlg = new DiagnosticsForm(_serviceProvider, "Gathering data...");

            ThreadPool.QueueUserWorkItem(x => {
                var data = GetData();
                try {
                    dlg.BeginInvoke((Action)(() => {
                        dlg.Ready(data);
                    }));
                } catch (InvalidOperationException) {
                    // Window has been closed already
                }
            });
            dlg.ShowDialog();
        }
Exemplo n.º 2
0
        public override void DoCommand(object sender, EventArgs args)
        {
            var dlg = new DiagnosticsForm(_serviceProvider, "Gathering data...");

            ThreadPool.QueueUserWorkItem(x => {
                var data = GetData();
                try {
                    dlg.BeginInvoke((Action)(() => {
                        dlg.Ready(data);
                    }));
                } catch (InvalidOperationException) {
                    // Window has been closed already
                }
            });
            dlg.ShowDialog();
        }
Exemplo n.º 3
0
        public override void DoCommand(object sender, EventArgs args)
        {
            var dlg = new DiagnosticsForm(_serviceProvider, "Gathering data...");

            ThreadPool.QueueUserWorkItem(x => {
                string data;
                try {
                    data = GetData();
                } catch (Exception ex) when(!ex.IsCriticalException())
                {
                    data = ex.ToUnhandledExceptionMessage(GetType());
                }
                try {
                    dlg.BeginInvoke((Action)(() => {
                        dlg.Ready(data);
                    }));
                } catch (InvalidOperationException) {
                    // Window has been closed already
                }
            });
            dlg.ShowDialog();
        }