Beispiel #1
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);
              }
            }
          }
        }
      }
    }
Beispiel #2
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);
            }
          }
        }
      }
    } 
Beispiel #3
0
 TComponentControlModel (GadgetTest gadget)
   : this ()
 {
   if (gadget.NotNull ()) {
     ControlModel.CopyFrom (gadget);
   }
 }
Beispiel #4
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));
            }
          }
        }
      }
    }
Beispiel #5
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);
                    }
                }
            }
        }
Beispiel #6
0
        bool AddGadget(GadgetTest gadget)
        {
            var res = false;

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

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

            return(GadgetTest.CreateDefault);
        }
Beispiel #8
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
                }
            }
        }