示例#1
0
        public async void SaveFavouriteToCloud(Favourite fav)
        {
            if (!AppService.IsConnected())
            {
                return;
            }

            try
            {
                //var items = AppDatabase.Current.RetrieveSolutionsByGrouping(sessionId);
                //foreach (var item in items)
                //{
                AzureMobileService.Current.PushToCloud(fav);
                //}

                Messenger.Default.Send <GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...")
                {
                    Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "WRITE"
                });
            }
            catch
            {
                Messenger.Default.Send <GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...")
                {
                    Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "ERROR"
                });
            }
        }
示例#2
0
        public async Task LoadPicture(Favourite photo)
        {
            
            try
            {

                layoutRoot.DataContext = photo;

                var folder = await Windows.Storage.KnownFolders.PicturesLibrary.GetFolderAsync("ModernCSApp");
                var file = await folder.GetFileAsync(photo.AggregateId.Replace("-","") + ".jpg");

                using (var stream = await file.OpenReadAsync())
                {
                    BitmapImage bi = new BitmapImage();
                    bi.SetSource(stream);
                    imgMain.Source = bi;

                }

                grdPhotoQuickDetails.Visibility = Windows.UI.Xaml.Visibility.Visible;
                
                if (photo.MediaTitle != string.Empty) grdPhotoQuickDetailsTop.Visibility = Windows.UI.Xaml.Visibility.Visible;
                else grdPhotoQuickDetailsTop.Visibility = Visibility.Collapsed;

                //imgMain.Source = bi;
                if (ChangeViewState != null) ChangeViewState("Normal", null);
            }
            catch
            {

            }
        }
示例#3
0
        public async void PushToCloud(Favourite favourite)
        {
            if (!AppService.IsConnected())
            {
                return;
            }

            try
            {
                if (favourite.MSId != 0)
                {
                    int id = favourite.Id;
                    favourite.Id   = favourite.MSId;
                    favourite.MSId = id;
                    await mstFavourite.UpdateAsync(favourite);

                    favourite.Id = id;
                }
                else
                {
                    favourite.Id = 0;
                    await mstFavourite.InsertAsync(favourite);

                    //AppDatabase.Current.UpdateFavouriteField(favourite.AggregateId, "MSId", favourite.Id, false);
                }

                Messenger.Default.Send <GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...")
                {
                    Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "WRITE"
                });
            }
            catch
            {
                Messenger.Default.Send <GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...")
                {
                    Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "ERROR"
                });
            }
        }
        public async void SaveFavouriteToCloud(Favourite fav)
        {
            if (!AppService.IsConnected()) return;

            try
            {
                //var items = AppDatabase.Current.RetrieveSolutionsByGrouping(sessionId);
                //foreach (var item in items)
                //{
                AzureMobileService.Current.PushToCloud(fav);
                //}

                Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "WRITE" });
            }
            catch
            {
                Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "ERROR" });
            }
        }
        public async void PushToCloud(Favourite favourite)
        {
            if (!AppService.IsConnected()) return;

            try
            {
                if (favourite.MSId != 0)
                {
                    int id = favourite.Id;
                    favourite.Id = favourite.MSId;
                    favourite.MSId = id;
                    await mstFavourite.UpdateAsync(favourite);
                    favourite.Id = id;
                }
                else
                {
                    favourite.Id = 0;
                    await mstFavourite.InsertAsync(favourite);
                    //AppDatabase.Current.UpdateFavouriteField(favourite.AggregateId, "MSId", favourite.Id, false);
                }

                Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "WRITE" });
            }
            catch
            {
                Messenger.Default.Send<GeneralSystemWideMessage>(new GeneralSystemWideMessage("writing ...") { Identifier = "CLOUD BAR", SourceId = "AzureMobileService", Action = "ERROR" });
            }
        }
