Beispiel #1
0
        /// <summary>
        /// Implementation for CreateNewModificationCommand.
        /// Creates and register a new modification.
        /// </summary>
        private void CreateNewModificationImplementation()
        {
            var customModVm = new CustomModificationViewModel(string.Empty, false, this.dialogService);

            if (this.dialogService.OpenCustomModification(customModVm))
            {
                IcParameters.Instance.RegisterModification(customModVm.ModificationName, customModVm.Composition);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Open a dialog to edit a modification.
        /// </summary>
        /// <param name="customModificationViewModel">The view model for the dialog.</param>
        /// <returns>A value indicating whether the user clicked OK on the dialog.</returns>
        public bool OpenCustomModification(CustomModificationViewModel customModificationViewModel)
        {
            var customModificationDialog = new CustomModificationView {
                DataContext = customModificationViewModel
            };

            customModificationViewModel.ReadyToClose += (o, e) => customModificationDialog.Close();
            customModificationDialog.ShowDialog();
            return(customModificationViewModel.Status);
        }
Beispiel #3
0
        /// <summary>
        /// Prompt user for modification mass or formula and register it with the application
        /// </summary>
        /// <param name="modificationName">Name of the modification to register</param>
        /// <param name="modificationNameEditable">Should the modification name be editable by the user?</param>
        /// <returns>Whether or not a modification was successfully registered.</returns>
        private bool RegisterNewModification(string modificationName, bool modificationNameEditable)
        {
            var customModVm = new CustomModificationViewModel(modificationName, modificationNameEditable, this.dialogService);

            this.dialogService.OpenCustomModification(customModVm);
            if (!customModVm.Status)
            {
                return(false);
            }

            if (customModVm.FromFormulaChecked)
            {
                IcParameters.Instance.RegisterModification(customModVm.ModificationName, customModVm.Composition);
            }
            else if (customModVm.FromMassChecked)
            {
                IcParameters.Instance.RegisterModification(customModVm.ModificationName, customModVm.Mass);
            }

            return(true);
        }
Beispiel #4
0
 public bool OpenCustomModification(CustomModificationViewModel customModificationViewModel)
 {
     throw new NotImplementedException();
 }