public async Task AddItemAsync()
        {
            var viewModel = new AddEditItemDialogViewModel();

            viewModel.editedItem = new Item();
            viewModel.itemGroups = _contentProviderApiService.GetItemGroups();
            AddEditItemDialog   dialog = new AddEditItemDialog(viewModel);
            ContentDialogResult result = await dialog.ShowAsync();


            if (result == ContentDialogResult.Primary)
            {
                // mentes
                var itemGroup = dialog.ViewModel.selectedItemGroup;
                itemGroup.itemList.Add(dialog.ViewModel.editedItem);
                // lista frissites
                _contentProviderApiService.SaveData();
            }
        }
Пример #2
0
        public async Task EditItemAsync()
        {
            var adf = _contentProviderApiService.getItemGroupForItem(_item);

            var viewModel = new AddEditItemDialogViewModel();

            viewModel.editedItem = Item;
            viewModel.itemGroups = _contentProviderApiService.GetItemGroups();
            var itemGroup = _contentProviderApiService.getItemGroupForItem(Item);

            viewModel.selectedItemGroup = itemGroup;
            AddEditItemDialog   dialog = new AddEditItemDialog(viewModel);
            ContentDialogResult result = await dialog.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                itemGroup.itemList.Remove(Item);
                viewModel.selectedItemGroup.itemList.Add(Item);

                _contentProviderApiService.SaveData();
            }
        }
Пример #3
0
 public AddEditItemDialog(AddEditItemDialogViewModel viewModel)
 {
     this.InitializeComponent();
     ViewModel = viewModel;
 }