コード例 #1
0
        private void EllHandler()
        {
            var frm = new TransitionResEdit();

            try
            {
                var destValue = gvTransitions.GetRowCellValue(EllButton.RowHandle, "DestinationState");
                var outValue  = gvTransitions.GetRowCellValue(EllButton.RowHandle, "Output");
                var prob      = gvTransitions.GetRowCellValue(EllButton.RowHandle, "Probability");

                double availableProb = Transition.ProbabilityOfReject;
                if (destValue != DBNull.Value && outValue != DBNull.Value && prob != DBNull.Value)
                {
                    frm.StateKey    = (destValue as FSMState <StructAtom <string>, StructAtom <string> >).KeyName;
                    frm.OutputKey   = (outValue as StructAtom <string>).KeyName;
                    frm.Probability = (double)prob;
                    availableProb   = (double)prob;
                }

                if (frm.Show(availableProb, Transition.OwnerFSM) ==
                    System.Windows.Forms.DialogResult.OK)
                {
                    if (Transition.AddDestination(frm.TransRes.DestState, frm.TransRes.Output, frm.TransRes.Probability))
                    {
                        DataChangedNotify();
                        UpdateGrid();
                        PopulateChart();
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "Добавление перехода", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }