コード例 #1
0
        private async void EditInventoryButton_Click(object sender, RoutedEventArgs e)
        {
            var selectedInventory = DataGridInventory.SelectedItem as InventoryRow;

            if (selectedInventory != null)
            {
                _editItemViewModel = new ViewModels.EditItemViewModel
                {
                    Id                     = selectedInventory.Id,
                    Engineer               = selectedInventory.Engineer,
                    Name                   = selectedInventory.Name,
                    RawMaterial            = selectedInventory.RawMaterial,
                    DevelopmentStatus      = Enum.Parse <DevelopmentStatus>(selectedInventory.Status, true),
                    DevelopmentStartDate   = selectedInventory.DevelopmentStartDate,
                    ExpectedCompletionDate = selectedInventory.ExpectedCompletionDate,
                    Notes                  = selectedInventory.Notes,
                    ImageSource            = selectedInventory.ImageSource
                };

                var editItemView = new EditItemView
                {
                    EditItemViewModel = _editItemViewModel
                };

                await editItemView.ShowAsync();
            }
            else
            {
                await new MessageDialog("Please select an item to edit").ShowAsync();
            }
        }
コード例 #2
0
        private async void NewInventoryButton_Click(object sender, RoutedEventArgs e)
        {
            _editItemViewModel = new ViewModels.EditItemViewModel
            {
                Id    = "NewUserId",
                Name  = "New Name",
                Notes = "New Notes"
            };

            var editItemView = new EditItemView
            {
                EditItemViewModel = _editItemViewModel
            };

            await editItemView.ShowAsync();
        }
コード例 #3
0
        private async void EditInventoryButton_Click(object sender, RoutedEventArgs e)
        {
            var selectedInventory = DataGridInventory.SelectedItem as InventoryRow;

            if (selectedInventory != null)
            {
                _editItemViewModel = new ViewModels.EditItemViewModel
                {
                    Id                     = selectedInventory.Id,
                    Engineer               = selectedInventory.Engineer,
                    Name                   = selectedInventory.Name,
                    RawMaterial            = selectedInventory.RawMaterial,
                    DevelopmentStatus      = Enum.Parse <DevelopmentStatus>(selectedInventory.Status, true),
                    DevelopmentStartDate   = selectedInventory.DevelopmentStartDate,
                    ExpectedCompletionDate = selectedInventory.ExpectedCompletionDate,
                    Notes                  = selectedInventory.Notes,
                    ImageSource            = selectedInventory.ImageSource
                };

                var editItemView = new EditItemView
                {
                    EditItemViewModel = _editItemViewModel
                };

                await UserActivityService.Current.RecordInventoryUserActivity(_editItemViewModel);

                ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("nose", SelectedImage);
                SelectedImage.Visibility = Visibility.Collapsed;

                editItemView.Closing += (s, ev) =>
                {
                    SelectedImage.Visibility = Visibility.Visible;
                    ConnectedAnimation noseAnimation = ConnectedAnimationService.GetForCurrentView().GetAnimation("nose");
                    if (noseAnimation != null)
                    {
                        noseAnimation.TryStart(SelectedImage);
                    }
                };

                await editItemView.ShowAsync();
            }
            else
            {
                await new MessageDialog("Please select an item to edit").ShowAsync();
            }
        }
コード例 #4
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            var parameters = e.Parameter.ToString().Split("id=");

            if (parameters.Length <= 1)
            {
                return;
            }

            bool isNewItem = false;

            InventoryRow inventoryRow = null;

            if (!isNewItem)
            {
                inventoryRow = InventoryBLL.Current.GetInventory().FindById(parameters[1]);
            }

            isNewItem = (inventoryRow == null);

            _editItemViewModel = new EditItemViewModel();

            if (!isNewItem && inventoryRow != null)
            {
                _editItemViewModel.Id                     = inventoryRow.Id;
                _editItemViewModel.Engineer               = inventoryRow.Engineer;
                _editItemViewModel.Name                   = inventoryRow.Name;
                _editItemViewModel.RawMaterial            = inventoryRow.RawMaterial;
                _editItemViewModel.DevelopmentStartDate   = inventoryRow.DevelopmentStartDate;
                _editItemViewModel.ExpectedCompletionDate = inventoryRow.ExpectedCompletionDate;
                _editItemViewModel.Notes                  = inventoryRow.Notes;
                _editItemViewModel.ImageSource            = inventoryRow.ImageSource;
            }

            var editItemView = new EditItemView
            {
                EditItemViewModel = _editItemViewModel,
            };

            await editItemView.ShowAsync();
        }