public new static FieldValueUserControlViewModel CreateFrom(IKernel kernel, FieldDialogViewModel field)
        {
            var fvvm = kernel.Get <FieldValueUserControlViewModel>();

            fvvm.CopyFrom(field);
            return(fvvm);
        }
Example #2
0
 public Field(FieldDialogViewModel vm)
 {
     Name        = vm.Name;
     Default     = vm.SelectedFieldType == FieldType.CheckBox ? vm.DefaultBoolean.ToString() : vm.DefaultString;
     Prompt      = vm.Prompt;
     Description = vm.Description;
     Debug.Assert(vm.SelectedFieldType.HasValue, "FieldType shouldn't be null.");
     FieldType = vm.SelectedFieldType.Value;
     if (vm.Choices != null)
     {
         Choices = ((ObservableCollection <StringViewModel>)vm.Choices.SourceCollection).Select(c => c.Value).ToArray();
     }
 }
        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")
                };
            }
        }
Example #4
0
        public void ExecuteEditFieldCommand()
        {
            var vm = (FieldDialogViewModel)Fields.CurrentItem;

            var copy = FieldDialogViewModel.CreateFrom(Kernel, 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();
            }
        }