private void sendChatMessage() { switch (mainWindowModel.CurrentChatMessage) { case "/trace": logService.Filter = LogLevel.Trace; model.Messages.Add("Debug level set to: Trace"); break; case "/debug": logService.Filter = LogLevel.Debug; model.Messages.Add("Debug level set to: Debug"); break; case "/info": logService.Filter = LogLevel.Debug; model.Messages.Add("Debug level set to: Info"); break; case "/warn": logService.Filter = LogLevel.Debug; model.Messages.Add("Debug level set to: Warning"); break; case "/error": logService.Filter = LogLevel.Debug; model.Messages.Add("Debug level set to: Error"); break; case "/fatal": logService.Filter = LogLevel.Debug; model.Messages.Add("Debug level set to: Fatal"); break; case "/off": logService.Filter = LogLevel.Off; model.Messages.Add("Debug level set to: Fatal"); break; case "/disconnect": model.Messages.Add("Disconnecting from current overlord.."); connectionController.Disconnect(); break; default: if (!string.IsNullOrEmpty(mainWindowModel.CurrentChatMessage)) { connectionController.SendMessage(mainWindowModel.CurrentChatMessage); } break; } mainWindowModel.CurrentChatMessage = string.Empty; }
private void Disconnect(object sender, RoutedEventArgs e) { if (myConnection.Disconnect()) { ServerName.Text = "Not connected"; ServerName.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 0, 0)); ServerFiles.Items.Clear(); fileToSend = null; fileToDownload = null; SendB.Content = "Send file"; DownloadB.Content = "Download file"; StatusBox.Text = "Server status : "; StatusBox.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(0, 0, 0)); } }