Пример #1
0
    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);
      }
    }
Пример #2
0
        internal void Request(TActionComponent component)
        {
            component.ThrowNull();

            var entityAction = TEntityAction.Create(TCategory.Registration);

            ComponentModelProperty.RequestModel(entityAction);

            TActionConverter.Select(TCategory.Registration, component, entityAction);
        }
Пример #3
0
    void ResponseSelectByIdDispatcher (TEntityAction entityAction)
    {
      var component = TActionComponent.Create (TCategory.Test);
      TActionConverter.Select (TCategory.Test, component, entityAction);

      // to Sibling
      var message = new TCollectionSiblingMessageInternal (TInternalMessageAction.Select, TChild.List, TypeInfo);
      message.Support.Argument.Args.Select (component);

      DelegateCommand.PublishInternalMessage.Execute (message);
    }
Пример #4
0
        internal void SelectModel(TEntityAction entityAction)
        {
            entityAction.ThrowNull();

            if (entityAction.CategoryType.IsCategory(TCategory.Test))
            {
                var component = TActionComponent.Create(TCategory.Test);
                TActionConverter.Select(TCategory.Test, component, entityAction);

                ComponentControlModel.SelectModel(component);
            }
        }
Пример #5
0
    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 action = TEntityAction.Request (message.Support.Argument.Types.EntityAction);
              var propertyName = message.Support.Argument.Args.PropertyName;

              if (propertyName.Equals ("edit", StringComparison.InvariantCulture)) {
                if (message.Support.Argument.Args.Param1 is TActionComponent component) {
                  Model.SelectModel (component, propertyName);
                }
              }

              else {
                var component = TActionComponent.Create (TCategory.Target);
                TActionConverter.Select (TCategory.Target, component, action);

                Model.SelectModel (component, propertyName);
              }

              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)) {
              Model.Cleanup ();
              TDispatcher.Invoke (RefreshDesignDispatcher);
            }
          }
        }
      }
    }
Пример #6
0
    void ResponseSelectManyDispatcher (TEntityAction action)
    {
      if (action.NotNull ()) {
        foreach (var itemIdResult in action.CollectionAction.EntityDictionary) {
          var gadgetCollection = new Dictionary<Guid, Collection<TActionComponent>> ();

          foreach (var entityCollection in itemIdResult.Value) {
            var id = entityCollection.Key;
            var entityAction = entityCollection.Value;
            var gadgetComponent = new Collection<TActionComponent> ();

            // Registration
            if (entityAction.CategoryType.IsCategory (TCategory.Registration)) {
              var gadgets = TActionComponent.Create (TCategory.Registration);
              TActionConverter.Select (TCategory.Registration, gadgets, entityAction);

              gadgetComponent.Add (gadgets);
            }

            // Test
            if (entityAction.CategoryType.IsCategory (TCategory.Test)) {
              var gadgets = TActionComponent.Create (TCategory.Test);
              TActionConverter.Select (TCategory.Test, gadgets, entityAction);

              gadgetComponent.Add (gadgets);
            }

            gadgetCollection.Add (id, gadgetComponent);
          }

          Model.SelectMany (itemIdResult.Key, gadgetCollection);
        }

        TDispatcher.Invoke (RefreshAllDispatcher);
      }
    }