public static FieldDialogViewModel CreateFrom(IUnityContainer container, FieldDialogViewModel vm)
        {
            var copy = container.Resolve <FieldDialogViewModel>();

            copy.CopyFrom(vm);
            return(copy);
        }
        public virtual void CopyFrom(FieldDialogViewModel field)
        {
            _name           = field.Name;
            _defaultString  = field._defaultString;
            _defaultBoolean = field._defaultBoolean;
            _prompt         = field.Prompt;
            _description    = field.Description;

            ChoicesSource = field._choicesSource == null ? new ObservableCollection <StringViewModel>() : new ObservableCollection <StringViewModel>(field._choicesSource);
            _choices      = new ListCollectionView(_choicesSource);

            _selectedFieldType = field.SelectedFieldType;
        }
Beispiel #3
0
        public override void CopyFrom(FieldDialogViewModel field)
        {
            base.CopyFrom(field);

            if (field.SelectedFieldType == FieldType.Class)
            {
                Types = new ObservableCollection <AssemblyQualifiedType>
                {
                    new AssemblyQualifiedType("", null),
                    new AssemblyQualifiedType("My.NamespaceA.Type1", "My.Assembly"),
                    new AssemblyQualifiedType("My.NamespaceA.Type2", "My.Assembly"),
                    new AssemblyQualifiedType("My.NamespaceB.Type1", "My.Assembly"),
                    new AssemblyQualifiedType("Another.Namespace.And.AUserControl", "Another.Assembly"),
                    new AssemblyQualifiedType("Another.Namespace.And.SomeWindow", "Another.Assembly"),
                    new AssemblyQualifiedType("Another.Namespace.And.Some2Window", "Another.Assembly")
                };
            }
        }
Beispiel #4
0
        public void ExecuteEditFieldCommand()
        {
            var vm = (FieldDialogViewModel)Fields.CurrentItem;

            var copy = FieldDialogViewModel.CreateFrom(Container, vm);

            var source = (ObservableCollection <FieldDialogViewModel>)Fields.SourceCollection;

            copy.Edit(IsInternal, source.Select(t => t.Name));
            if (DialogService.ShowDialog(copy))
            {
                // Success, copy fields back into our instance, save, and refresh frameworks (filter combobox).
                vm.CopyFrom(copy);

                Fields.MoveCurrentTo(vm);
                _fieldsChanged = true;
                OkCommand.RaiseCanExecuteChanged();
                Fields.Refresh();
                ResetFieldValuesForAllBuffers();
            }
        }
 private void SaveUnmodifiedValues()
 {
     _unmodified = Container.Resolve <FieldDialogViewModel>();
     _unmodified.CopyFrom(this);
 }
Beispiel #6
0
        public new static FieldValueUserControlViewModel CreateFrom(IUnityContainer container, FieldDialogViewModel field)
        {
            var fvvm = container.Resolve <FieldValueUserControlViewModel>();

            fvvm.CopyFrom(field);
            return(fvvm);
        }