예제 #1
0
        private void renameStateToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (this.network != null)
            {
                if ((this.stateContextMenu.Tag != null) && (this.stateContextMenu.Tag is StateVector))
                {
                    StateVector sv = (StateVector)this.stateContextMenu.Tag;

                    ChangeTextValueForm questionForm = new ChangeTextValueForm();
                    questionForm.Text = "Rename " + sv.Name + " state";
                    questionForm.QuestionLabel = "State name: ";
                    questionForm.AnswerValue = sv.Name;
                    if (questionForm.ShowDialog() == DialogResult.OK)
                    {
                        sv.Name = questionForm.AnswerValue;
                    }
                    this.parentForm.refreshToolWindowsPetriNetwork(this.network);
                }
            }
        }
예제 #2
0
 private void pbPetriNetwork_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     NetworkToolboxItem ntItem = (this.MdiParent as MDIParent).SelectedToolboxItem;
     if (!NetworkToolboxItem.TOKEN.Equals(ntItem) && !NetworkToolboxItem.DELETETOKEN.Equals(ntItem))
     {
         PointF noAlignCoordinates = this.convertPixelToCoord(e.X, e.Y);
         AbstractItem item = this.petriNetwork.getVisualItemByCoordinates(noAlignCoordinates);
         if (item != null)
         {
             ChangeTextValueForm questionForm = new ChangeTextValueForm();
             questionForm.Text = item.ToString();
             if (item is AbstractNote)
             {
                 AbstractNote itemNote = (AbstractNote)item;
                 questionForm.QuestionLabel = "Name: ";
                 questionForm.AnswerValue = itemNote.Text;
                 if (questionForm.ShowDialog() == DialogResult.OK)
                 {
                     itemNote.Text = questionForm.AnswerValue;
                     this.parentCallReDraw(NetworkToolboxAction.REFRESH, true);
                 }
             }
             else
             {
                 questionForm.QuestionLabel = "Name: ";
                 questionForm.AnswerValue = item.Name;
                 if (questionForm.ShowDialog() == DialogResult.OK)
                 {
                     item.Name = questionForm.AnswerValue;
                     this.parentCallReDraw(NetworkToolboxAction.REFRESH, true);
                 }
             }
         }
     }
 }