public ArgumentDialogViewModel(ArgumentMetadata argumentMetadata, IEnumerable<IVplType> types)
        {
            if (argumentMetadata == null) throw new ArgumentNullException(nameof(argumentMetadata));
            if (types == null) throw new ArgumentNullException(nameof(types));

            _argumentMetadata = argumentMetadata;
            _types = types;

            OkCommand = new RelayCommand(Ok, CanOk);
        }
Exemple #2
0
        /// <summary>
        /// Returns a new argument if one was created, false otherwise.
        /// </summary>
        /// <returns></returns>
        private IArgument CreateArgument()
        {
            var metadata = new ArgumentMetadata()
            {
                Id = Guid.NewGuid(),
            };

            //Create the view model
            var viewModel = new ArgumentDialogViewModel(metadata, _context.Types);

            //Create the dialog
            var view = new ArgumentDialogView()
            {
                DataContext = viewModel,
                Owner = WindowUtil.GetActiveWindow()
            };

            //Show the dialog
            if (view.ShowDialog() == true)
            {
                //Create the argument
                return new Argument(this, viewModel.ToMetadata());               
            }

            return null;
        }
Exemple #3
0
 public Argument(IElementOwner owner, ArgumentMetadata metadata)
 {
     if (owner == null) throw new ArgumentNullException(nameof(owner));
     _owner = owner;
     _metadata = metadata;
 }