void SaveSettingsDispatcher (TDatabaseAuthentication databaseAuthentication) { var filePath = System.Environment.CurrentDirectory; var fileName = TNames.SettingsIniFileName; DatabaseConnection = DatabaseConnection ?? new TDatabaseConnection (filePath, fileName); if (DatabaseConnection.Save (databaseAuthentication)) { DatabaseConnection.Request (); // update // notify edit var message = new TShellMessage (TMessageAction.Response, TypeInfo); message.Support.Argument.Types.ConnectionData.CopyFrom (databaseAuthentication); DelegateCommand.PublishModuleMessage.Execute (message); // settings validating TDispatcher.Invoke (RequestServiceValidationDispatcher); } else { TDispatcher.Invoke (CloseSnackbarDispatcher); var errorMessage = new TErrorMessage (Properties.Resource.RES_ERROR, Properties.Resource.RES_SAVE, (string) DatabaseConnection.Result.ErrorContent) { Severity = TSeverity.Hight }; TDispatcher.BeginInvoke (ShowErrorBoxDispatcher, errorMessage); } }
void DatabaseSettingsSuccessDispatcher () { // notify main process NotifyProcess (TCommandComm.Success); // update INI file var filePath = System.Environment.CurrentDirectory; var fileName = TNames.SettingsIniFileName; var data = new TDatabaseConnection (filePath, fileName); if (data.Request ()) { TDispatcher.Invoke (CloseSnackbarDispatcher); Model.SnackbarContent.SetMessage (Properties.Resource.RES_WELLCOME); TDispatcher.BeginInvoke (ShowSnackbarDispatcher, false); TDispatcher.Invoke (DatabaseValidateDispatcher); } else { var errorMessage = new TErrorMessage (Properties.Resource.RES_ERROR, Properties.Resource.RES_LOAD, (string) data.Result.ErrorContent) { Severity = TSeverity.Hight }; TDispatcher.BeginInvoke (ShowErrorBoxDispatcher, errorMessage); } }
void ResponseDataDispatcher (TEntityAction entityAction) { if (entityAction.NotNull ()) { // request if (entityAction.IdCollection.Any ()) { // to parent // Dummy - Select - Many var action = TEntityAction.Create ( TCategory.Dummy, TOperation.Select, TExtension.Many ); foreach (var item in entityAction.IdCollection) { action.IdCollection.Add (item); } action.Param2 = entityAction; // preserve var message = new TCollectionMessageInternal (TInternalMessageAction.Request, TChild.List, TypeInfo); message.Support.Argument.Types.Select (action); DelegateCommand.PublishInternalMessage.Execute (message); } else { var gadgets = new Collection<TActionComponent> (); TActionConverter.Collection (TCategory.Test, gadgets, entityAction); Model.Select (gadgets); } } TDispatcher.Invoke (RefreshAllDispatcher); }
void MaterialCollectionFullDispatcher (TEntityAction action) { // refresh model Model.MaterialRefreshModel (action); TDispatcher.Invoke (RefreshAllDispatcher); }
void ResponseDataDispatcher (TEntityAction action) { // Collection - Full (Target list) Model.Select (action); TDispatcher.Invoke (RefreshAllDispatcher); }
public void OnContentTargetSelectionChanged (object context) { // content Target if (context is GadgetTest gadget) { TDispatcher.BeginInvoke (ContentTargetChangedDispatcher, gadget); } }
void ResponseSelectByIdDispatcher (TEntityAction entityAction) { entityAction.ThrowNull (); if (entityAction.Param2 is GadgetTest gadget) { if (gadget.HasContentTarget) { var component = TActionComponent.Create (TCategory.Test); component.Models.GadgetTestModel.CopyFrom (gadget); TActionConverter.Select (TCategory.Test, component, entityAction); gadget.CopyFrom (component.Models.GadgetTestModel); Model.GadgetItemChecked (gadget, isChecked: gadget.IsChecked); // to Sibling var message = new TFactorySiblingMessageInternal (TInternalMessageAction.PropertySelect, TChild.List, TypeInfo); message.Support.Argument.Args.Select (component); message.Support.Argument.Args.Select (gadget.IsChecked ? "GadgetAdd" : "GadgetRemove"); if (Model.IsEditMode || Model.HasGadgetChecked) { message.Support.Argument.Types.ReportData.SelectLock (); } DelegateCommand.PublishInternalMessage.Execute (message); } TDispatcher.Invoke (RefreshAllDispatcher); } }
public void Handle (TMessageInternal message) { if (message.NotNull ()) { if (message.IsModule (TResource.TModule.Factory)) { // from parent if (message.Node.IsParentToMe (TChild.List)) { // DatabaseValidated if (message.IsAction (TInternalMessageAction.DatabaseValidated)) { TDispatcher.Invoke (RequestDataDispatcher); } // Response if (message.IsAction (TInternalMessageAction.Response)) { // Collection-Full if (message.Support.Argument.Types.IsOperation (TOperation.Collection, TExtension.Full)) { if (message.Result.IsValid) { // Gadget Material if (message.Support.Argument.Types.IsOperationCategory (TCategory.Material)) { var action = TEntityAction.Request (message.Support.Argument.Types.EntityAction); TDispatcher.BeginInvoke (MaterialCollectionFullDispatcher, action); } } } } } // from sibilig if (message.Node.IsSiblingToMe (TChild.List, TypeInfo)) { // PropertySelect if (message.IsAction (TInternalMessageAction.PropertySelect)) { var propertyName = message.Support.Argument.Args.PropertyName; if (propertyName.Equals ("edit", StringComparison.InvariantCulture)) { if (message.Support.Argument.Args.Param1 is TActionComponent component) { TDispatcher.BeginInvoke (EditDispatcher, component); } } if (propertyName.Equals ("GadgetAdd", StringComparison.InvariantCulture) || propertyName.Equals ("GadgetRemove", StringComparison.InvariantCulture)) { Model.PropertyChanged (message.Support.Argument.Args.PropertyName, message.Support.Argument.Types.ReportData.Locked); TDispatcher.Invoke (RefreshAllDispatcher); } } // Reload if (message.IsAction (TInternalMessageAction.Reload)) { // to parent DelegateCommand.PublishInternalMessage.Execute (message); } // Cleanup if (message.IsAction (TInternalMessageAction.Cleanup)) { Model.Cleanup (); TDispatcher.Invoke (RefreshAllDispatcher); } } } } }
void LoadDatabaseSettings (string filePath, string fileName) { DatabaseConnection = DatabaseConnection ?? new TDatabaseConnection (filePath, fileName); // database if (DatabaseConnection.Request ()) { // notify factory database // SQL var message = new TShellMessage (TMessageAction.Response, TypeInfo); message.Support.Argument.Types.ConnectionData.CopyFrom (DatabaseConnection.Request (TAuthentication.SQL)); DelegateCommand.PublishModuleMessage.Execute (message); // Windows message = new TShellMessage (TMessageAction.Response, TypeInfo); message.Support.Argument.Types.ConnectionData.CopyFrom (DatabaseConnection.Request (TAuthentication.Windows)); DelegateCommand.PublishModuleMessage.Execute (message); // settings validating TDispatcher.Invoke (RequestServiceValidationDispatcher); } else { var errorMessage = new TErrorMessage (Properties.Resource.RES_ERROR, Properties.Resource.RES_LOAD_DATABASE, (string) DatabaseConnection.Result.ErrorContent) { Severity = TSeverity.Hight }; TDispatcher.BeginInvoke (ShowErrorBoxDispatcher, errorMessage); } }
void ResponseDataDispatcher (TEntityAction action) { var gadgets = new Collection<TActionComponent> (); // Registration - Collection - Full (Registration) if (action.CategoryType.IsCategory (TCategory.Registration)) { TActionConverter.Collection (TCategory.Registration, gadgets, action); Model.SelectRegistration (gadgets); } // Result - Collection - Full (Result ) if (action.CategoryType.IsCategory (TCategory.Result)) { action.IdCollection.Clear (); // empty for sure TActionConverter.Collection (TCategory.Result, gadgets, action); Model.SelectResult (gadgets, action.IdDictionary); // update // Dummy - Select - Many if (action.IdDictionary.Any ()) { action.Operation.Select (TCategory.Dummy, TOperation.Select, TExtension.Many); var message = new TCollectionMessageInternal (TInternalMessageAction.Request, TChild.List, TypeInfo); message.Support.Argument.Types.Select (action); DelegateCommand.PublishInternalMessage.Execute (message); } } TDispatcher.Invoke (RefreshAllDispatcher); }
public void Handle (TMessageModule message) { if (message.NotNull ()) { // shell if (message.IsModule (TResource.TModule.Shell)) { // SettingsValidating if (message.IsAction (TMessageAction.SettingsValidating)) { TDispatcher.Invoke (SettingsValidatingDispatcher); } // Request if (message.IsAction (TMessageAction.Request)) { TDispatcher.BeginInvoke (RequestDispatcher, TServiceRequest.Create (message)); } } // collection if (message.IsModule (TResource.TModule.Collection)) { // Request if (message.IsAction (TMessageAction.Request)) { TDispatcher.BeginInvoke (RequestDispatcher, TServiceRequest.Create (message)); } } // factory if (message.IsModule (TResource.TModule.Factory)) { // Request if (message.IsAction (TMessageAction.Request)) { TDispatcher.BeginInvoke (RequestDispatcher, TServiceRequest.Create (message)); } } } }
public void Handle (TMessageInternal message) { if (message.NotNull ()) { if (message.IsModule (TResource.TModule.Factory)) { // from Sibling if (message.Node.IsSiblingToMe (TChild.Design, TypeInfo)) { // PropertySelect if (message.IsAction (TInternalMessageAction.PropertySelect)) { if (message.Support.Argument.Args.Param1 is TActionComponent component) { var propertyName = message.Support.Argument.Args.PropertyName; Model.SelectModel (component); } TDispatcher.Invoke (RefreshDesignDispatcher); } // Request if (message.IsAction (TInternalMessageAction.Request)) { TDispatcher.BeginInvoke (RequestDesignDispatcher, TEntityAction.Request (message.Support.Argument.Types.EntityAction)); } // Cleanup if (message.IsAction (TInternalMessageAction.Cleanup)) { TDispatcher.Invoke (RefreshDesignDispatcher); } } } } }
public override void ProcessMessage (TMessageModule message) { if (message.NotNull ()) { // services if (message.IsModule (TResource.TModule.Services)) { // SettingsValidated if (message.IsAction (TMessageAction.SettingsValidated)) { SelectAuthentication (message.Support.Argument.Types.Authentication); // sucess if (message.Support.IsActionStatus (TActionStatus.Success)) { TDispatcher.Invoke (DatabaseSettingsSuccessDispatcher); } // error if (message.Support.IsActionStatus (TActionStatus.Error)) { TDispatcher.Invoke (DatabaseSettingsErrorDispatcher); } } } // focus if (message.IsAction (TMessageAction.Focus)) { if (message.Support.Argument.Args.IsWhere (TWhere.Collection)) { OnCollectionCommadClicked (); } if (message.Support.Argument.Args.IsWhere (TWhere.Factory)) { OnFactoryCommadClicked (); } } } }
void ModifyDispatcher (TActionComponent component) { if (component.NotNull ()) { Model.ModifyEnter (component); } TDispatcher.Invoke (RefreshAllDispatcher); }
void ResponseModelDispatcher (TEntityAction action) { if (action.SupportAction.Rule.IsCommit ("gadget")) { action.SupportAction.Rule.Remove ("gadget"); TDispatcher.BeginInvoke (ApplyDispatcher, action); } }
public void OnApplyCommadClicked () { if (Model.Validate ()) { TDispatcher.Invoke (ApplyDispatcher); } ApplyChanges (); }
public void Handle (TMessageInternal message) { if (message.NotNull ()) { if (message.IsModule (TResource.TModule.Collection)) { // from parent if (message.Node.IsParentToMe (TChild.List)) { // DatabaseValidated if (message.IsAction (TInternalMessageAction.DatabaseValidated)) { TDispatcher.Invoke (RequestDataDispatcher); } // Response if (message.IsAction (TInternalMessageAction.Response)) { // Collection-Full if (message.Support.Argument.Types.IsOperation (Server.Models.Infrastructure.TOperation.Collection, Server.Models.Infrastructure.TExtension.Full)) { if (message.Result.IsValid) { // Gadget Target if (message.Support.Argument.Types.IsOperationCategory (Server.Models.Infrastructure.TCategory.Target)) { var action = TEntityAction.Request (message.Support.Argument.Types.EntityAction); TDispatcher.BeginInvoke (ResponseDataDispatcher, action); } // Gadget Material if (message.Support.Argument.Types.IsOperationCategory (Server.Models.Infrastructure.TCategory.Material)) { var action = TEntityAction.Request (message.Support.Argument.Types.EntityAction); TDispatcher.BeginInvoke (RefreshModelDispatcher, action); } } } // Select-ById if (message.Support.Argument.Types.IsOperation (Server.Models.Infrastructure.TOperation.Select, Server.Models.Infrastructure.TExtension.ById)) { if (message.Result.IsValid) { var action = TEntityAction.Request (message.Support.Argument.Types.EntityAction); TDispatcher.BeginInvoke (ResponseModelDispatcher, action); } } } // Reload if (message.IsAction (TInternalMessageAction.Reload)) { TDispatcher.Invoke (RefreshAllDispatcher); TDispatcher.Invoke (RequestDataDispatcher); } } // from sibilig if (message.Node.IsSiblingToMe (TChild.List, TypeInfo)) { // Reload if (message.IsAction (TInternalMessageAction.Reload)) { TDispatcher.Invoke (RefreshAllDispatcher); TDispatcher.Invoke (RequestDataDispatcher); TDispatcher.Invoke (ReloadDispatcher); } } } } }
void PropertySelectDispatcher (TEntityAction action) { if (action.Param1 is string propertyName) { if (propertyName.Equals ("DescriptionProperty", StringComparison.InvariantCulture) || propertyName.Equals ("TextProperty", StringComparison.InvariantCulture) || propertyName.Equals ("ExternalLinkProperty", StringComparison.InvariantCulture)) { Model.SelectModel (action); TDispatcher.Invoke (RefreshDesignDispatcher); } } }
void CleanupDispatcher () { m_CanLock = false; Model.Cleanup (); TDispatcher.Invoke (RefreshAllDispatcher); // to Sibling var message = new TFactorySiblingMessageInternal (TInternalMessageAction.Back, TChild.List, TypeInfo); DelegateCommand.PublishInternalMessage.Execute (message); }
void IniFileManagerDispatcher () { Model.CleanupProcess (); var filePath = System.Environment.CurrentDirectory; var fileName = TNames.SettingsIniFileName; var iniFileManager = TIniFileManager.CreatDefault; iniFileManager.SelectPath (filePath, fileName); if (iniFileManager.ValidatePath ().IsValid) { // Process Module section if (iniFileManager.ContainsSection (TProcess.PROCESSMODULESSECTION)) { // Process Names section if (iniFileManager.ContainsSection (TProcess.PROCESSNAMESSECTION)) { // [ProcessNamesSection] // ProcessNames=ModuleSettings? GadgetMaterial?GadgetTarget? GadgetTest?GadgetRegistration? GadgetTests?GadgetReport var processNames = iniFileManager.RequestKey (TProcess.PROCESSNAMESSECTION, TProcess.PROCESSNAMES); var allProcessNames = processNames.Split ('?'); for (int i = 0; i < allProcessNames.Length; i++) { var processNameSection = allProcessNames [i]; if (iniFileManager.ContainsSection (processNameSection)) { /* [ModuleSettings] ProcessIsAlive=True PaletteTheme=light PalettePrimary=blue PaletteAccent=lime */ var isAlive = iniFileManager.RequestKey (processNameSection, TProcess.PROCESSISALIVE); var baseTheme = iniFileManager.RequestKey (processNameSection, TProcess.PALETTETHEME); var primaryColor = iniFileManager.RequestKey (processNameSection, TProcess.PALETTEPRIMARY); var accentColor = iniFileManager.RequestKey (processNameSection, TProcess.PALETTEACCENT); var paletteInfo = TPaletteInfo.Create (baseTheme, primaryColor, accentColor); Model.AddProcessInfo (processNameSection, bool.Parse (isAlive), paletteInfo); } } if (Model.SelectProcess ()) { TDispatcher.BeginInvoke (ProcessSelectedDispatcher, Model.CurrentProcess); } } } } TDispatcher.Invoke (RefreshDispatcher); }
public void Handle (TMessageModule message) { if (message.NotNull ()) { // shell if (message.IsModule (TResource.TModule.Shell)) { if (message.IsAction (TMessageAction.DatabaseValidated)) { TDispatcher.Invoke (IniFileManagerDispatcher); } } } }
void Cleanup () { Model.Cleanup (); ApplyChanges (); CleanupPropertyControl (); ResetViewMode (); TDispatcher.Invoke (RefreshAllDispatcher); }
void RefreshModelDispatcher (TEntityAction action) { // refresh model Model.RefreshModel (action); TDispatcher.Invoke (RefreshAllDispatcher); // to parent (RefreshModel) var message = new TCollectionMessageInternal (TInternalMessageAction.RefreshModel, TChild.List, TypeInfo); message.Support.Argument.Types.Select (action); DelegateCommand.PublishInternalMessage.Execute (message); }
public void Handle (TNavigateRequestMessage message) { if (message.NotNull ()) { if (message.IsActionRequest) { if (message.Sender.Equals (TNavigateMessage.TSender.Shell)) { m_NavigateRequestMessage = message; TDispatcher.Invoke (NavigateRequestDispatcher); } } } }
void ResponseDataDispatcher (TEntityAction action) { // operation: [Collection-Full], Gadget: Material Model.Select (action); // to parent (RefreshModel) var message = new TCollectionMessageInternal (TInternalMessageAction.RefreshModel, TChild.List, TypeInfo); message.Support.Argument.Types.Select (action); DelegateCommand.PublishInternalMessage.Execute (message); TDispatcher.Invoke (RefreshAllDispatcher); }
public void Handle (TMessageInternal message) { if (message.NotNull ()) { if (message.IsModule (TResource.TModule.Factory)) { // from Sibling if (message.Node.IsSiblingToMe (TChild.Design, TypeInfo)) { // PropertySelect if (message.IsAction (TInternalMessageAction.PropertySelect)) { var propertyName = message.Support.Argument.Args.PropertyName; if (propertyName.Equals ("GadgetAdd", StringComparison.InvariantCulture)) { if (message.Support.Argument.Args.Param1 is TActionComponent component) { Model.AddModel (component); } TDispatcher.Invoke (RefreshDesignDispatcher); } if (propertyName.Equals ("GadgetRemove", StringComparison.InvariantCulture)) { if (message.Support.Argument.Args.Param1 is TActionComponent component) { Model.RemoveModel (component); } TDispatcher.Invoke (RefreshDesignDispatcher); } if (propertyName.Equals ("edit", StringComparison.InvariantCulture)) { if (message.Support.Argument.Args.Param1 is TActionComponent component) { Model.Edit (component); } TDispatcher.Invoke (RefreshDesignDispatcher); } var action = TEntityAction.Request (message.Support.Argument.Types.EntityAction); if (action.NotNull ()) { action.Param1 = propertyName; TDispatcher.BeginInvoke (PropertySelectDispatcher, action); } } // Cleanup if (message.IsAction (TInternalMessageAction.Cleanup)) { Model.Cleanup (); TDispatcher.Invoke (RefreshDesignDispatcher); } } } } }
protected override void Initialize () { base.Initialize (); // must be called to apply theme OnFactoryDatabaseCommadClicked (); // show current database settings Model.Lock (); Model.ShowPanels (); Model.SnackbarContent.SetMessage (Properties.Resource.RES_VALIDATING); ApplyChanges (); TDispatcher.Invoke (OpenSnackbarDispatcher); TDispatcher.Invoke (LoadSettingsDispatcher); }
void LoadSupportSettings (string filePath, string fileName) { SupportSettings = SupportSettings ?? TSupportSettings.Create (filePath, fileName); // supprt if (SupportSettings.Validate ().IsFalse ()) { var errorMessage = new TErrorMessage (Properties.Resource.RES_ERROR, Properties.Resource.RES_LOAD_SUPPORT, (string) SupportSettings.Result.ErrorContent) { Severity = TSeverity.Hight }; TDispatcher.BeginInvoke (ShowErrorBoxDispatcher, errorMessage); } }
public void OnDatabaseApplyCommadClicked () { Model.Apply (); ApplyChanges (); // to sibiling front var message = new TFactoryMessageInternal (TInternalMessageAction.Change, TAuthentication.Windows, TypeInfo); message.Node.SelectRelationSibling (TChild.Back); message.Support.Argument.Types.ConnectionData.CopyFrom (Model.DatabaseConnectionData); DelegateCommand.PublishInternalMessage.Execute (message); TDispatcher.Invoke (NotifyChageDispatcher); }
public void Handle (TMessageInternal message) { if (message.NotNull ()) { if (message.IsModule (TResource.TModule.Factory)) { // from parent if (message.Node.IsParentToMe (TChild.Property)) { // RefreshModel if (message.IsAction (TInternalMessageAction.RefreshModel)) { TDispatcher.BeginInvoke (RefreshModelDispatcher, TEntityAction.Request (message.Support.Argument.Types.EntityAction)); } // Edit if (message.IsAction (TInternalMessageAction.Edit)) { if (message.Support.Argument.Args.Param1 is TActionComponent component) { TDispatcher.BeginInvoke (EditDispatcher, component); } } // EditLeave if (message.IsAction (TInternalMessageAction.EditLeave)) { if (IsViewModeEdit) { OnCancelCommadClicked (); } } // Response if (message.IsAction (TInternalMessageAction.Response)) { // Insert if (message.Support.Argument.Types.IsOperation (TOperation.Insert)) { TDispatcher.Invoke (InsertSuccessDispatcher); } // Change - Full if (message.Support.Argument.Types.IsOperation (TOperation.Change, TExtension.Full)) { TDispatcher.Invoke (ChangeSuccessDispatcher); } } } // from Sibling if (message.Node.IsSiblingToMe (TChild.Property, TypeInfo)) { // Response if (message.IsAction (TInternalMessageAction.Response)) { TDispatcher.BeginInvoke (ResponseModelDispatcher, TEntityAction.Request (message.Support.Argument.Types.EntityAction)); } } } } }