Esempio n. 1
0
        /// <summary>
        /// Handles the Click event of the AddMeasure control. Button, Menu or Tree Node.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void AddMeasure_Click(object sender, EventArgs e)
        {
            string          businessProcess = this.tabControlArea.SelectedTab.Text;
            BusinessProcess b = this.cmodel.GetBusinessProcess(businessProcess);

            using (AddMeasure am = new AddMeasure(b))
            {
                Point location = new Point((this.Left + (this.Width / 2)) - am.Width / 2, (this.Top + (this.Height / 2)) - am.Height / 2);
                am.StartPosition = FormStartPosition.Manual;
                am.Location      = location;
                var result = am.ShowDialog();
                if (result == DialogResult.OK)
                {
                    Measure m = new Measure();
                    m.Name = am.MeasureName.Text;
                    m.Type = (MeasureType)Enum.Parse(typeof(MeasureType), am.MeasureType.Text);
                    b.AddMeasure(m);
                    this.Draw();
                    tabControlArea.SelectTab(businessProcess);
                }
            }
        }