Esempio n. 1
0
    void RequestDataDispatcher ()
    {
      // to parent
      // Result - Collection - Full (Result)
      var action = TEntityAction.Create (
        TCategory.Result,
        TOperation.Collection,
        TExtension.Full
      );

      var message = new TCollectionMessageInternal (TInternalMessageAction.Request, TChild.List, TypeInfo);
      message.Support.Argument.Types.Select (action);

      DelegateCommand.PublishInternalMessage.Execute (message);

      // to parent
      // Registration - Collection - Full (Registration)
      action = TEntityAction.Create (
        TCategory.Registration,
        TOperation.Collection,
        TExtension.Full
      );

      message = new TCollectionMessageInternal (TInternalMessageAction.Request, TChild.List, TypeInfo);
      message.Support.Argument.Types.Select (action);

      DelegateCommand.PublishInternalMessage.Execute (message);
    }
Esempio n. 2
0
    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);
    }
Esempio n. 3
0
    void SelectionChangedDispatcher (GadgetTest gadget)
    {
      if (Model.SelectionChanged (gadget)) {
        // to parent
        // Select - ById
        var entityAction = TEntityAction.Create (
          TCategory.Test,
          TOperation.Select,
          TExtension.ById
        );

        entityAction.Id = Model.Current.Id;

        var message = new TCollectionMessageInternal (TInternalMessageAction.Request, TChild.List, TypeInfo);
        message.Support.Argument.Types.Select (entityAction);

        DelegateCommand.PublishInternalMessage.Execute (message);
      }

      else {
        // to Sibling
        var message = new TCollectionSiblingMessageInternal (TInternalMessageAction.Cleanup, TChild.List, TypeInfo);
        DelegateCommand.PublishInternalMessage.Execute (message);
      }
    }
Esempio n. 4
0
    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);
    }
Esempio n. 5
0
    public void Handle (TMessageModule message)
    {
      if (message.NotNull ()) {
        // shell
        if (message.IsModule (TResource.TModule.Shell)) {
          // DatabaseValidated
          if (message.IsAction (TMessageAction.DatabaseValidated)) {
            // to child list
            var messageInternal = new TCollectionMessageInternal (TInternalMessageAction.DatabaseValidated, TypeInfo);
            messageInternal.Node.SelectRelationParent (TChild.List);

            DelegateCommand.PublishInternalMessage.Execute (messageInternal);
          }

          // RefreshProcess
          if (message.IsAction (TMessageAction.RefreshProcess)) {
            // to child list (Reload)
            var messageInternal = new TCollectionMessageInternal (TInternalMessageAction.Reload, TypeInfo);
            messageInternal.Node.SelectRelationParent (TChild.List);

            DelegateCommand.PublishInternalMessage.Execute (messageInternal);
          }
        }

        // services
        if (message.IsModule (TResource.TModule.Services)) {
          // Response
          if (message.IsAction (TMessageAction.Response)) {
            if (message.Node.IsModuleName (TModuleName.Collection)) {
              // to child
              var messageInternal = new TCollectionMessageInternal (message.Result, TInternalMessageAction.Response, TypeInfo);
              messageInternal.Node.SelectRelationParent (message.Node.Child);
              messageInternal.Support.Argument.Types.CopyFrom (message.Support.Argument.Types);

              DelegateCommand.PublishInternalMessage.Execute (messageInternal);
            }
          }
        }

        // factory
        if (message.IsModule (TResource.TModule.Factory)) {
          // Reload
          if (message.IsAction (TMessageAction.Reload)) {
            // to child list
            var messageInternal = new TCollectionMessageInternal (TInternalMessageAction.Reload, TypeInfo);
            messageInternal.Node.SelectRelationParent (TChild.List);

            DelegateCommand.PublishInternalMessage.Execute (messageInternal);

            // to module (Update)
            var messageModule = new TCollectionMessage (TMessageAction.Update, TypeInfo);
            messageModule.Node.SelectRelationModule (TChild.None);

            DelegateCommand.PublishMessage.Execute (messageModule);
          }
        }
      }
    }
    void RemoveDispatcher ()
    {
      var entityAction = TEntityAction.Create (TCategory.Test, TOperation.Remove);
      entityAction.Id = Model.GadgetModel.Id;

      // to parent
      var message = new TCollectionMessageInternal (TInternalMessageAction.Request, TChild.Display, TypeInfo);
      message.Support.Argument.Types.Select (entityAction);

      DelegateCommand.PublishInternalMessage.Execute (message);
    }
    void EditDispatcher ()
    {
      var component = TActionComponent.Create (TCategory.Test);
      Model.Request (component);

      // to parent
      var message = new TCollectionMessageInternal (TInternalMessageAction.Edit, TChild.Display, TypeInfo);
      message.Support.Argument.Args.Select (component);

      DelegateCommand.PublishInternalMessage.Execute (message);
    }
    void RemoveDispatcher ()
    {
      // Remove
      var action = TEntityAction.Create (Server.Models.Infrastructure.TCategory.Target, Server.Models.Infrastructure.TOperation.Remove);
      action.Id = Model.Id;

      // to parent
      var message = new TCollectionMessageInternal (TInternalMessageAction.Request, TChild.Display, TypeInfo);
      message.Support.Argument.Types.Select (action);

      DelegateCommand.PublishInternalMessage.Execute (message);
    }
Esempio n. 9
0
    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);
    }
Esempio n. 10
0
    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);
    }
Esempio n. 11
0
    void RemoveDispatcher ()
    {
      var component = TActionComponent.Create (TCategory.Material);
      Model.Request (component);

      var action = TEntityAction.Create (TCategory.Material, TOperation.Remove);
      action.Param2 = component;

      // to parent
      var message = new TCollectionMessageInternal (TInternalMessageAction.Request, TChild.Display, TypeInfo);
      message.Support.Argument.Types.Select (action);

      DelegateCommand.PublishInternalMessage.Execute (message);
    }
Esempio n. 12
0
    void RequestDataDispatcher ()
    {
      // to parent
      // Collection - Full (Target)
      var action = TEntityAction.Create (
        Server.Models.Infrastructure.TCategory.Target,
        Server.Models.Infrastructure.TOperation.Collection,
        Server.Models.Infrastructure.TExtension.Full
      );

      var message = new TCollectionMessageInternal (TInternalMessageAction.Request, TChild.List, TypeInfo);
      message.Support.Argument.Types.Select (action);

      DelegateCommand.PublishInternalMessage.Execute (message);
    }
Esempio n. 13
0
    void ResponseDataDispatcher (TEntityAction action)
    {
      // Collection - Full (Target list)
      Model.Select (action);

      TDispatcher.Invoke (RefreshAllDispatcher);

      // to parent
      // Collection - Full (Material list - used to send RefreshModel)
      var entityAction = TEntityAction.Create (
        Server.Models.Infrastructure.TCategory.Material,
        Server.Models.Infrastructure.TOperation.Collection,
        Server.Models.Infrastructure.TExtension.Full
      );

      var message = new TCollectionMessageInternal (TInternalMessageAction.Request, TChild.List, TypeInfo);
      message.Support.Argument.Types.Select (entityAction);

      DelegateCommand.PublishInternalMessage.Execute (message);
    }
Esempio n. 14
0
 void ReloadDispatcher ()
 {
   // to parent
   var message = new TCollectionMessageInternal (TInternalMessageAction.Reload, TChild.List, TypeInfo);
   DelegateCommand.PublishInternalMessage.Execute (message);
 }