Example #1
0
    static void Request (TContentClient rootClient, GadgetTest rootGadget)
    {
      if (rootClient.NotNull () && rootGadget.NotNull ()) {
        rootClient.RequestData (rootGadget);

        if (rootClient.ClientList.Any ()) {
          foreach (var client in rootClient.ClientList) {
            var category = TCategoryType.FromValue (client.Category);

            // Target
            if (category.Equals (TCategory.Target)) {
              var gadgetTarget = GadgetTarget.CreateDefault;
              client.RequestData (gadgetTarget);

              rootGadget.AddContent (gadgetTarget);
            }

            // Test
            if (category.Equals (TCategory.Test)) {
              var gadgetTest = GadgetTest.CreateDefault;
              Request (client, gadgetTest);

              rootGadget.AddContent (gadgetTest);
            }
          }
        }
      }
    } 
Example #2
0
 TComponentControlModel (GadgetTest gadget)
   : this ()
 {
   if (gadget.NotNull ()) {
     ControlModel.CopyFrom (gadget);
   }
 }
Example #3
0
    public void SelectModel (GadgetTest gadget)
    {
      if (gadget.NotNull ()) {
        ControlModel.GadgetName = gadget.GadgetName;
        ControlModel.Description = gadget.Description;
        ControlModel.ExternalLink = gadget.ExternalLink;

        if (gadget.ValidateId) {
          if (ControlModel.Contains (gadget.Id).IsFalse ()) {
            ComponentControlModels.Clear ();

            ControlModel.CopyFrom (gadget);

            if (ControlModel.HasContentTest) {
              var contents = new Collection<GadgetTest> ();
              ControlModel.RequestContent (contents);

              foreach (var gadgetTest in contents) {
                var controlModel = TComponentControlModel.CreateDefault;
                controlModel.ControlModel.CopyFrom (gadgetTest.Clone ());

                ComponentControlModels.Add (controlModel);
              }
            }
          }
        }
      }
    }
Example #4
0
        internal void GadgetItemChecked(GadgetTest gadget, bool isChecked)
        {
            if (gadget.NotNull())
            {
                gadget.IsChecked = isChecked; // for sure

                var gadgetChecked = IsChecked(gadget);

                if (isChecked)
                {
                    if (gadgetChecked.ValidateId.IsFalse())
                    {
                        AddChecked(gadget);
                    }
                }

                else
                {
                    if (gadgetChecked.ValidateId)
                    {
                        RemoveChecked(gadget.Id);
                    }
                }
            }
        }
Example #5
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);
      }
    }
Example #6
0
    public TContentClient (GadgetTest gadget)
      : this ()
    {
      if (gadget.NotNull ()) {
        Id = gadget.Id;
        Category = TCategoryType.ToValue (TCategory.Test);
        Name = gadget.GadgetName;
        Info = gadget.GadgetInfo;

        if (gadget.HasContent) {
          // Target
          if (gadget.HasContentTarget) {
            var contents = new Collection<GadgetTarget> ();
            gadget.RequestContent (contents);

            foreach (var item in contents) {
              ClientList.Add (new TContentClient (item));
            }
          }

          // Test
          if (gadget.HasContentTest) {
            var contents = new Collection<GadgetTest> ();
            gadget.RequestContent (contents);

            foreach (var item in contents) {
              ClientList.Add (new TContentClient (item));
            }
          }
        }
      }
    }
Example #7
0
        internal bool SelectionChanged(GadgetTest gadget)
        {
            if (gadget.IsNull())
            {
                return(false);
            }

            Current.CopyFrom(gadget);

            return(Current.ValidateId);
        }
Example #8
0
        bool RemoveCheck(GadgetTest gadget)
        {
            foreach (var item in m_TestCheckedItems)
            {
                if (item.Contains(gadget.Id))
                {
                    m_TestCheckedItems.Remove(item);
                    return(true);
                }
            }

            return(false);
        }
Example #9
0
        bool AddCheck(GadgetTest gadget)
        {
            foreach (var item in m_TestCheckedItems)
            {
                if (item.Contains(gadget.Id))
                {
                    return(false);
                }
            }

            m_TestCheckedItems.Add(gadget);

            return(true);
        }
Example #10
0
        internal void ContentTestTargetChanged(GadgetTest gadget)
        {
            // content Test Target

            // save result
            foreach (var item in ContentTestItemsSource)
            {
                if (item.UpdateValue(ContentTestTargetCurrent))
                {
                    break;
                }
            }

            ContentTestTargetCurrent.CopyFrom(gadget);
        }
Example #11
0
        bool AddGadget(GadgetTest gadget)
        {
            var res = false;

            if (gadget.NotNull())
            {
                if (ContainsGadget(gadget.Id).IsFalse())
                {
                    GadgetItemsSource.Add(gadget);
                    res = true;
                }
            }

            return(res);
        }
Example #12
0
        GadgetTest IsChecked(GadgetTest gadget)
        {
            if (gadget.NotNull())
            {
                foreach (var gadgetChecked in GadgetCheckedCollection)
                {
                    if (gadgetChecked.Contains(gadget.Id))
                    {
                        return(gadgetChecked);
                    }
                }
            }

            return(GadgetTest.CreateDefault);
        }
Example #13
0
    void ItemCheckedChangedDispatcher (GadgetTest gadget)
    {
      // to parent
      // Select = ById (Test) 
      var action = TEntityAction.Create (
        TCategory.Test,
        TOperation.Select,
        TExtension.ById
      );

      action.Id = gadget.Id;
      action.Param2 = gadget; // preserve

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

      DelegateCommand.PublishInternalMessage.Execute (message);
    }
Example #14
0
        void AddChecked(GadgetTest gadget)
        {
            if (gadget.NotNull())
            {
                if (ContainsChecked(gadget.Id).IsFalse())
                {
                    GadgetCheckedCollection.Add(gadget);
                }

                else
                {
                    IsChecked(gadget).IsChecked = true;
                }

                var itemSource = ItemSourceById(gadget.Id);

                if (itemSource.ValidateId)
                {
                    itemSource.IsChecked = true; // for sure
                }
            }
        }
Example #15
0
 public void OnGadgetItemUnchecked (GadgetTest gadget)
 {
   TDispatcher.BeginInvoke (ItemCheckedChangedDispatcher, gadget);
 }
Example #16
0
 public static TComponentControlModel Create (GadgetTest gadget) => new TComponentControlModel (gadget);
 void ContentTargetChangedDispatcher (GadgetTest gadget)
 {
   Model.ContentTargetChanged (gadget);
   ApplyChanges ();
 }
Example #18
0
 internal void ContentTargetChanged(GadgetTest gadget)
 {
     // content target
 }
Example #19
0
 public void OnSelectionChanged (GadgetTest gadget)
 {
   TDispatcher.BeginInvoke (SelectionChangedDispatcher, gadget);
 }