예제 #1
0
 private void TradeDataView_SelectionChanged(object sender, EventArgs e)
 {
     if (MainForm.IsValid)
     {
         MainForm.Instance.IngredientsView.Rows.Clear();
         if (TradeDataView.SelectedRows.Count > 0)
         {
             TradeSkillRecipeCell cell = (TradeSkillRecipeCell)TradeDataView.SelectedRows[0].Cells[0].Value;
             Recipe          _recipe   = Professionbuddy.Instance.TradeSkillList[index].Recipes[cell.RecipeID];
             DataGridViewRow row       = new DataGridViewRow();
             foreach (Ingredient ingred in _recipe.Ingredients)
             {
                 uint inBags = ingred.InBagItemCount;
                 MainForm.Instance.IngredientsView.Rows.
                 Add(ingred.Name, ingred.Required, inBags);
                 if (ingred.InBagItemCount < ingred.Required)
                 {
                     MainForm.Instance.IngredientsView.Rows[MainForm.Instance.IngredientsView.Rows.Count - 1].
                     Cells[2].Style.SelectionBackColor = Color.Red;
                     MainForm.Instance.IngredientsView.Rows[MainForm.Instance.IngredientsView.Rows.Count - 1].
                     Cells[2].Style.ForeColor = Color.Red;
                 }
                 MainForm.Instance.IngredientsView.ClearSelection();
             }
         }
     }
 }
예제 #2
0
        private void toolStripAddBtn_Click(object sender, EventArgs e)
        {
            List<IPBComposite> compositeList = new List<IPBComposite>();
            // if the tradeskill tab is selected
            if (MainTabControl.SelectedTab == TradeSkillTab)
            {
                TradeSkillListView tv = TradeSkillTabControl.SelectedTab as TradeSkillListView;
                if (tv.TradeDataView.SelectedRows == null)
                    return;

                DataGridViewSelectedRowCollection rowCollection = tv.TradeDataView.SelectedRows;
                foreach (DataGridViewRow row in rowCollection)
                {
                    TradeSkillRecipeCell cell = (TradeSkillRecipeCell)row.Cells[0].Value;
                    Recipe recipe = PB.TradeSkillList[tv.TradeIndex].Recipes[cell.RecipeID];
                    int repeat;
                    int.TryParse(toolStripAddNum.Text, out repeat);
                    CastSpellAction.RepeatCalculationType repeatType = CastSpellAction.RepeatCalculationType.Specific;
                    switch (toolStripAddCombo.SelectedIndex)
                    {
                        case 1:
                            repeatType = CastSpellAction.RepeatCalculationType.Craftable;
                            break;
                        case 2:
                            repeatType = CastSpellAction.RepeatCalculationType.Banker;
                            break;
                    }
                    CastSpellAction ca = new CastSpellAction(recipe, repeat, repeatType);
                    compositeList.Add(ca);
                }
            }
            else if (MainTabControl.SelectedTab == ActionsTab)
            {
                if (ActionGridView.SelectedRows != null)
                {
                    foreach (DataGridViewRow row in ActionGridView.SelectedRows)
                    {
                        IPBComposite pa = (IPBComposite)Activator.CreateInstance(row.Tag.GetType());
                        compositeList.Add(pa);
                    }
                }
            }
            copyAction = CopyPasteOperactions.Copy;
            foreach (IPBComposite composite in compositeList)
            {
                if (ActionTree.SelectedNode == null)
                    AddToActionTree(composite, null);
                else
                    AddToActionTree(composite, ActionTree.SelectedNode);
            }
            // now update the CanRepeatCount. 
            PB.UpdateMaterials();
            RefreshTradeSkillTabs();
        }
예제 #3
0
 private void TradeDataView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
     if (TradeDataView.Columns[e.ColumnIndex].HeaderText == "")
     {
         TradeSkillRecipeCell tsrc = TradeDataView.Rows[e.RowIndex].Cells[0].Value as TradeSkillRecipeCell;
         e.CellStyle.ForeColor          = tsrc.Recipe.Color;
         e.CellStyle.BackColor          = e.CellStyle.ForeColor;
         e.CellStyle.SelectionBackColor = e.CellStyle.ForeColor;
         e.CellStyle.SelectionForeColor = e.CellStyle.ForeColor;
     }
 }
예제 #4
0
 private void RefreshTradeSkillTabsCallback()
 {
     foreach (TradeSkillListView tv in TradeSkillTabControl.TabPages)
     {
         tv.TradeDataView.SuspendLayout();
         foreach (DataGridViewRow row in tv.TradeDataView.Rows)
         {
             TradeSkillRecipeCell cell = (TradeSkillRecipeCell)row.Cells[0].Value;
             row.Cells[1].Value = Util.CalculateRecipeRepeat(cell.Recipe);
             row.Cells[2].Value = cell.Recipe.Difficulty;
         }
         tv.TradeDataView.ResumeLayout();
     }
 }