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