// used to update GUI controls via other threads private void ActionTreeDragDrop(object sender, DragEventArgs e) { _copyAction = CopyPasteOperactions.Cut; if ((e.KeyState & 4) > 0) // shift key { _copyAction |= CopyPasteOperactions.IgnoreRoot; } if ((e.KeyState & 8) > 0) // ctrl key { _copyAction |= CopyPasteOperactions.Copy; } if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false)) { Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y)); TreeNode dest = ((TreeView)sender).GetNodeAt(pt); var newNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode"); PasteAction(newNode, dest); } else if (e.Data.GetDataPresent("System.Windows.Forms.DataGridViewRow", false)) { Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y)); TreeNode dest = ((TreeView)sender).GetNodeAt(pt); var row = (DataGridViewRow)e.Data.GetData("System.Windows.Forms.DataGridViewRow"); if (row.Tag.GetType().GetInterface("IPBComposite") != null) { var pa = (IPBComposite)Activator.CreateInstance(row.Tag.GetType()); AddToActionTree(pa, dest); } } }
// used to update GUI controls via other threads private void ActionTreeDragDrop(object sender, DragEventArgs e) { _copyAction = CopyPasteOperactions.Cut; if ((e.KeyState & 4) > 0) // shift key _copyAction |= CopyPasteOperactions.IgnoreRoot; if ((e.KeyState & 8) > 0) // ctrl key _copyAction |= CopyPasteOperactions.Copy; if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false)) { Point pt = ((TreeView) sender).PointToClient(new Point(e.X, e.Y)); TreeNode dest = ((TreeView) sender).GetNodeAt(pt); var newNode = (TreeNode) e.Data.GetData("System.Windows.Forms.TreeNode"); PasteAction(newNode, dest); } else if (e.Data.GetDataPresent("System.Windows.Forms.DataGridViewRow", false)) { Point pt = ((TreeView) sender).PointToClient(new Point(e.X, e.Y)); TreeNode dest = ((TreeView) sender).GetNodeAt(pt); var row = (DataGridViewRow) e.Data.GetData("System.Windows.Forms.DataGridViewRow"); if (row.Tag.GetType().GetInterface("IPBComposite") != null) { var pa = (IPBComposite) Activator.CreateInstance(row.Tag.GetType()); AddToActionTree(pa, dest); } } }
private void ToolStripCutClick(object sender, EventArgs e) { _copySource = ActionTree.SelectedNode; if (_copySource != null) { _copyAction = CopyPasteOperactions.Cut; } }
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(); }
private void ToolStripAddBtnClick(object sender, EventArgs e) { var compositeList = new List <IPBComponent>(); // if the tradeskill tab is selected if (MainTabControl.SelectedTab == TradeSkillTab) { var tv = TradeSkillTabControl.SelectedTab as TradeSkillListView; if (tv != null) { DataGridViewSelectedRowCollection rowCollection = tv.TradeDataView.SelectedRows; foreach (DataGridViewRow row in rowCollection) { var cell = (TradeSkillRecipeCell)row.Cells[0].Value; Recipe recipe = ProfessionbuddyBot.Instance.TradeSkillList[tv.TradeIndex].KnownRecipes[cell.RecipeID]; int repeat; int.TryParse(toolStripAddNum.Text, out repeat); var repeatType = CastSpellAction.RepeatCalculationType.Specific; switch (toolStripAddCombo.SelectedIndex) { case 1: repeatType = CastSpellAction.RepeatCalculationType.Craftable; break; case 2: repeatType = CastSpellAction.RepeatCalculationType.Banker; break; } var ca = new CastSpellAction(recipe, repeat, repeatType); compositeList.Add(ca); } } } else if (MainTabControl.SelectedTab == ActionsTab) { compositeList.AddRange( from DataGridViewRow row in ActionGridView.SelectedRows select(IPBComponent) Activator.CreateInstance(row.Tag.GetType())); } _copyAction = CopyPasteOperactions.Copy; foreach (IPBComponent composite in compositeList) { AddToActionTree(composite, ActionTree.SelectedNode); } // now update the CanRepeatCount. ProfessionbuddyBot.Instance.UpdateMaterials(); RefreshTradeSkillTabs(); }
private void ToolStripCutClick(object sender, EventArgs e) { _copySource = ActionTree.SelectedNode; if (_copySource != null) _copyAction = CopyPasteOperactions.Cut; }
private void ToolStripAddBtnClick(object sender, EventArgs e) { var compositeList = new List<IPBComposite>(); // if the tradeskill tab is selected if (MainTabControl.SelectedTab == TradeSkillTab) { var tv = TradeSkillTabControl.SelectedTab as TradeSkillListView; if (tv != null) { DataGridViewSelectedRowCollection rowCollection = tv.TradeDataView.SelectedRows; foreach (DataGridViewRow row in rowCollection) { var cell = (TradeSkillRecipeCell) row.Cells[0].Value; Recipe recipe = _pb.TradeSkillList[tv.TradeIndex].KnownRecipes[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; } var ca = new CastSpellAction(recipe, repeat, repeatType); compositeList.Add(ca); } } } else if (MainTabControl.SelectedTab == ActionsTab) { compositeList.AddRange(from DataGridViewRow row in ActionGridView.SelectedRows select (IPBComposite) Activator.CreateInstance(row.Tag.GetType())); } _copyAction = CopyPasteOperactions.Copy; foreach (IPBComposite composite in compositeList) { AddToActionTree(composite, ActionTree.SelectedNode); } // now update the CanRepeatCount. _pb.UpdateMaterials(); RefreshTradeSkillTabs(); }
private void toolStripCopy_Click(object sender, EventArgs e) { copySource = ActionTree.SelectedNode; if (copySource != null) copyAction = CopyPasteOperactions.Copy; }