public void ServiceIsShuttingDown() { Thread.Sleep(3000); CheckConnection(); LocalServiceClient.Close(); MessageBox.Show("Server in Shutdown-Mode.Closing..."); Environment.Exit(0); }
public void KickUser() { Thread.Sleep(3000); CheckConnection(); MainWindow.CurrentInstance.UserGetsKicked(); LocalServiceClient.Close(); MessageBox.Show("You were kicked from the Server"); Environment.Exit(0); }
public LocalRepoController(ILogger <HomeController> logger, LocalServiceClient localLocalServiceClient, GitHubClient client, IMapper mapper) { _logger = logger; _localServiceClient = localLocalServiceClient; _githubClient = client; _mapper = mapper; }
public GithubRepoController(ILogger <GithubRepoController> logger, GitHubClient client, LocalServiceClient lsc, IMapper mapper) { _logger = logger; _githubClient = client; _mapper = mapper; _localServiceClient = lsc; }
public void SendMessageToServer(string message, string username) { var m = new Message { Sender = username, Time = DateTime.Now, Content = message }; LocalServiceClient.SendMessage(m); }
public async Task <bool> TryLogin(Client client) { Login.CurrentInstance.Errormessage.Text = ""; try { if (LocalServiceClient == null) { LocalServiceClient = new SwnServiceClient(new InstanceContext(this), "netTcpBinding", "net.tcp://" + SettingHandler.GetIpPort() + "/SwnService"); } if (LocalServiceClient.State != CommunicationState.Opened) { LocalServiceClient.Open(); } var successfulLogin = await LocalServiceClient.ConnectAsync(client); return(successfulLogin); } catch (FaultException exception) { Login.CurrentInstance.Errormessage.Text = "Got " + exception.GetType(); CloseOrAbortServiceChannel(LocalServiceClient); return(false); } catch (CommunicationException) { Login.CurrentInstance.Errormessage.Text = "Server not Responding"; CloseOrAbortServiceChannel(LocalServiceClient); return(false); } catch (TimeoutException exception) { Login.CurrentInstance.Errormessage.Text = "Got " + exception.GetType(); CloseOrAbortServiceChannel(LocalServiceClient); return(false); } catch (Exception t) { MessageBox.Show(t.ToString()); CloseOrAbortServiceChannel(LocalServiceClient); return(false); } }
public void HandleProxy() { if (LocalServiceClient != null) { switch (LocalServiceClient.State) { case CommunicationState.Closed: LocalServiceClient = null; MainWindow.CurrentInstance.LbUserOnline.Items.Clear(); MessageBox.Show("Connection to Server Closed"); break; case CommunicationState.Closing: break; case CommunicationState.Created: break; case CommunicationState.Faulted: LocalServiceClient.Abort(); LocalServiceClient = null; MainWindow.CurrentInstance.LbUserOnline.ItemsSource = null; MainWindow.CurrentInstance.LbUserOnline.Items.Clear(); MessageBox.Show("Connection to Server Lost"); MainWindow.CurrentInstance.Close(); break; case CommunicationState.Opened: MessageBox.Show("Connected"); break; case CommunicationState.Opening: break; } } }
public List <string> GrabLoggedInUsers() { return(LocalServiceClient.RequestOnlineUsersList()); }