Ejemplo n.º 1
0
        internal void Select(TEntityAction entityAction)
        {
            // DATA IN:
            // action.CollectionAction.ModelCollection

            entityAction.ThrowNull();

            //Registrations.Clear ();
            ItemsSource.Clear();

            var gadgets = new Collection <TActionComponent> ();

            TActionConverter.Collection(TCategory.Registration, gadgets, entityAction);

            foreach (var model in gadgets)
            {
                ItemsSource.Add(model.Models.GadgetRegistrationModel);
            }

            //foreach (var gadget in action.CollectionAction.GadgetRegistrationCollection) {
            //  if (action.CollectionAction.ModelCollection.ContainsKey (gadget.Id)) {
            //    var modelAction = action.CollectionAction.ModelCollection [gadget.Id];
            //    modelAction.GadgetRegistrationModel.CopyFrom (gadget);

            //    action.ModelAction.CopyFrom (modelAction);

            //    var item = TComponentModelItem.Create (action);

            //    Registrations.Add (item);
            //    RegistrationItemsSource.Add (item);
            //  }
            //}

            SelectedIndex = ItemsSource.Any() ? 0 : -1;
        }
Ejemplo 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);
    }
Ejemplo n.º 3
0
        internal void RefreshModel(TEntityAction entityAction)
        {
            if (entityAction.NotNull())
            {
                var gadgets = new Collection <TActionComponent> ();
                TActionConverter.Collection(TCategory.Material, gadgets, entityAction);

                if (gadgets.Any())
                {
                    foreach (var component in gadgets)
                    {
                        var selection = TSelectionInfo.Create(component.Models.GadgetMaterialModel.GadgetName, component.Models.GadgetMaterialModel.Id, component.Models.GadgetMaterialModel.Enabled);
                        selection.SetImage(component.Models.GadgetMaterialModel.GetImage());

                        entityAction.SupportAction.SelectionCollection.Add(selection);
                    }

                    ComponentModelProperty.ValidateModel(true);
                    ComponentModelProperty.ExtensionModel.SelectModel(TCategory.Target, entityAction); // update Selection Property (Material list)

                    AlertsModel.Select(isOpen: false);                                                 // default
                }

                else
                {
                    ComponentModelProperty.ValidateModel(false);

                    // show alerts
                    AlertsModel.Select(TAlertsModel.TKind.Warning);
                    AlertsModel.Select(Properties.Resource.RES_EMPTY, Properties.Resource.RES_LIST_EMPTY);
                    AlertsModel.Select(isOpen: true);
                }
            }
        }
Ejemplo 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);
    }
Ejemplo n.º 5
0
        internal void Select(TEntityAction entityAction)
        {
            entityAction.ThrowNull();

            Targets.Clear();

            var gadgets = new Collection <TActionComponent> ();

            TActionConverter.Collection(TCategory.Target, gadgets, entityAction);

            foreach (var component in gadgets)
            {
                Targets.Add(component.Models.GadgetTargetModel);
            }
        }
Ejemplo n.º 6
0
    void ResponseSelectManyDispatcher (TEntityAction entityAction)
    {
      if (entityAction.NotNull ()) {
        if (entityAction.Param2 is TEntityAction action) {
          foreach (var item in entityAction.CollectionAction.EntityCollection) {
            action.CollectionAction.EntityCollection.Add (item.Key, item.Value);
          }

          var gadgets = new Collection<TActionComponent> ();
          TActionConverter.Collection (TCategory.Test, gadgets, action);

          Model.Select (gadgets);
        }
      }

      TDispatcher.Invoke (RefreshAllDispatcher);
    }
Ejemplo n.º 7
0
        internal void Select(TEntityAction entityAction)
        {
            // DATA IN:
            // action.CollectionAction.ModelCollection

            entityAction.ThrowNull();

            Reports.Clear();

            var gadgets = new Collection <TActionComponent> ();

            TActionConverter.Collection(TCategory.Report, gadgets, entityAction);

            foreach (var model in gadgets)
            {
                Reports.Add(model.Models.GadgetReportModel);
            }
        }
Ejemplo n.º 8
0
        internal void Select(TEntityAction entityAction)
        {
            entityAction.ThrowNull();

            ItemsSource.Clear();

            var gadgets = new Collection <TActionComponent> ();

            TActionConverter.Collection(TCategory.Material, gadgets, entityAction);

            foreach (var model in gadgets)
            {
                ItemsSource.Add(model.Models.GadgetMaterialModel);
            }

            if (ItemsSource.Any())
            {
                SelectedIndex = 0;
            }
        }
Ejemplo n.º 9
0
        internal void MaterialRefreshModel(TEntityAction entityAction)
        {
            entityAction.ThrowNull();

            // for gadget Material
            var gadgets = new Collection <TActionComponent> ();

            TActionConverter.Collection(TCategory.Material, gadgets, entityAction);

            MaterialSelectionItemsSource.Clear();

            foreach (var gadget in gadgets)
            {
                MaterialSelectionItemsSource.Add(gadget.Models.GadgetMaterialModel);
            }

            if (MaterialSelectionItemsSource.Any())
            {
                MaterialSelectionSelectedIndex = 0;
            }
        }
Ejemplo n.º 10
0
        internal void RefreshModel(TEntityAction entityAction)
        {
            entityAction.ThrowNull();

            MaterialItemsSource.Clear();
            MaterialSelectionSelectedIndex = -1;

            // for gadget Material
            var gadgets = new Collection <TActionComponent> ();

            TActionConverter.Collection(TCategory.Material, gadgets, entityAction);

            foreach (var component in gadgets)
            {
                var gadgetMaterial = component.Models.GadgetMaterialModel;

                if (gadgetMaterial.Enabled)
                {
                    MaterialItemsSource.Add(gadgetMaterial);

                    foreach (var gadgetTarget in Targets)
                    {
                        // Node reverse here
                        if (gadgetTarget.MaterialId.Equals(gadgetMaterial.Id))
                        {
                            gadgetTarget.Material = gadgetMaterial.GadgetName;
                        }
                    }
                }
            }

            if (MaterialItemsSource.Any())
            {
                MaterialSelected.CopyFrom(MaterialItemsSource [0]);
                MaterialSelectionSelectedIndex = 0;
            }
        }