public void parentCallReDraw(NetworkToolboxAction selectedAction, bool minimapRefresh = true) { bool reDraw = false; switch (selectedAction) { case NetworkToolboxAction.REFRESH: reDraw = true; break; case NetworkToolboxAction.CLEAR: this.petriNetwork.clearPetriNetwork(); reDraw = true; break; case NetworkToolboxAction.SELECTALL: this.petriNetwork.selectAllItem(); reDraw = true; break; case NetworkToolboxAction.CLEARSELECTION: this.petriNetwork.unselectAllItem(); reDraw = true; break; case NetworkToolboxAction.REVERSESELECTION: this.petriNetwork.reverseSelection(); reDraw = true; break; case NetworkToolboxAction.DELETESELECTED: this.petriNetwork.deleteSelectedItems(); reDraw = true; break; } if (reDraw) { this.drawPetriNetwork(null, null, minimapRefresh); } if (this.networkItemSelected != null) { this.networkItemSelected(this.petriNetwork.SelectedItems, false); } }
/// <summary> /// Fire when call an action in Palette. /// </summary> private void petriPalette_selectedActionChanged(NetworkToolboxAction selectedAction) { if (this.ActiveMdiChild is PetriNetworkForm) { if ((this.ActiveMdiChild as PetriNetworkForm).Network != null) { (this.ActiveMdiChild as PetriNetworkForm).parentCallReDraw(selectedAction); } } }
private void commonButtonClick(object sender, EventArgs e) { if (sender is Button) { if ((sender as Button).Tag is NetworkToolboxAction) { this.selectedAction = (NetworkToolboxAction)(sender as Button).Tag; this.parentForm.writeConsole("PetriPalette - selected action: " + this.selectedAction); if (this.selectedActionChanged != null) { this.selectedActionChanged(this.selectedAction); } } } }