Beispiel #1
0
        public DrmControlViewModel()
        {
            AddSetterPropertiesTrigger(new PropertiesTrigger(() =>
            {
                var currentModel = GenericManager.Model;
                Entities         = GenericManager.Model.Entities.OrderBy(k => k.DisplayName).ToList();
                Relationships    = GenericManager.Model.Relationships;

                CurrentViewType = ViewType.List;
                CurrentEntity   = !string.IsNullOrEmpty(currentModel.MainEntity)
                     ? Entities.First(k => k.LogicalName == currentModel.MainEntity)
                     : Entities.First();
            }, nameof(GenericManager)));

            GenericEventManager = new GenericEventManager();
            GenericEventManager.OnCreateRequested += BusinessEventManager_OnCreateRequested;
            GenericEventManager.OnCreatedEntity   += GenericEventManager_OnCreatedEntity;
            GenericEventManager.OnUpdatedEntity   += BusinessEventManager_OnUpdatedEntity;
            GenericEventManager.OnSelectedEntity  += BusinessEventManager_OnSelectedEntity;
            GenericEventManager.OnDeletedEntity   += BusinessEventManager_OnDeletedEntity;

            WpfEventManager = new WpfEventManager();
            WpfEventManager.OnEntityReferenceInputLeftClicked += WpfEventManager_OnEntityReferenceInputLeftClicked;
            WpfEventManager.OnCustomModuleEditingRequest      += WpfEventManager_OnCustomModuleEditingRequest;
            InitializeCommands();
        }
Beispiel #2
0
 public void AddPasswordControl(WpfEventManager wpfEventManager)
 {
     PasswordInputControl = new PasswordInputControlView
     {
         WpfEventManager = wpfEventManager,
     };
     PasswordInputControl.ValueChanged += PasswordInputControlView_ValueChanged;
     TheControlGrid.Children.Add(PasswordInputControl);
 }
Beispiel #3
0
 private void InitializeCommands()
 {
     EditCustomModuleCommand = new RelayCommand((input) =>
     {
         var newContent = WpfEventManager.RaiseOnCustomModuleClicked(this, CustomModuleName, Value);
         Value          = newContent;
     });
     RegisterCommand(EditCustomModuleCommand);
 }
Beispiel #4
0
 public void AddDateTimeControl(WpfEventManager wpfEventManager, DateTime defaultValue)
 {
     DateTimeInputControl = new DateTimeInputControlView
     {
         DefaultValue    = defaultValue,
         WpfEventManager = wpfEventManager,
     };
     DateTimeInputControl.ValueChanged += DateTimeInputControlView_ValueChanged;
     TheControlGrid.Children.Add(DateTimeInputControl);
 }
Beispiel #5
0
 public void AddDoubleControl(WpfEventManager wpfEventManager, double defaultValue)
 {
     DoubleInputControl = new DoubleInputControlView
     {
         DefaultValue    = defaultValue,
         WpfEventManager = wpfEventManager,
     };
     DoubleInputControl.ValueChanged += DoubleInputControlView_ValueChanged;
     TheControlGrid.Children.Add(DoubleInputControl);
 }
Beispiel #6
0
 public void AddDecimalControl(WpfEventManager wpfEventManager, decimal defaultValue)
 {
     DecimalInputControl = new DecimalInputControlView
     {
         DefaultValue    = defaultValue,
         WpfEventManager = wpfEventManager,
     };
     DecimalInputControl.ValueChanged += DecimalInputControlView_ValueChanged;
     TheControlGrid.Children.Add(DecimalInputControl);
 }
Beispiel #7
0
 public void AddIntegerControl(WpfEventManager wpfEventManager, int defaultValue)
 {
     IntegerInputControl = new IntegerInputControlView
     {
         DefaultValue    = defaultValue,
         WpfEventManager = wpfEventManager,
     };
     IntegerInputControl.ValueChanged += IntegerInputControlView_ValueChanged;
     TheControlGrid.Children.Add(IntegerInputControl);
 }
Beispiel #8
0
 public void AddBooleanControl(WpfEventManager wpfEventManager, bool defaultValue)
 {
     BooleanInputControl = new BooleanInputControlView
     {
         DefaultValue    = defaultValue,
         WpfEventManager = wpfEventManager,
     };
     BooleanInputControl.ValueChanged += BooleanInputControlView_ValueChanged;
     TheControlGrid.Children.Add(BooleanInputControl);
 }
Beispiel #9
0
 public void AddOptionSetControl(WpfEventManager wpfEventManager, OptionSetValue defaultValue, List <OptionSetValue> options)
 {
     OptionSetInputControl = new OptionSetInputControlView
     {
         DefaultValue    = defaultValue,
         Options         = options,
         WpfEventManager = wpfEventManager,
     };
     OptionSetInputControl.ValueChanged += OptionSetInputControlView_ValueChanged;
     TheControlGrid.Children.Add(OptionSetInputControl);
 }
