Beispiel #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            StateTransition[] stList = sm.GetAvailableTransitions(sm.GetState(FromState));
            foreach (StateTransition st in stList)
            {
                sm.Transitions.Remove(st);
            }

            for (int i = 1; i < tblMain.Rows.Count; i++)
            {
                HtmlTableRow  tr  = tblMain.Rows[i];
                HtmlTableCell td1 = tr.Cells[0];
                HtmlTableCell td2 = tr.Cells[1];

                CheckBox chk = td1.Controls[0] as CheckBox;
                TextBox  txt = td2.Controls[0] as TextBox;

                string toState = txt.ID.Substring(3);

                if (chk.Checked)
                {
                    sm.Transitions.Add(new StateTransition(txt.Text, FromState, toState));
                }
            }
            sm.Save();

            // Closing window
            if (RefreshButton == String.Empty)
            {
                CHelper.CloseItAndRefresh(Response);
            }
            else              // Dialog Mode
            {
                CHelper.CloseItAndRefresh(Response, RefreshButton);
            }
        }