Пример #1
0
        protected BuddyBase(BuddyClient client, AuthenticatedUser user):this(client)
        {
            if (user == null && AuthUserRequired) throw new ArgumentNullException("user");

            this.AuthUser = user;
            
        }
Пример #2
0
        internal void RecordInformationInternal (string osVersion, string deviceType, AuthenticatedUser user, string appVersion, double latitude, double longitude, string metadata, Action<BuddyCallResult<bool>> callback)
        {
            if (osVersion == null)
                throw new ArgumentNullException ("osVersion", "Can't be null.");
            if (deviceType == null)
                throw new ArgumentNullException ("deviceType", "Can't be null.");
            if (user == null || user.Token == null)
                throw new ArgumentNullException ("user", "An AuthenticatedUser value is required.");
            if (latitude > 90.0 || latitude < -90.0)
                throw new ArgumentException ("Can't be bigger than 90.0 or smaller than -90.0.", "atLatitude");
            if (longitude > 180.0 || longitude < -180.0)
                throw new ArgumentException ("Can't be bigger than 180.0 or smaller than -180.0.", "atLongitude");


            this.Client.Service.Analytics_DeviceInformation_Add (this.Client.AppName, this.Client.AppPassword,
                    user.Token, osVersion, deviceType, latitude.ToString (CultureInfo.InvariantCulture), longitude.ToString (CultureInfo.InvariantCulture), this.Client.AppName, appVersion, metadata, (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;


        }
Пример #3
0
 internal Locations(BuddyClient client, AuthenticatedUser user)
 {
     if (client == null) throw new ArgumentNullException("client");
     if (user == null) throw new ArgumentNullException("user");
     this.Client = client;
     this.User = user;
 }
Пример #4
0
 internal PhotoAlbum (BuddyClient client, AuthenticatedUser user, int albumId)
     : base(client, user, null)
 {
     this.AlbumId = albumId;
     this.pictures = new List<Picture> ();
     this.Pictures = new ReadOnlyCollection<Picture> (this.pictures);
 }
Пример #5
0
        internal Picture(BuddyClient client, AuthenticatedUser user, InternalModels.DataContract_PhotoList photo)
            : base(client, photo.FullPhotoURL, photo.ThumbnailPhotoURL, client.TryParseDouble(photo.Latitude),
            client.TryParseDouble(photo.Longitude), photo.PhotoComment, photo.ApplicationTag, photo.AddedDateTime,
            Int32.Parse(photo.PhotoID), user)
        {

        }
Пример #6
0
 public IAsyncResult RecordInformationAsync (Action<bool, BuddyCallbackParams> callback, string osVersion, string deviceType, AuthenticatedUser user, string appVersion = "1.0", double latitude = 0.0, double longitude = 0.0, string metadata = "", object state = null)
 {
     RecordInformationInternal (osVersion, deviceType, user, appVersion, latitude, longitude, metadata, (bcr) => {
         if (callback == null)
             return;
         callback (bcr.Result, new BuddyCallbackParams (bcr.Error)); });
     return null;
 }
Пример #7
0
 internal MessageGroup (BuddyClient client, AuthenticatedUser user, int groupId, string name)
     : base(client, user)
 {
     if (client == null)
         throw new ArgumentNullException ("client");
     this.ID = groupId;
     this.Name = name;
 }
 internal PhotoAlbumPublic(BuddyClient client, AuthenticatedUser user, string albumName)
     : base(client, user)
 {
     this.AlbumName = albumName;
     this.UserId = user.ID;
     this.pictures = new List<PicturePublic>();
     this.Pictures = new ReadOnlyCollection<PicturePublic>(this.pictures);
 }
Пример #9
0
        internal Notifications (BuddyClient client, AuthenticatedUser user)
            : base(client, user)
        {


            Android = new NotificationsAndroid (client, user);
            Apple = new NotificationsApple (client, user);
            Win8 = new NotificationsWin8 (client, user);
        }
Пример #10
0
        internal Messages (BuddyClient client, AuthenticatedUser user)
            : base(client, user)
        {
            if (client == null)
                throw new ArgumentNullException ("client");

            this.Groups = new MessageGroups (client, user);

        }
Пример #11
0
        internal MetroArea(BuddyClient client, AuthenticatedUser user, InternalModels.DataContract_MetroList metro)
            : base(client, user)
        {


            this.MetroName = metro.MetroName;

            this.ImageURL = metro.ImageURL;
        }
Пример #12
0
 internal MessageGroup (BuddyClient client, AuthenticatedUser user, InternalModels.DataContract_GroupChatMemberships group)
     : base(client, user)
 {
     this.ID = Int32.Parse (group.ChatGroupID);
     this.Name = group.ChatGroupName;
     this.CreatedOn = Convert.ToDateTime (group.CreatedDateTime, CultureInfo.InvariantCulture);
     this.AppTag = group.ApplicationTag;
     this.OwnerUserID = Int32.Parse (group.OwnerUserID);
     this.MemberUserIDs = new List<int> ();
     foreach (string id in group.MemberUserIDList.Split(';'))
         this.MemberUserIDs.Add (Int32.Parse (id));
 }
        internal RegisteredDeviceApple(InternalModels.DataContract_AppleDeviceList device, AuthenticatedUser user)
        {
            if (device == null) throw new ArgumentNullException("device");
            if (user == null) throw new ArgumentNullException("user");

            this.UserID = Int32.Parse(device.UserID);
            this.APNSDeviceToken = device.APNSDeviceToken;
            this.GroupName = device.GroupName;
            this.LastUpdateDate = device.DeviceModified;
            this.RegistrationDate = device.DeviceRegistered;
            this.User = user;
        }
Пример #14
0
 internal Blob(BuddyClient client, AuthenticatedUser user, InternalModels.DataContract_Blob blob) : base(client, user)
 {
     this.BlobID = long.Parse(blob.BlobID, CultureInfo.InvariantCulture);
     this.FriendlyName = blob.FriendlyName;
     this.MimeType = blob.MimeType;
     this.FileSize = int.Parse(blob.FileSize, CultureInfo.InvariantCulture);
     this.AppTag = blob.AppTag;
     this.Owner = long.Parse(blob.Owner, CultureInfo.InvariantCulture);
     this.Latitude = double.Parse(blob.Latitude, CultureInfo.InvariantCulture);
     this.Longitude = double.Parse(blob.Longitude, CultureInfo.InvariantCulture);
     this.UploadDate = blob.UploadDate;
     this.LastTouchDate = blob.LastTouchDate;
 }
Пример #15
0
 internal Video(BuddyClient client, AuthenticatedUser user, InternalModels.DataContract_Video video) : base(client, user)
 { 
     this.VideoID = long.Parse(video.VideoID, CultureInfo.InvariantCulture);
     this.FriendlyName = video.FriendlyName;
     this.MimeType = video.MimeType;
     this.FileSize = int.Parse(video.FileSize, CultureInfo.InvariantCulture);
     this.AppTag = video.AppTag;
     this.Owner = long.Parse(video.Owner, CultureInfo.InvariantCulture);
     this.Latitude = double.Parse(video.Latitude, CultureInfo.InvariantCulture);
     this.Longitude = double.Parse(video.Longitude, CultureInfo.InvariantCulture);
     this.UploadDate = DateTime.Parse(video.UploadDate, CultureInfo.InvariantCulture);
     this.LastTouchDate = DateTime.Parse(video.LastTouchDate, CultureInfo.InvariantCulture);
     this.VideoUrl = video.VideoUrl;
 }
Пример #16
0
        internal VirtualAlbum(BuddyClient client, AuthenticatedUser user, InternalModels.DataContract_VirtualPhotoAlbumInformation info)
            : base(client, user)
        {
            this.pictures = new List<PicturePublic> ();
            this.Pictures = new ReadOnlyCollection<PicturePublic> (this.pictures);

            this.ID = Int32.Parse (info.VirtualAlbumID);
            this.ApplicationTag = info.ApplicationTag;
            this.CreatedOn = Convert.ToDateTime (info.CreatedDateTime, CultureInfo.InvariantCulture);
            this.LastUpdated = Convert.ToDateTime (info.LastUpdatedDateTime, CultureInfo.InvariantCulture);
            this.Name = info.PhotoAlbumName;
            this.OwnerUserId = Int32.Parse (info.UserID);
            this.ThumbnailUrl = info.PhotoAlbumThumbnail;
        }
        internal RegisteredDeviceWin8(InternalModels.DataContract_Win8DeviceList device, AuthenticatedUser user)
        {
            if (device == null) throw new ArgumentNullException("device");
            if (user == null) throw new ArgumentNullException("user");

            this.UserID = Int32.Parse(device.UserID);
            this.DeviceURI = device.DeviceURI;
            this.GroupName = device.GroupName;
            this.LastUpdateDate = device.DeviceModified;
            this.RegistrationDate = device.DeviceRegistered;
            this.ClientID = device.ClientID;
            this.ClientSecret = device.ClientSecret;
            this.User = user;
        }
        internal RegisteredDevice(InternalModels.DataContract_WPDeviceList device, AuthenticatedUser user)
        {
            if (device == null) throw new ArgumentNullException("device");
            if (user == null) throw new ArgumentNullException("user");

            this.UserID = Int32.Parse(device.UserID);
            this.DeviceUri = device.DeviceURI;
            this.GroupName = device.GroupName;
            this.TilesEnabled = Boolean.Parse(device.EnableTiles);
            this.RawMessagesEnabled = Boolean.Parse(device.EnableRawMessages);
            this.ToastMessagesEnabled = Boolean.Parse(device.EnableToastMessages);
            this.LastUpdateDate = device.DeviceModified;
            this.RegistrationDate = device.DeviceRegistered;
            this.User = user;
        }
Пример #19
0
        internal GamePlayer(BuddyClient client, AuthenticatedUser user, InternalModels.DataContract_GamePlayerInfo info)
        {
            if (client == null) throw new ArgumentNullException("client");
            if (user == null) throw new ArgumentNullException("user");
            if (info == null) throw new ArgumentNullException("info");

            this.UserID = user.ID;
            
            this.ApplicationTag = info.ApplicationTag;
            this.BoardName = info.PlayerBoardName;
            this.CreatedOn = Convert.ToDateTime(info.PlayerDate, CultureInfo.InvariantCulture);
            this.Latitude = client.TryParseDouble(info.PlayerLatitude);
            this.Longitude = client.TryParseDouble(info.PlayerLongitude);
            this.Name = info.PlayerName;
            this.Rank = info.PlayerRank;
        }
Пример #20
0
        internal StoreItem(BuddyClient client, AuthenticatedUser user, InternalModels.DataContract_CommerceStoreGetItems storeItem)
            : base(client, user)
        {

            this.AppData = storeItem.AppData;
            this.CustomItemID = storeItem.CustomItemID;
            this.StoreItemID = storeItem.StoreItemID;
            this.ItemAvailableFlag = storeItem.ItemAvailableFlag == "true";
            this.ItemCost = storeItem.ItemCost;
            this.ItemDateTime = DateTime.Parse(storeItem.ItemDateTime);
            this.ItemDescription = storeItem.ItemDescription;
            this.ItemDownloadUri = storeItem.ItemDownloadUri;
            this.ItemFreeFlag = storeItem.ItemFreeFlag == "true";
            this.ItemIconUri = storeItem.ItemIconUri;
            this.ItemName = storeItem.ItemName;
            this.ItemPreviewUri = this.ItemPreviewUri;
        }
Пример #21
0
        internal Receipt(BuddyClient client, AuthenticatedUser user, InternalModels.DataContract_CommerceReceipt receipt)
            : base(client, user)
        {


            this.AppData = receipt.AppData;
            this.HistoryCustomTransactionID = receipt.HistoryCustomTransactionID;
            this.HistoryDateTime = DateTime.Parse(receipt.HistoryDateTime);
            this.ItemQuantity = int.Parse(receipt.ItemQuantity);
            this.ReceiptData = receipt.ReceiptData;
            this.ReceiptHistoryID = long.Parse(receipt.ReceiptHistoryID);
            this.StoreItemID = long.Parse(receipt.StoreItemID);
            this.StoreName = receipt.StoreName;
            this.TotalCost = receipt.TotalCost;
            this.UserID = long.Parse(receipt.UserID);
            this.VerificationResultData = !string.IsNullOrEmpty(receipt.VerificationResult) && bool.Parse(receipt.VerificationResult) ? this.VerificationResultData : "";
        }
Пример #22
0
        private void UserCreated(AuthenticatedUser user)
        {
            this.SaveSettings();

            this.SavePhoto(user);

            this.NavigateToMain(user);
        }
Пример #23
0
        private void SavePhoto(AuthenticatedUser user)
        {
            if (this.chosenPhotoBytes != null)
            {
                user.AddProfilePhotoAsync((success, parameters) =>
                {
                    // TODO: handle errors

                }, this.chosenPhotoBytes);
            }
        }
Пример #24
0
        private void NavigateToMain(AuthenticatedUser user)
        {
            ((App)App.Current).User = user;

            Utilities.CrossThread(() =>
            {
                NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
            });
        }
        internal NotificationsApple (BuddyClient client, AuthenticatedUser user)
            : base(client, user)
        {

        }
Пример #26
0
 public Blobs(BuddyClient client, AuthenticatedUser user)
     : base(client, user) { }
Пример #27
0
 private void displayFriends(AuthenticatedUser tempUser)
 {
     if (networkCheck())
         {
             tempUser.Friends.GetAllAsync((Users, state) =>
                 {
                     ListOfFriends.ItemsSource = Users;
                 });
         }
 }
Пример #28
0
        private void addFriend(AuthenticatedUser tempUser, User temporaryUser)
        {
            if (networkCheck())
                {
                    tempUser.Friends.Requests.AddAsync((r, state3) =>
                    {

                    }, tempUser);
                }
        }
Пример #29
0
        public void signInChat()
        {
            networkAvailable = DeviceNetworkInformation.IsNetworkAvailable;
            if (networkAvailable)
            {
                try
                {
                    budClient.LoginAsync((u, state) =>
                    {

                        authUser = u;
                        downloadMessages();
                        id.Dispatcher.BeginInvoke(delegate
                        {
                            if (authUser != null)
                            {
                                id.Text = authUser.ID.ToString();
                                collapseSignIn.Visibility = Visibility.Collapsed;
                                messageList.Visibility = Visibility.Visible;
                                yourID.Visibility = Visibility.Visible;
                                id.Visibility = Visibility.Visible;
                                refreshMessages.Visibility = Visibility.Visible;
                                SendingNotice.Visibility = Visibility.Collapsed;
                                SendingMessage.Visibility = Visibility.Visible;
                            }
                            else
                            {
                                MessageBox.Show("That appears to be the wrong user ID");
                            }
                        });
                    }, uid, pw);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Oops incorrect username or password  " + ex);
                }
            }
            else
            {
                networkCheck();
            }
        }
Пример #30
0
        public void createAccount()
        {
            uid = un.Text;
            pw = password.Text;

            networkAvailable = DeviceNetworkInformation.IsNetworkAvailable;
            if (networkAvailable)
            {
            budClient.CreateUserAsync((u, state) =>
            {
                authUser = u;
                signInChat();
            }, uid, pw);

            collapseSignIn.Visibility = Visibility.Collapsed;
            messageList.Visibility = Visibility.Visible;
            yourID.Visibility = Visibility.Visible;
            id.Visibility = Visibility.Visible;
            }
            else
            {
                networkCheck();
            }
        }