コード例 #1
0
    public void Add()
    {
      if(!Validation.IsValidUserName(this.UserName))
      {
        this._parent.DisplayError("Invalid username provided. Usernames must be between 1-20 alpha-numeric characters.", this);
      }
      
      var serviceClient = new ChatServiceClient(Config.ServiceEndpointName);
      var response = serviceClient.SendFriendRequest(this._parent.MainViewModel.UserName, this.UserName);

      // TODO: Verify reponse and handle any errors.

      this._parent.MainViewModel.MessageText += $"Friend request was successfully sent to {this.UserName}!\n";
      this._parent.ShowPage(this._parent.MainViewModel, this);
    }