public IncomingErrorMessageEventArgs(int errorCode, string message, FowaClient fowaClient) { this.Errorcode = errorCode; this.Message = message; this.FowaClient = fowaClient; }
private FowaConnection() { _fowaClient = new FowaClient(); }
public IncomingMessageEventArgs(string message, FowaClient fowaClient) { this.Message = message; this.FowaClient = fowaClient; //this.SenderNetworkStream = senderNetworkStream; }
public async Task<int> HandleIncomingLoginOrRegisterMessage(FowaClient client, string email) { bool writeToClientSuccessfull = true; // Not used yet bool userExists = true; bool dbConnectionSuccessfull = true; string possibleException = string.Empty; try { // Check if user exists userExists = _userFriendService.UserExists(email); } catch (Exception ex) { // Log ex possibleException = ex.Message; dbConnectionSuccessfull = false; } if (!userExists) { await Dispatcher.BeginInvoke(new Action(() => fowaServerLogTextBlock.Text += "Login failed: User not found.\n----------\n")); //writeToClientSuccessfull = await client.WriteToClientStreamAync(new ErrorMessage(ErrorMessageKind.LoginError, "User not found.")); } if (!dbConnectionSuccessfull) { await Dispatcher.BeginInvoke(new Action(() => fowaServerLogTextBlock.Text += "DB connection failed.\n----------\n" + possibleException)); //writeToClientSuccessfull = await client.WriteToClientStreamAync(new ErrorMessage(ErrorMessageKind.LoginError, "Fetching Friends failed.")); } if (!dbConnectionSuccessfull) return 0; // DB con failed return userExists ? 1 : 2; // user exists = 1 // User does not exists = 2 }