internal GameStates (BuddyClient client, User user) : base(client) { if (user == null) throw new ArgumentNullException ("user"); this.User = user; }
public IAsyncResult SendAsync (Action<bool, BuddyCallbackParams> callback, User toUser, string message, string appTag = "", object state = null) { SendInternal (toUser, message, appTag, (bcr) => { if (callback == null) return; callback (bcr.Result, new BuddyCallbackParams (bcr.Error)); }); return null; }
internal void SendInternal (User toUser, string message, string appTag, Action<BuddyCallResult<bool>> callback) { if (toUser == null) throw new ArgumentNullException ("toUser"); if (message == null || message.Length > 200) throw new ArgumentException ("Can't be null or larger then 200 characters.", "message"); this.Client.Service.Messages_Message_Send (this.Client.AppName, this.Client.AppPassword, AuthUser.Token, message, toUser.ID.ToString (), appTag == null ? "" : appTag, (bcr) => { var result = bcr.Result; if (bcr.Error != BuddyError.None && bcr.Error != BuddyError.ServiceErrorNegativeOne) { callback (BuddyResultCreator.Create (false, bcr.Error)); return; } callback (BuddyResultCreator.Create (result == "1", BuddyError.None)); return; }); return; }
internal void AddInternal (User user, string appTag, Action<BuddyCallResult<bool>> callback) { if (user == null) throw new ArgumentNullException ("user"); this.Client.Service.Friends_FriendRequest_Add (this.Client.AppName, this.Client.AppPassword, this.AuthUser.Token, user.ID.ToString (), appTag, (bcr) => { var result = bcr.Result; if (bcr.Error != BuddyError.None) { callback (BuddyResultCreator.Create (default(bool), bcr.Error)); return; } if (result == "1") { callback (BuddyResultCreator.Create (true, bcr.Error)); return; } else { callback (BuddyResultCreator.Create (false, bcr.Error)); return; } ; }); return; }
private void Button_Click_2(object sender, RoutedEventArgs e) { if (networkCheck()) { try { if (authUser == null) { MessageBox.Show("Sorry but you need creds to send a message. Go to the message tab sign in then you will have the street cred you need for this"); } else { authUser.FindUserAsync((User, state2) => { temp = User; sendMessage(); }, int.Parse(sentUser.Text)); } } catch (Exception ex) { MessageBox.Show("Something is wrong! I cant seem to find that person! " + ex.Message); } } }
private void addFriend(AuthenticatedUser tempUser, User temporaryUser) { if (networkCheck()) { tempUser.Friends.Requests.AddAsync((r, state3) => { }, tempUser); } }
public bool networkCheck() { bool temp=DeviceNetworkInformation.IsNetworkAvailable; if (!temp) { MessageBoxResult r = MessageBox.Show("Internet Connectivity", "Something isn't quite right here. I cant find the interwebs and this feature doesnt work without interwebs. Want me to take you to the WiFi's?", MessageBoxButton.OKCancel); if (r == MessageBoxResult.OK) { ConnectionSettingsTask launchWifi = new ConnectionSettingsTask(); launchWifi.ConnectionSettingsType = ConnectionSettingsType.WiFi; launchWifi.Show(); networkCheck(); temp = true; } else { MessageBox.Show("If You Say So", "Whatever you say but this means the messaging feature will not enable", MessageBoxButton.OK); temp = false; } } return temp; }
internal GameScores (BuddyClient client, AuthenticatedUser authUser, User user) : base(client, authUser) { this.User = user; }
internal PicturePublic(BuddyClient client, string fullUrl, string thumbnailUrl, double latitude, double longitude, string comment, string appTag, DateTime addedOn, int photoId, User user) : base(client, user as AuthenticatedUser) { this.FullUrl = fullUrl; this.ThumbnailUrl = thumbnailUrl; this.Latitude = latitude; this.Longitude = longitude; this.Comment = comment; this.AppTag = appTag; this.AddedOn = addedOn; this.PhotoID = photoId; this.User = user; }
internal PicturePublic(BuddyClient client, User user, InternalModels.DataContract_PublicPhotoSearch photo, int userId) : base(client) { if (photo == null) throw new ArgumentNullException("photo"); this.FullUrl = photo.FullPhotoURL; this.ThumbnailUrl = photo.ThumbnailPhotoURL; this.Latitude = this.Client.TryParseDouble(photo.Latitude); this.Longitude = this.Client.TryParseDouble(photo.Longitude); this.AddedOn = Convert.ToDateTime(photo.PhotoAdded, CultureInfo.InvariantCulture); this.AppTag = photo.ApplicationTag; this.PhotoID = Int32.Parse(photo.PhotoID); this.User = user; this.UserId = userId; this.DistanceInKilometers = client.TryParseDouble(photo.DistanceInKilometers); this.DistanceInMeters = client.TryParseDouble(photo.DistanceInMeters); this.DistanceInMiles = client.TryParseDouble(photo.DistanceInMiles); this.DistanceInYards = client.TryParseDouble(photo.DistanceInYards); }
internal void RemoveUserInternal (User userToRemove, Action<BuddyCallResult<bool>> callback) { this.Client.Service.GroupMessages_Membership_RemoveUser (this.Client.AppName, this.Client.AppPassword, AuthUser.Token, userToRemove.ID.ToString (), this.ID.ToString (), (bcr) => { var result = bcr.Result; if (bcr.Error != BuddyError.None && bcr.Error != BuddyError.ServiceErrorNegativeOne) { callback (BuddyResultCreator.Create (false, bcr.Error)); return; } callback (BuddyResultCreator.Create (result == "1", BuddyError.None)); return; }); return; }
public IAsyncResult RemoveUserAsync (Action<bool, BuddyCallbackParams> callback, User userToRemove, object state = null) { RemoveUserInternal (userToRemove, (bcr) => { if (callback == null) return; callback (bcr.Result, new BuddyCallbackParams (bcr.Error)); }); return null; }
internal void DenyInternal (User user, Action<BuddyCallResult<bool>> callback) { if (user == null) throw new ArgumentNullException ("user"); this.Client.Service.Friends_FriendRequest_Deny (this.Client.AppName, this.Client.AppPassword, this.AuthUser.Token, user.ID.ToString (), (bcr) => { var result = bcr.Result; if (bcr.Error != BuddyError.None && bcr.Error != BuddyError.ServiceErrorNegativeOne) { callback (BuddyResultCreator.Create (default(bool), bcr.Error)); return; } callback (BuddyResultCreator.Create (result == "1", BuddyError.None)); }); return; }
public IAsyncResult AcceptAsync (Action<bool, BuddyCallbackParams> callback, User user, string appTag = "", object state = null) { AcceptInternal (user, appTag, (bcr) => { if (callback == null) return; callback (bcr.Result, new BuddyCallbackParams (bcr.Error)); }); return null; }