Ejemplo n.º 1
0
 public void AlignToControler()
 {
     if (this.IsDesignMode())
     {
         var values = Enum.GetValues(typeof(ViewType));
         foreach (ViewType type in values)
         {
             CreateButton(type);
         }
     }
     else
     {
         ViewControler controler = Controler;
         if (controler != null)
         {
             List <ViewType> list = controler.RegisterdViews;
             list.Sort();
             foreach (ViewType type in list)
             {
                 CreateButton(type, controler.IsCurrent(type));
             }
         }
         AlignOnOff();
     }
 }
Ejemplo n.º 2
0
        public void AlignOnOff()
        {
            ViewControler controler = Controler;

            if (controler != null)
            {
                foreach (Control ctrl in this.flowLayoutPanel1.Controls)
                {
                    if (ctrl is StatusImageButton && ctrl.Tag != null)
                    {
                        ViewType type = (ViewType)(ctrl.Tag);
                        bool     on   = controler.IsCurrent(type);
                        ((StatusImageButton)ctrl).On = on;
                        if (!on)
                        {
                            ctrl.Enabled = !controler.Lock;
                        }
                        ctrl.Enabled = ctrl.Enabled && controler.IsEnabled(type);
                    }
                }
            }
        }