예제 #1
0
        /// <summary>
        /// Create new item and add into database
        /// </summary>
        protected override void CreateNewItem()
        {
            try
            {
                UnitViewModel viewModel = new UnitViewModel(this.MessageBoxService, (IUnitManager)ModelManager);

                // open dialog and return result when it is closed
                bool?result = this.UIVisualizerService.ShowDialog("UnitPopup", viewModel);

                // code to check result
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
        /// <summary>
        /// Edit an existing item and update in database
        /// </summary>
        protected override void EditItem(Unit selectedItem)
        {
            try
            {
                if (selectedItem == null)
                {
                    throw new ArgumentNullException("selectedItem");
                }

                UnitViewModel viewModel = new UnitViewModel(this.MessageBoxService, selectedItem, (IUnitManager)ModelManager);

                // open dialog and return result when it is closed
                bool?result = this.UIVisualizerService.ShowDialog("UnitPopup", viewModel);

                // code to check result
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }