예제 #1
0
        private async void AddItem_Button_OnClick(object sender, RoutedEventArgs e)
        {
            AddItemName.Text        = "";
            AddItemName.Description = "";
            AddItemAmount.Value     = 1;

            if (await AddItemDialog.ShowAsync() != ContentDialogResult.Primary)
            {
                return;
            }

            try
            {
                var item = new ItemDTO()
                {
                    Title       = AddItemName.Text,
                    Description = AddItemDesc.Text,
                    Amount      = (int)Math.Ceiling(AddItemAmount.Value)
                };

                var newItem = await _service.AddPackingItem(_tripId, _sectionId, item);

                _items.Add(newItem);
                _tripDetailsPage.UpdateProgressBar();
                Bindings.Update();
            }
            catch
            {
                //TODO exception handling
            }
        }