Ejemplo n.º 1
0
 private void buttonDown_Click(object sender, EventArgs e)
 {
     if (dataGridView.SelectedRows.Count == 1)
     {
         int index = dataGridView.SelectedRows[0].Index;
         if (index < batchTools.BatchCharacterList.Count - 1)
         {
             BatchCharacter b = batchTools.BatchCharacterList[index];
             batchTools.BatchCharacterList.RemoveAt(index);
             dataGridView.Rows[index].Selected = false;
             batchTools.BatchCharacterList.Insert(index + 1, b);
             dataGridView.Rows[index + 1].Selected = true;
             dataGridView_SelectionChanged(null, EventArgs.Empty);
         }
     }
 }
Ejemplo n.º 2
0
        private void dataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            if (e.ColumnIndex == loadBatchCharacterColumn.Index)
            {
                OpenFileDialog dialog = new OpenFileDialog();
                dialog.DefaultExt  = ".xml";
                dialog.Filter      = "Rawr Xml Character Files | *.xml";
                dialog.Multiselect = false;
                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    dataGridView[e.ColumnIndex, e.RowIndex].Value = RelativePath(dialog.FileName, AppDomain.CurrentDomain.BaseDirectory);
                    dataGridView.NotifyCurrentCellDirty(true); // force DataGridView to add new row
                    dataGridView.NotifyCurrentCellDirty(false);
                }
                dialog.Dispose();
            }
            else if (e.ColumnIndex == showBatchCharacterColumn.Index && e.RowIndex != dataGridView.NewRowIndex)
            {
                formMain.LoadBatchCharacter(dataGridView.Rows[e.RowIndex].DataBoundItem as BatchCharacter);
            }
            else if (e.ColumnIndex == diffBatchCharacterColumn.Index && e.RowIndex != dataGridView.NewRowIndex)
            {
                BatchCharacter     character = (BatchCharacter)dataGridView.Rows[e.RowIndex].DataBoundItem;
                Character          before    = Character.Load(character.AbsolutePath); // load clean version for comparison
                Character          after     = character.Character;
                FormOptimizeResult result    = new FormOptimizeResult(before, after);
                result.SetOptimizerScores(character.Score, character.NewScore.GetValueOrDefault(character.Score));
                if (result.ShowDialog(this) == DialogResult.No)
                {
                    // we don't want the new character, reload the old one
                    Character _character = character.Character;
                    _character.IsLoading = true;
                    _character.SetItems(before, false, false);
                    _character.ActiveBuffs = before.ActiveBuffs;
                    //_character.CurrentTalents = before.CurrentTalents; // let's not play with talents for now
                    _character.IsLoading = false;
                    _character.OnCalculationsInvalidated();
                    character.UnsavedChanges = false; // reset the dirty flag and update ui
                }
            }
        }