Beispiel #10
0
 public void AddEntityReferenceControl(WpfEventManager wpfEventManager, EntityReferenceValue defaultValue)
 {
     EntityReferenceInputControl = new EntityReferenceInputControlView
     {
         DefaultValue    = defaultValue,
         InputModel      = ViewModel.InputModel,
         WpfEventManager = wpfEventManager,
     };
     EntityReferenceInputControl.ValueChanged += EntityReferenceInputControlView_ValueChanged;
     TheControlGrid.Children.Add(EntityReferenceInputControl);
 }
Beispiel #11
0
 public void AddMultilineStringControl(WpfEventManager wpfEventManager, string defaultValue)
 {
     StringInputControl = new StringInputControlView
     {
         DefaultValue    = defaultValue,
         IsReadOnly      = false,
         IsMultiline     = true,
         WpfEventManager = wpfEventManager,
     };
     StringInputControl.ValueChanged += StringInputControlView_ValueChanged;
     TheControlGrid.Children.Add(StringInputControl);
 }
Beispiel #12
0
 public void AddStringControl(WpfEventManager wpfEventManager, string defaultValue, List <string> suggestions)
 {
     StringInputControl = new StringInputControlView
     {
         DefaultValue    = defaultValue,
         Sugestions      = suggestions,
         IsReadOnly      = false,
         IsMultiline     = false,
         WpfEventManager = wpfEventManager,
     };
     StringInputControl.ValueChanged += StringInputControlView_ValueChanged;
     TheControlGrid.Children.Add(StringInputControl);
 }
Beispiel #13
0
        private void InitializeCommands()
        {
            DeleteEntityReferenceCommand = new RelayCommand((data) =>
            {
                CurrentEntityReference = null;
            }, (data) =>
            {
                return(CurrentEntityReference != null);
            });

            OpenRecordCommand = new RelayCommand((data) =>
            {
                WpfEventManager.RaiseOnInputClicked(this, CurrentEntityReference.LogicalName, CurrentEntityReference.Id);
            }, (data) =>
            {
                return(CurrentEntityReference != null);
            });

            RegisterCommand(DeleteEntityReferenceCommand);
            RegisterCommand(OpenRecordCommand);
        }
Beispiel #14
0
 private void SetWpfEventManager(WpfEventManager data)
 {
     _viewModel.WpfEventManager = data;
 }
Beispiel #15
0
 private void UpdatedWpfEventManager(WpfEventManager wpfEventManager)
 {
     if (InputModel.Type == GenericFormInputModel.TypeValue.Bool)
     {
         if (_view.BooleanInputControl == null)
         {
             return;
         }
         _view.BooleanInputControl.WpfEventManager = wpfEventManager;
     }
     else if (InputModel.Type == GenericFormInputModel.TypeValue.Decimal)
     {
         if (_view.DecimalInputControl == null)
         {
             return;
         }
         _view.DecimalInputControl.WpfEventManager = wpfEventManager;
     }
     else if (InputModel.Type == GenericFormInputModel.TypeValue.Double)
     {
         if (_view.DoubleInputControl == null)
         {
             return;
         }
         _view.DoubleInputControl.WpfEventManager = wpfEventManager;
     }
     else if (InputModel.Type == GenericFormInputModel.TypeValue.Int)
     {
         if (_view.IntegerInputControl == null)
         {
             return;
         }
         _view.IntegerInputControl.WpfEventManager = wpfEventManager;
     }
     else if (InputModel.Type == GenericFormInputModel.TypeValue.Password)
     {
         if (_view.PasswordInputControl == null)
         {
             return;
         }
         _view.PasswordInputControl.WpfEventManager = wpfEventManager;
     }
     else if (InputModel.Type == GenericFormInputModel.TypeValue.String)
     {
         if (_view.StringInputControl == null)
         {
             return;
         }
         _view.StringInputControl.WpfEventManager = wpfEventManager;
     }
     else if (InputModel.Type == GenericFormInputModel.TypeValue.MultilineString)
     {
         if (_view.StringInputControl == null)
         {
             return;
         }
         _view.StringInputControl.WpfEventManager = wpfEventManager;
     }
     else if (InputModel.Type == GenericFormInputModel.TypeValue.Guid)
     {
         if (_view.StringInputControl == null)
         {
             return;
         }
         _view.StringInputControl.WpfEventManager = wpfEventManager;
     }
     else if (InputModel.Type == GenericFormInputModel.TypeValue.DateTime)
     {
         if (_view.DateTimeInputControl == null)
         {
             return;
         }
         _view.DateTimeInputControl.WpfEventManager = wpfEventManager;
     }
     else if (InputModel.Type == GenericFormInputModel.TypeValue.EntityReference)
     {
         if (_view.EntityReferenceInputControl == null)
         {
             return;
         }
         _view.EntityReferenceInputControl.WpfEventManager = wpfEventManager;
     }
     else if (InputModel.Type == GenericFormInputModel.TypeValue.OptionSet)
     {
         if (_view.OptionSetInputControl == null)
         {
             return;
         }
         _view.OptionSetInputControl.WpfEventManager = wpfEventManager;
     }
     else if (InputModel.Type == GenericFormInputModel.TypeValue.State)
     {
         if (_view.OptionSetInputControl == null)
         {
             return;
         }
         _view.OptionSetInputControl.WpfEventManager = wpfEventManager;
     }
     else
     {
         throw new NotImplementedException();
     }
 }