Example #1
0
        private async Task SaveImageDetails(string url)
        {
            var imageDetails = new ImageDetails();

            imageDetails.Title    = txtTitle.Text;
            imageDetails.Message  = txtMessage.Text;
            imageDetails.Category = lstCategory.SelectedItem.ToString().ToLower();
            imageDetails.Url      = url;
            imageDetails.IsPublic = chkPublic.IsChecked == true;

            if (await imageDetails.Save() == false)
            {
                MessageBox.Show("Failed to upload the image. Please try again.");
                (ApplicationBar.Buttons[1] as ApplicationBarIconButton).IsEnabled = false;
                progress.Visibility = System.Windows.Visibility.Collapsed;
            }
            else
            {
                //add new item to the list
                App.ViewModel.AddItem(imageDetails);

                progress.Visibility = System.Windows.Visibility.Collapsed;
                appBarCancel_Click();
            }
        }
Example #2
0
        private void GestureListener_Flick(object sender, FlickGestureEventArgs e)
        {
            if (gEdit.Visibility == System.Windows.Visibility.Visible)
            {
                return;
            }
            ImageDetails item = null;

            if (e.HorizontalVelocity < 0)
            {
                if (_index + 1 == _contextItems.Count)
                {
                    return;
                }
                _index++;
                //load next
                item = _contextItems[_index];
            }
            else if (e.HorizontalVelocity > 0)
            {
                if (_index == 0)
                {
                    return;
                }
                //load previous
                _index--;
                item = _contextItems[_index];
            }
            _context    = new ItemViewModel(item);
            DataContext = _context;
            if (!_context.IsDataLoaded)
            {
                _context.LoadData();
            }
        }
Example #3
0
        public void RemoveItem(ImageDetails item)
        {
            App.ViewModel.FoodItems.Remove(item);
            App.ViewModel.PeopleItems.Remove(item);
            App.ViewModel.PlaceItems.Remove(item);

            this.NoFoodItems   = this.FoodItems.Count == 0;
            this.NoPlaceItems  = this.PlaceItems.Count == 0;
            this.NoPeopleItems = this.PeopleItems.Count == 0;
        }
Example #4
0
        public void AddItem(ImageDetails item)
        {
            //depending upon category, update ViewModel
            switch (item.Category)
            {
            case "place":
                App.ViewModel.PlaceItems.Add(item);
                App.ViewModel.NoPlaceItems = false;
                break;

            case "people":
                App.ViewModel.PeopleItems.Add(item);
                App.ViewModel.NoPeopleItems = false;
                break;

            default:
                App.ViewModel.FoodItems.Add(item);
                App.ViewModel.NoFoodItems = false;
                break;
            }
        }
Example #5
0
 public ItemViewModel(ImageDetails imageDetails)
 {
     this._imageDetails = imageDetails;
 }