Exemplo n.º 1
0
        /// <summary>
        /// folderListClient event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void FolderListClient_GetCompleted(LiveOperationResult e, SkydriveAlbum album)
        {
            album.Photos.Clear();
            List <object> data = (List <object>)e.Result["data"];

            NumberOfImages = data.Count;

            if (NumberOfImages == 0)
            {
                HideProgressBar();
                return;
            }

            foreach (IDictionary <string, object> photo in data)
            {
                var item = new SkydrivePhoto();
                item.Title       = (string)photo["name"];
                item.Subtitle    = (string)photo["name"];
                item.PhotoUrl    = (string)photo["source"];
                item.Description = (string)photo["description"];
                item.ID          = (string)photo["id"];

                if (album != null)
                {
                    album.Photos.Add(item);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// DownloadPictures downs picutre link from sky dirve
        /// </summary>
        /// <param name="albumItem"></param>
        private void DownloadPictures(SkydriveAlbum albumItem)
        {
            LiveConnectClient folderListClient = new LiveConnectClient(App.Session);

            folderListClient.GetCompleted += new EventHandler <LiveOperationCompletedEventArgs>(FolderListClient_GetCompleted);
            folderListClient.GetAsync(albumItem.ID + "/files", albumItem);
        }
Exemplo n.º 3
0
        /// <summary>
        /// GetAlbumPicture get all the picture from each album
        /// </summary>
        /// <param name="albumItem"></param>
        private void GetAlbumPicture(SkydriveAlbum albumItem)
        {
            LiveConnectClient albumPictureClient = new LiveConnectClient(App.Session);

            albumPictureClient.GetCompleted += new EventHandler <LiveOperationCompletedEventArgs>(albumPictureClient_GetCompleted);
            albumPictureClient.GetAsync(albumItem.ID + "/picture", albumItem);
        }
Exemplo n.º 4
0
        /// <summary>
        /// DownloadPictures downs picutre link from sky dirve
        /// </summary>
        /// <param name="albumItem"></param>
        private async void DownloadPictures(SkydriveAlbum albumItem)
        {
            LiveConnectClient   folderListClient = new LiveConnectClient(App.Session);
            LiveOperationResult result           = await folderListClient.GetAsync(albumItem.ID + "/files");

            FolderListClient_GetCompleted(result, albumItem);
        }
Exemplo n.º 5
0
        /// <summary>
        /// DownloadPictures downs picutre link from sky dirve
        /// </summary>
        /// <param name="albumItem"></param>
        private async void DownloadPictures(SkydriveAlbum albumItem)
        {
            LiveConnectClient folderListClient = new LiveConnectClient(App.Session);
            LiveOperationResult result = await folderListClient.GetAsync(albumItem.ID + "/files");
            FolderListClient_GetCompleted(result, albumItem);

        }
Exemplo n.º 6
0
 /// <summary>
 /// LiveConnectClient event handler
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void DeleteFolder_Completed(SkydriveAlbum selectedAlbum, LiveOperationResult e)
 {
     if (e.Result != null)
     {
         Albums.Remove(selectedAlbum);
     }
     else
     {
         string msgDelFailed = SkyPhoto.Resources.Resources.msgDelFailed;
         MessageBox.Show(msgDelFailed);
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// LiveConnectClient event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void DeleteFolder_Completed(object sender, LiveOperationCompletedEventArgs e)
        {
            SkydriveAlbum selectedAlbum = e.UserState as SkydriveAlbum;

            if (e.Error == null)
            {
                Albums.Remove(selectedAlbum);
            }
            else
            {
                string msgDelFailed = SkyPhoto.Resources.Resources.msgDelFailed;
                MessageBox.Show(msgDelFailed);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// GetAlbumPicture get all the picture from each album
        /// </summary>
        /// <param name="albumItem"></param>
        private async void GetAlbumPicture(SkydriveAlbum albumItem)
        {
            try
            {
                LiveConnectClient albumPictureClient = new LiveConnectClient(App.Session);

                LiveOperationResult result = await albumPictureClient.GetAsync(albumItem.ID + "/picture");

                albumPictureClient_GetCompleted(result, albumItem);
            }
            catch (LiveConnectException lce)
            {
                albumPictureClient_GetCompleted(null, albumItem);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// LiveConnectClient event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void albumPictureClient_GetCompleted(LiveOperationResult e, SkydriveAlbum album)
        {
            if (e != null)
            {
                album.AlbumPicture = (string)e.Result["location"];
            }
            else
            {
                album.AlbumPicture = "/icons/empty_album.png";
            }
            // hide progressbar.
            ImageCounter--;

            if (ImageCounter == 0)
            {
                HideProgressBar();
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// LiveConnectClient event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void GetAlubmData_Completed(LiveOperationResult e)
        {
            List <object> data = (List <object>)e.Result["data"];

            if (ImageCounter == 0)
            {
                ImageCounter = data.Count;
            }

            foreach (IDictionary <string, object> album in data)
            {
                SkydriveAlbum albumItem = new SkydriveAlbum();
                albumItem.Title       = (string)album["name"];
                albumItem.Description = (string)album["description"];
                albumItem.ID          = (string)album["id"];
                Albums.Add(albumItem);
                GetAlbumPicture(albumItem);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// ContextMenu delete button tergar MenuDelte_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MenuDelte_Click(object sender, RoutedEventArgs e)
        {
            var           Menu             = sender as MenuItem;
            SkydriveAlbum selectedAlbum    = Menu.DataContext as SkydriveAlbum;
            string        msgDel           = SkyPhoto.Resources.Resources.msgDelAlbum;
            string        msgDelAlbumTitel = SkyPhoto.Resources.Resources.msgDelAlbumTitel;

            MessageBoxResult m = MessageBox.Show(msgDel + selectedAlbum.Title + "?", msgDelAlbumTitel, MessageBoxButton.OKCancel);

            if (m == MessageBoxResult.OK)
            {
                LiveConnectClient client = new LiveConnectClient(App.Session);
                client.DeleteCompleted +=
                    new EventHandler <LiveOperationCompletedEventArgs>(DeleteFolder_Completed);
                client.DeleteAsync(selectedAlbum.ID, selectedAlbum);
            }
            else
            {
                return;
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// LiveConnectClient event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void albumPictureClient_GetCompleted(object sender, LiveOperationCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                SkydriveAlbum album = (SkydriveAlbum)e.UserState;
                album.AlbumPicture = (string)e.Result["location"];
            }
            else
            {
                // this is an empty album so set empty icon
                SkydriveAlbum album = (SkydriveAlbum)e.UserState;
                album.AlbumPicture = "/icons/empty_album.png";
            }

            // hide progressbar.
            ImageCounter--;

            if (ImageCounter == 0)
            {
                HideProgressBar();
            }
        }
Exemplo n.º 13
0
 /// <summary>
 /// GetAlbumPicture get all the picture from each album
 /// </summary>
 /// <param name="albumItem"></param>
 private void GetAlbumPicture(SkydriveAlbum albumItem)
 {
     LiveConnectClient albumPictureClient = new LiveConnectClient(App.Session);
     albumPictureClient.GetCompleted += new EventHandler<LiveOperationCompletedEventArgs>(albumPictureClient_GetCompleted);
     albumPictureClient.GetAsync(albumItem.ID + "/picture", albumItem);
 }
Exemplo n.º 14
0
        /// <summary>
        /// GetAlbumPicture get all the picture from each album
        /// </summary>
        /// <param name="albumItem"></param>
        private async void GetAlbumPicture(SkydriveAlbum albumItem)
        {
            try
            {
                LiveConnectClient albumPictureClient = new LiveConnectClient(App.Session);

                LiveOperationResult result = await albumPictureClient.GetAsync(albumItem.ID + "/picture");
                albumPictureClient_GetCompleted(result, albumItem);
            }
            catch (LiveConnectException lce)
            {
                albumPictureClient_GetCompleted(null, albumItem);
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// LiveConnectClient event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void albumPictureClient_GetCompleted(LiveOperationResult e, SkydriveAlbum album)
        {
            if (e != null)
            {
                album.AlbumPicture = (string)e.Result["location"];
            }
            else
            {
                album.AlbumPicture = "/icons/empty_album.png";
            }
            // hide progressbar.
            ImageCounter--;

            if (ImageCounter == 0)
            {
                HideProgressBar();
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// folderListClient event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void FolderListClient_GetCompleted(LiveOperationResult e, SkydriveAlbum album)
        {
            album.Photos.Clear();
            List<object> data = (List<object>)e.Result["data"];
            NumberOfImages = data.Count;

            if (NumberOfImages == 0)
            {
                HideProgressBar();
                return;
            }

            foreach (IDictionary<string, object> photo in data)
            {
                var item = new SkydrivePhoto();
                item.Title = (string)photo["name"];
                item.Subtitle = (string)photo["name"];
                item.PhotoUrl = (string)photo["source"];
                item.Description = (string)photo["description"];
                item.ID = (string)photo["id"];

                if (album != null)
                {
                    album.Photos.Add(item);
                }
            }
        }
Exemplo n.º 17
0
 /// <summary>
 /// DownloadPictures downs picutre link from sky dirve
 /// </summary>
 /// <param name="albumItem"></param>
 private void DownloadPictures(SkydriveAlbum albumItem)
 {
     LiveConnectClient folderListClient = new LiveConnectClient(App.Session);
     folderListClient.GetCompleted += new EventHandler<LiveOperationCompletedEventArgs>(FolderListClient_GetCompleted);
     folderListClient.GetAsync(albumItem.ID + "/files", albumItem);
 }
Exemplo n.º 18
0
 /// <summary>
 /// LiveConnectClient event handler
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void DeleteFolder_Completed(SkydriveAlbum selectedAlbum, LiveOperationResult e)
 {
     if (e.Result != null)
     {
         Albums.Remove(selectedAlbum);
     }
     else
     {
         string msgDelFailed = SkyPhoto.Resources.Resources.msgDelFailed;
         MessageBox.Show(msgDelFailed);
     }
 }
Exemplo n.º 19
0
        /// <summary>
        /// LiveConnectClient event handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void GetAlubmData_Completed(LiveOperationResult e)
        {
            List<object> data = (List<object>)e.Result["data"];
            if (ImageCounter == 0)
            {
                ImageCounter = data.Count;
            }

            foreach (IDictionary<string, object> album in data)
            {
                SkydriveAlbum albumItem = new SkydriveAlbum();
                albumItem.Title = (string)album["name"];
                albumItem.Description = (string)album["description"];
                albumItem.ID = (string)album["id"];
                Albums.Add(albumItem);
                GetAlbumPicture(albumItem);
            }
        }