示例#6
0
 public async Task LoadPicture(Favourite photo, string loggedInUserId)
 {
     await LoadPicture(photo);
 }
        private void ShowPicturesList()
        {
            sbShowPicturesList.Begin();
            
            flickrPromoted.ManuallyChangeViewState("Normal");
            flickrPublicFavourites.ManuallyChangeViewState("Normal");
            //flickrSmallList.Visibility = Visibility.Collapsed;
            sbHideSmallPicturesList.Begin();


            sbHidePicture.Begin();
            sbHidePictureDetails.Begin();
            //sbHidePictureExifInfo.Begin();

            //flickrPictureDetails.ClearAll();
            ResetPictureToolbar();

            _selectedFav = null;
            _lastFavTypeRetrieved = "";


            //flickrPictureDetails.Opacity = 1;

            //var gsv = FindVisualChild<ScrollViewer>(flickrListOfPics);
            //gsv.ScrollToHorizontalOffset(0);
            //gsv.Focus(Windows.UI.Xaml.FocusState.Pointer);
        }
        private async void flickrSmallList_PictureChanged(object sender, EventArgs e)
        {
            if (sender is string)
            {
                
                var selectedPhoto = Deserialize<FlickrNet.Photo>(sender as string);
                _fvm.SelectedPhoto = selectedPhoto;
                
                var newSelectedFav = _fvm.ConvertPhotoToFavourite(selectedPhoto, new FlickrNet.PhotoInfo(), "");
                if (_lastFavTypeRetrieved == "UserFavs")
                {
                    newSelectedFav.UserAvatar = _selectedFav.UserAvatar;
                }
                else if (_lastFavTypeRetrieved == "PhotographerFavs")
                {
                    newSelectedFav.MediaUserAvatar = _selectedFav.MediaUserAvatar;
                }
                _selectedFav = newSelectedFav;

                flickrPicture_ChangeViewState("Minimized", null);

                //DOWNLOAD ACTUAL IMAGE INTO PICTURES LIBRARY
                //todo: need to work out the best way to save and load these pics
                await DownloadService.Current.Downloader("1", _selectedFav.MediaUrlMedium, string.Empty, _selectedFav.AggregateId.Replace("-", ""), 2, storageFolder: "ModernCSApp");

                


                await flickrPicture.LoadPicture(_selectedFav, _fvm.FlickrPerson != null ? _fvm.FlickrPerson.UserId : null);
                

                sbHideSmallPicturesList.Begin();

                if (_fvm.FlickrPerson != null)
                {
                    if (_selectedFav.UserAvatar.Contains(_fvm.FlickrPerson.UserId))
                    {
                        flickrPictureToolbar.ChangeViewTo(PictureToolbar.ViewType.PhotographerFavs | PictureToolbar.ViewType.UserFavs);
                    }
                    else
                    {
                        flickrPictureToolbar.ChangeViewTo(PictureToolbar.ViewType.PhotographerFavs | PictureToolbar.ViewType.UserFavs | PictureToolbar.ViewType.Fav);
                    }
                }

                _fvm.GetPhotoInfo(selectedPhoto);
                
            }
        }
        private async void flickrListOfPics_PictureChanged(object sender, EventArgs e)
        {

            if (sender is string) {
                _selectedFav = Deserialize<Favourite>(sender as string);


                await flickrPicture.LoadPicture(_selectedFav, _fvm.FlickrPerson!=null? _fvm.FlickrPerson.UserId:null);

                if (_fvm.FlickrPerson != null)
                {
                    if (_selectedFav.UserAvatar.Contains(_fvm.FlickrPerson.UserId))
                    {
                        flickrPictureToolbar.ChangeViewTo(PictureToolbar.ViewType.PhotographerFavs | PictureToolbar.ViewType.UserFavs);
                    }
                    else
                    {
                        flickrPictureToolbar.ChangeViewTo(PictureToolbar.ViewType.PhotographerFavs | PictureToolbar.ViewType.UserFavs | PictureToolbar.ViewType.Fav);
                    }
                }
                
                //_fvm.GetPhotoInfo(p);
                //_fvm.GetPhotoStream(p.UserId);

            }
            
        }