Ejemplo n.º 1
0
 public keySelectWindow(KeyActionClass ka, Boolean editable = true)
 {
     keyAction = ka;
     InitializeComponent();
     foreach (String act in keyAction.actionList)
     {
         StackPanel sp = new StackPanel();
         sp.Orientation = Orientation.Horizontal;
         Label lbl = new Label();
         lbl.Content = act;
         lbl.Width   = actionLbl.Width;
         sp.Children.Add(lbl);
         if (editable)
         {
             ComboBox cb = new ComboBox();
             cb.Name              = act;
             cb.Width             = keyLbl.Width;
             cb.SelectionChanged += actionKeyChanged;
             loadKeyItems(cb);
             setSelected(cb, act);
             sp.Children.Add(cb);
         }
         else
         {
             lbl = new Label();
             String k = keyAction.getKey(act);
             if (k == null)
             {
                 lbl.Content = "Not set";
             }
             else
             {
                 lbl.Content = act;
             }
             lbl.Width = actionLbl.Width;
             sp.Children.Add(lbl);
         }
         keyStackPanel.Children.Add(sp);
     }
     fixSource = true;
     if (!editable)
     //    buttonStack.Visibility = Visibility.Visible;
     //else
     {
         buttonStack.Visibility = Visibility.Hidden;
         buttonStack.Height     = 0;
     }
 }
 public keySelectWindow(KeyActionClass ka, Boolean editable = true)
 {
     keyAction = ka;
     InitializeComponent();
     foreach (String act in keyAction.actionList)
     {
         StackPanel sp = new StackPanel();
         sp.Orientation = Orientation.Horizontal;
         Label lbl = new Label();
         lbl.Content = act;
         lbl.Width = actionLbl.Width;
         sp.Children.Add(lbl);
         if (editable)
         {
             ComboBox cb = new ComboBox();
             cb.Name = act;
             cb.Width = keyLbl.Width;
             cb.SelectionChanged += actionKeyChanged;
             loadKeyItems(cb);
             setSelected(cb, act);
             sp.Children.Add(cb);
         }
         else
         {
             lbl = new Label();
             String k = keyAction.getKey(act);
             if (k == null)
                 lbl.Content = "Not set";
             else
                 lbl.Content = act;
             lbl.Width = actionLbl.Width;
             sp.Children.Add(lbl);
         }
         keyStackPanel.Children.Add(sp);
     }
     fixSource = true;
     if (!editable)
     //    buttonStack.Visibility = Visibility.Visible;
     //else
     {
         buttonStack.Visibility = Visibility.Hidden;
         buttonStack.Height = 0;
     }
 }
Ejemplo n.º 3
0
 void setSelected(ComboBox cb, String act)
 {
     fixSource       = false;
     cb.SelectedItem = keyAction.getKey(act);
     fixSource       = true;
 }