コード例 #1
0
        private void ItemBackground_DataContextChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
        {
            Grid         cb = ((Grid)sender);
            CombatHotKey hk = (CombatHotKey)cb.DataContext;

            UpdateBackground(cb, hk);
        }
コード例 #2
0
 public CombatHotKey(CombatHotKey hk)
 {
     _Key      = hk._Key;
     _Modifier = hk._Modifier;
     _Type     = hk._Type;
     _Subtype  = hk._Subtype;
 }
コード例 #3
0
        private void ItemBackground_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            Grid         cb = ((Grid)sender);
            CombatHotKey hk = (CombatHotKey)cb.DataContext;

            UpdateBackground(cb, hk);
        }
コード例 #4
0
        private void CheckBox_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            CheckBox     cb     = ((CheckBox)sender);
            CombatHotKey hk     = (CombatHotKey)cb.DataContext;
            Grid         parent = (Grid)VisualTreeHelper.GetParent(cb);

            UpdateBackground(parent, hk);
        }
コード例 #5
0
        private void SubtypeComboBox_Initialized(object sender, System.EventArgs e)
        {
            ComboBox     cb    = (ComboBox)sender;
            CombatHotKey hk    = (CombatHotKey)cb.DataContext;
            int          index = hk.IntType;

            UpdateSubtypeCombo(index, cb);
        }
コード例 #6
0
        private void ItemBackground_Loaded(object sender, System.Windows.RoutedEventArgs e)
        {
            Grid         cb = ((Grid)sender);
            CombatHotKey hk = (CombatHotKey)cb.DataContext;

            UpdateBackground(cb, hk);

            UpdateSubtypeCombo(cb.GetChild <ComboBox>("SubtypeCombo"));
        }
コード例 #7
0
        private void SubtypeComboBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            ComboBox cb = ((ComboBox)sender);

            CombatHotKey hk = (CombatHotKey)cb.DataContext;

            if (cb.SelectedValue != null)
            {
                hk.Subtype = (String)((ComboBoxItem)cb.SelectedValue).Content;
            }
        }
コード例 #8
0
 private void UpdateBackground(Grid grid, CombatHotKey hk)
 {
     if (hk.Modifier == ModifierKeys.None || hk.Modifier == ModifierKeys.Shift)
     {
         grid.Background = new SolidColorBrush(Colors.Pink);
     }
     else
     {
         grid.Background = null;
     }
 }
コード例 #9
0
        private void KeyComboBox_Initialized(object sender, System.EventArgs e)
        {
            ComboBox     cb = (ComboBox)sender;
            CombatHotKey hk = (CombatHotKey)cb.DataContext;

            string key = (String) new KeyToStringConverter().Convert(hk.Key,
                                                                     typeof(String), null, System.Globalization.CultureInfo.CurrentCulture);


            SetIndexForString(cb, key);
        }
コード例 #10
0
        private void CommandComboBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            ComboBox typeCombo = (ComboBox)sender;

            ComboBoxItem cbi = (ComboBoxItem)typeCombo.SelectedItem;
            CombatHotKey hk  = (CombatHotKey)typeCombo.DataContext;

            hk.Type = (CharacterAction)cbi.DataContext;

            ComboBox subtypeCombo = typeCombo.GetSibling <ComboBox>("SubtypeComboBox");

            UpdateSubtypeCombo(subtypeCombo);
        }
コード例 #11
0
        private void UpdateSubtypeCombo(ComboBox subtypeCombo)
        {
            if (subtypeCombo != null)
            {
                ComboBox     cb = subtypeCombo;
                CombatHotKey hk = (CombatHotKey)cb.DataContext;


                subtypeCombo.Items.Clear();
                switch ((CharacterAction)hk.Type)
                {
                case CharacterAction.Save:
                    subtypeCombo.IsEnabled = true;
                    subtypeCombo.Items.Add(new ComboBoxItem()
                    {
                        Content = "Fort"
                    });
                    subtypeCombo.Items.Add(new ComboBoxItem()
                    {
                        Content = "Ref"
                    });
                    subtypeCombo.Items.Add(new ComboBoxItem()
                    {
                        Content = "Will"
                    });
                    SetIndexForString(cb, hk.Subtype);
                    break;

                case CharacterAction.Skill:
                    subtypeCombo.IsEnabled = true;
                    foreach (Monster.SkillInfo si in Monster.SkillsDetails.Values)
                    {
                        subtypeCombo.Items.Add(new ComboBoxItem()
                        {
                            Content = si.Name, Tag = si
                        });
                    }
                    SetIndexForString(cb, hk.Subtype);
                    break;

                case CharacterAction.ApplyCondition:
                    UpdateConditionSubtype(subtypeCombo, hk);
                    break;

                default:
                    subtypeCombo.IsEnabled = false;
                    break;
                }
            }
        }
