private void item_Clicked(object sender, Group e)
 {
     if (GroupSelected != null)
     {
         GroupSelected(this, groups.FindIndex(g => g.Equals(e)));
     }
 }
 // Set Data Context
 public void SetGroup(Group g)
 {
     this.group = g;
     //
     centerPanelView.Text = g.Name;
     //
     List<Module> controlModules = new List<Module>();
     foreach (Module m in group.Modules)
     {
         if (IsValidControlModule(m))
         {
             controlModules.Add(m);
         }
     }
     int count = 0;
     foreach (Module m in controlModules)
     {
         BaseItem moduleTile = GetTileForModule(m);
         moduleTile.Clicked += (object sender, Module mod) =>
         {
             if (ItemClicked != null) ItemClicked(this, moduleTile);
         };
         moduleTile.Module = m;
         centerPanelView.Controls.Add(moduleTile);
         count++;
     }
 }
 public void SetGroup(Group g)
 {
     this.group = g;
     foreach(Module m in group.Modules)
     {
         m.PropertyChanged += (sender, property) =>
         {
             if (property.Value != property.LastValue)
             {
                 Refresh();
                 Invalidate();
             }
         };
     }
     Refresh();
     Invalidate();
 }