Exemplo n.º 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();
        }
Exemplo n.º 2
0
 public void AddPasswordControl(WpfEventManager wpfEventManager)
 {
     PasswordInputControl = new PasswordInputControlView
     {
         WpfEventManager = wpfEventManager,
     };
     PasswordInputControl.ValueChanged += PasswordInputControlView_ValueChanged;
     TheControlGrid.Children.Add(PasswordInputControl);
 }
Exemplo n.º 3
0
 private void InitializeCommands()
 {
     EditCustomModuleCommand = new RelayCommand((input) =>
     {
         var newContent = WpfEventManager.RaiseOnCustomModuleClicked(this, CustomModuleName, Value);
         Value          = newContent;
     });
     RegisterCommand(EditCustomModuleCommand);
 }
Exemplo n.º 4
0
 public void AddDateTimeControl(WpfEventManager wpfEventManager, DateTime defaultValue)
 {
     DateTimeInputControl = new DateTimeInputControlView
     {
         DefaultValue    = defaultValue,
         WpfEventManager = wpfEventManager,
     };
     DateTimeInputControl.ValueChanged += DateTimeInputControlView_ValueChanged;
     TheControlGrid.Children.Add(DateTimeInputControl);
 }
Exemplo n.º 5
0
 public void AddDoubleControl(WpfEventManager wpfEventManager, double defaultValue)
 {
     DoubleInputControl = new DoubleInputControlView
     {
         DefaultValue    = defaultValue,
         WpfEventManager = wpfEventManager,
     };
     DoubleInputControl.ValueChanged += DoubleInputControlView_ValueChanged;
     TheControlGrid.Children.Add(DoubleInputControl);
 }
Exemplo n.º 6
0
 public void AddDecimalControl(WpfEventManager wpfEventManager, decimal defaultValue)
 {
     DecimalInputControl = new DecimalInputControlView
     {
         DefaultValue    = defaultValue,
         WpfEventManager = wpfEventManager,
     };
     DecimalInputControl.ValueChanged += DecimalInputControlView_ValueChanged;
     TheControlGrid.Children.Add(DecimalInputControl);
 }
Exemplo n.º 7
0
 public void AddIntegerControl(WpfEventManager wpfEventManager, int defaultValue)
 {
     IntegerInputControl = new IntegerInputControlView
     {
         DefaultValue    = defaultValue,
         WpfEventManager = wpfEventManager,
     };
     IntegerInputControl.ValueChanged += IntegerInputControlView_ValueChanged;
     TheControlGrid.Children.Add(IntegerInputControl);
 }
Exemplo n.º 8
0
 public void AddBooleanControl(WpfEventManager wpfEventManager, bool defaultValue)
 {
     BooleanInputControl = new BooleanInputControlView
     {
         DefaultValue    = defaultValue,
         WpfEventManager = wpfEventManager,
     };
     BooleanInputControl.ValueChanged += BooleanInputControlView_ValueChanged;
     TheControlGrid.Children.Add(BooleanInputControl);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
        }
Exemplo n.º 14
0
 private void SetWpfEventManager(WpfEventManager data)
 {
     _viewModel.WpfEventManager = data;
 }
Exemplo n.º 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();
     }
 }