Ejemplo n.º 1
0
 void tgo_onInsertGadget(int size, string path)
 {
     double scale = 1;
     switch (size)
     {
         case 3: scale = 0.6; break;
         case 2: scale = 0.5; break;
         case 1: scale = 0.4; break;
     }
     TreeGadget gadget = new TreeGadget() { Source = System.IO.Path.GetFileName(path), IsMoveable = true, Scale = scale };
     gadget.RemoveMeRequest += new EventHandler(gadget_RemoveMeRequest);
     if (isMoveMode)
     {
         if (gadget.DragBehavior == null)
             gadget.DragBehavior = new MouseDragElementBehavior();
         gadget.DragBehavior.Attach(gadget);
     }
     gadgetInstances.Add(gadget);
     gridTree.Children.Add(gadget);
 }
Ejemplo n.º 2
0
        private void LoadGadgets()
        {
            foreach (var item in Settings.curSettings.gadgetInstances)
            {
                TreeGadget g = new TreeGadget() { Source = item.imgPath, Scale = item.Scale, IsMoveable = true };
                g.RemoveMeRequest += new EventHandler(gadget_RemoveMeRequest);
                TranslateTransform tt = (g.RenderTransform as TransformGroup).Children[3] as TranslateTransform;
                tt.X = item.TranslateX;
                tt.Y = item.TranslateY;
                gadgetInstances.Add(g);
            }

            foreach (var item in gadgetInstances)
            {
                gridTree.Children.Add(item);
            }
        }