private void trvWidgets_AfterSelect(object sender, TreeViewEventArgs e)
        {
            var menu = trvWidgets.SelectedNode.Tag as IMenu;
            var item = trvWidgets.SelectedNode.Tag as IWidgetItem;

            propertiesPanel.Controls.Clear();
            btnAddWidget.Enabled    = false;
            btnMoveUp.Enabled       = btnMoveDown.Enabled = false;
            btnRemoveWidget.Enabled = false;
            if (menu != null)
            {
                btnAddWidget.Enabled = true;
                var fly = menu as IFlyoutItem;
                if (fly != null) //Can only edit menus that are flyouts
                {
                    btnRemoveWidget.Enabled = true;
                    btnMoveDown.Enabled     = btnMoveUp.Enabled = true;
                    var ctrl = new MenuCtrl(fly, _edsvc);
                    ctrl.Dock = DockStyle.Fill;
                    propertiesPanel.Controls.Add(ctrl);
                }
            }
            else
            {
                btnMoveDown.Enabled     = btnMoveUp.Enabled = true;
                btnRemoveWidget.Enabled = true;
                if (item != null)
                {
                    var ctrl = new WidgetReferenceCtrl(item, _edsvc);
                    ctrl.Dock = DockStyle.Fill;
                    propertiesPanel.Controls.Add(ctrl);
                }
            }
        }
Ejemplo n.º 2
0
 private void trvWidgets_AfterSelect(object sender, TreeViewEventArgs e)
 {
     var menu = trvWidgets.SelectedNode.Tag as IMenu;
     var item = trvWidgets.SelectedNode.Tag as IWidgetItem;
     propertiesPanel.Controls.Clear();
     btnAddWidget.Enabled = false;
     btnMoveUp.Enabled = btnMoveDown.Enabled = false;
     btnRemoveWidget.Enabled = false;
     if (menu != null)
     {
         btnAddWidget.Enabled = true;
         var fly = menu as IFlyoutItem;
         if (fly != null) //Can only edit menus that are flyouts
         {
             btnRemoveWidget.Enabled = true;
             btnMoveDown.Enabled = btnMoveUp.Enabled = true;
             var ctrl = new MenuCtrl(fly, _edsvc);
             ctrl.Dock = DockStyle.Fill;
             propertiesPanel.Controls.Add(ctrl);
         }
     }
     else
     {
         btnMoveDown.Enabled = btnMoveUp.Enabled = true;
         btnRemoveWidget.Enabled = true;
         if (item != null)
         {
             var ctrl = new WidgetReferenceCtrl(item, _edsvc);
             ctrl.Dock = DockStyle.Fill;
             propertiesPanel.Controls.Add(ctrl);
         }
     }
 }