private void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { var x = new ExceptionPopup(e.Exception); x.ShowDialog(); e.Handled = true; }
private void OnConfigFileClick(object sender, RoutedEventArgs e) { OpenFileDialog fileDialog = new OpenFileDialog { Filter = "YAML Config files (.yaml)|*.yaml", FileName = "config", DefaultExt = ".yaml" }; bool?result = fileDialog.ShowDialog(); if (result.HasValue && result.Value) { try { OctoConfig config = OctoConfig.FromFile(fileDialog.FileName); this.SaveConfig(config); this.TBAddress.Text = config.Address; this.TBPort.Text = config.Port.ToString(); this.TBProcessName.Text = config.ProcessName; this.TBTimeout.Text = config.Timeout.ToString(); this.TBToken.Password = config.Token; this.TBBufferSize.Text = config.BufferSize.ToString(); this.TBCompressionTreshold.Text = config.CompressionThreshold.ToString(); } catch (Exception ex) { ExceptionPopup.ShowException(ex); } } }
private async void OnConnect(object sender, RoutedEventArgs e) { Button btn = (Button)sender; btn.IsHitTestVisible = false; btn.Background = Brushes.Gray; DebuggingWindow win = null; try { OctoConfig config = new OctoConfig { Address = this.TBAddress.Text, Port = int.Parse(this.TBPort.Text), Token = this.TBToken.Password, ProcessName = this.TBProcessName.Text, BufferSize = int.Parse(this.TBBufferSize.Text), CompressionThreshold = int.Parse(this.TBCompressionTreshold.Text), Timeout = int.Parse(this.TBTimeout.Text), }; this.SaveConfig(config); OctoClient client = new OctoClient(config); await client.ConnectAsync(); this.Visibility = Visibility.Collapsed; win = new DebuggingWindow(client); win.ShowDialog(); // In case debugging window is closed with Windows if (client.IsConnected) { await client.DisconnectAsync(); } this.Visibility = Visibility.Visible; } catch (Exception ex) { ExceptionPopup.ShowException(ex); win?.Close(); this.Visibility = Visibility.Visible; } btn.IsHitTestVisible = true; BrushConverter converter = new BrushConverter(); btn.Background = (Brush)converter.ConvertFromString("#191919"); }
private async void OnDisconnect(object sender, RoutedEventArgs e) { try { await this.Client.DisconnectAsync(); } catch (Exception ex) { ExceptionPopup.ShowException(ex); } finally { this.Close(); } }
private async void OnClose(object sender, RoutedEventArgs e) { try { this.PingTimer.Dispose(); Button btn = (Button)sender; btn.IsHitTestVisible = false; btn.Background = Brushes.Gray; await this.Client.DisconnectAsync(); } catch (Exception ex) { ExceptionPopup.ShowException(ex); } finally { this.Close(); } }