示例#1
0
        private void btnAddRune_Click(object sender, RoutedEventArgs e)
        {
            RuneEditorWindow dlg  = new RuneEditorWindow();
            EditorWindow     ewin = (EditorWindow)Window.GetWindow(this);

            dlg.Owner          = ewin;
            dlg.runeCollection = ewin.db.runeMCollection;
            TH1Helper _help = new TH1Helper();

            if (gridRunes.Items.Count < _help.LIMIT_MAX_RUNES)
            {
                if (dlg.ShowDialog().Equals(true))
                {
                    Functions.log(string.Format("Creating New Rune [{0}]", dlg.thisRune.rune.runeString));
                    gridRunes.ItemsSource = null;
                    if ((dlg.thisRune.calcValue == 0) && (dlg.thisRune.valueModifier != 0))
                    {
                        Functions.log(string.Format("Value Modifier Caused The Rune Value To Go Out Of Bounds ({0})"), Functions.LC_WARNING);
                        dlg.thisRune.valueModifier = 0;
                    }
                    ewin._save.runes.Add(dlg.thisRune);
                    gridRunes.ItemsSource = ewin._save.runes;
                    recountRunes();
                }
                else
                {
                    Functions.log("User Cancelled");
                }
            }
            else
            {
                Functions.log("Max Rune Limit Reached, Cannot Create New Rune", Functions.LC_WARNING);
                MessageBox.Show(String.Format("You Have Reached The Maximum Number Of Runes ({0})", _help.LIMIT_MAX_RUNES), "Rune Limit Reached", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
示例#2
0
        private void DataGridRow_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            EditorWindow     ewin = (EditorWindow)Window.GetWindow(this);
            RuneEditorWindow dlg  = new RuneEditorWindow();

            dlg.runeCollection = ewin.db.runeMCollection;
            dlg.runeIndex      = gridRunes.SelectedIndex;
            dlg.thisRune       = (TH1RuneMExt)gridRunes.SelectedItem;
            dlg.Owner          = Window.GetWindow(this);

            if (dlg.ShowDialog().Equals(true))
            {
                Functions.log("Saving Rune..");
                if ((dlg.thisRune.calcValue == 0) && (dlg.thisRune.valueModifier != 0))
                {
                    Functions.log(string.Format("Value Modifier Caused The Rune Value To Go Out Of Bounds ({0})", dlg.thisRune.valueModifier), Functions.LC_WARNING);
                    dlg.thisRune.valueModifier = 0;
                }
                gridRunes.ItemsSource           = null;
                ewin._save.runes[dlg.runeIndex] = dlg.thisRune;
                gridRunes.ItemsSource           = ewin._save.runes;
                recountRunes();
            }
            else
            {
                Functions.log("User Cancelled");
            }
        }