コード例 #12
0
        private void UpdateSubtypeCombo(int selectedIndex, ComboBox subtypeCombo)
        {
            if (subtypeCombo != null)
            {
                subtypeCombo.Items.Clear();
                switch (selectedIndex)
                {
                case 0:
                    subtypeCombo.IsEnabled = false;
                    break;

                case 1:
                    subtypeCombo.IsEnabled = false;
                    break;

                case 2:
                    subtypeCombo.IsEnabled = true;
                    subtypeCombo.Items.Add(new ComboBoxItem()
                    {
                        Content = "Fort"
                    });
                    subtypeCombo.Items.Add(new ComboBoxItem()
                    {
                        Content = "Ref"
                    });
                    subtypeCombo.Items.Add(new ComboBoxItem()
                    {
                        Content = "Will"
                    });
                    break;

                case 3:
                    subtypeCombo.IsEnabled = true;
                    foreach (Monster.SkillInfo si in Monster.SkillsDetails.Values)
                    {
                        subtypeCombo.Items.Add(new ComboBoxItem()
                        {
                            Content = si.Name, Tag = si
                        });
                    }
                    break;
                }

                ComboBox     cb = subtypeCombo;
                CombatHotKey hk = (CombatHotKey)cb.DataContext;
                SetIndexForString(cb, hk.Subtype);
            }
        }
コード例 #13
0
        private void KeyPressButton_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            CombatHotKey hk = (CombatHotKey)((FrameworkElement)sender).DataContext;


            bool ctrl  = Keyboard.Modifiers.HasFlag(ModifierKeys.Control);
            bool alt   = Keyboard.Modifiers.HasFlag(ModifierKeys.Alt);
            bool shift = Keyboard.Modifiers.HasFlag(ModifierKeys.Shift);

            if (!KeyToStringConverter.IgnoreKeys.Contains(e.Key) && (ctrl | alt | shift))
            {
                hk.Key      = e.Key;
                hk.CtrlKey  = ctrl;
                hk.AltKey   = alt;
                hk.ShiftKey = shift;
            }
        }
コード例 #14
0
        private void UpdateConditionSubtype(ComboBox subtypeCombo, CombatHotKey hk)
        {
            subtypeCombo.IsEnabled = true;

            String hkcond = hk.Subtype;
            bool   found  = false;

            foreach (Condition c in from x in Condition.Conditions where x.Spell == null select x)
            {
                StackPanel panel = new StackPanel();
                panel.Orientation = Orientation.Horizontal;


                Image       i  = new Image();
                BitmapImage bi = StringImageSmallIconConverter.FromName(c.Image);
                i.Source = bi;
                i.Width  = 16;
                i.Height = 16;

                panel.Children.Add(i);
                panel.Children.Add(new TextBlock()
                {
                    Text = c.Name
                });
                ComboBoxItem cbi = new ComboBoxItem()
                {
                    Content = panel, Tag = c
                };

                subtypeCombo.Items.Add(cbi);

                if (c.Name == hkcond)
                {
                    subtypeCombo.SelectedItem = cbi;
                    found = true;
                }
            }
            if (!found)
            {
                subtypeCombo.SelectedIndex = 0;
            }
        }
コード例 #15
0
        private void KeyComboBox_Initialized(object sender, System.EventArgs e)
        {
            ComboBox     cb = (ComboBox)sender;
            CombatHotKey hk = (CombatHotKey)cb.DataContext;


            foreach (var k in KeyToStringConverter.KeysList)
            {
                ComboBoxItem item = new ComboBoxItem();
                item.Content     = k.Key;
                item.DataContext = k.Value;
                cb.Items.Add(item);
            }

            string key = hk.Key.ToString();// (String)new KeyToStringConverter().Convert(hk.Key,

            //typeof(String), null, System.Globalization.CultureInfo.CurrentCulture);


            SetIndexForString(cb, key);
        }
コード例 #16
0
        private void CommandComboBox_Initialized(object sender, System.EventArgs e)
        {
            ComboBox cb = (ComboBox)sender;

            CombatHotKey hk = (CombatHotKey)cb.DataContext;

            ComboBoxItem selected = null;

            foreach (var kv in names)
            {
                ComboBoxItem cbi = new ComboBoxItem();
                cbi.Content     = kv.Key;
                cbi.DataContext = kv.Value;

                if (kv.Value == hk.Type)
                {
                    selected = cbi;
                }

                cb.Items.Add(cbi);
            }
            cb.SelectedItem = selected;
        }
コード例 #17
0
        private void DeleteButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            CombatHotKey hk = (CombatHotKey)((FrameworkElement)sender).DataContext;

            _CombatHotKeys.Remove(hk);
        }