コード例 #1
0
        public void             loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader = new XMLAttributeReader(aXMLTextReader);

            if (aXMLTextReader.IsEmptyElement == false)
            {
                aXMLTextReader.Read();

                string  lStateName;
                CSScipt lScript;
                while (aXMLTextReader.Name.Equals("State", StringComparison.Ordinal) && aXMLTextReader.IsStartElement())
                {
                    lStateName = lReader.getAttribute <string>("Name");
                    lScript    = new CSScipt(mItemBrowser);
                    try
                    {
                        lScript.loadFromXML(aXMLTextReader);
                    }
                    catch (Exception lExc)
                    {
                        throw new ArgumentException("State '" + lStateName + "'. " + lExc.Message, lExc);
                    }

                    addState(lStateName, lScript);

                    aXMLTextReader.Read();
                    aXMLTextReader.Read();
                }
            }

            check();
        }
コード例 #2
0
        private void                tsButton_Add_Click(object aSender, EventArgs aEventArgs)
        {
            bool lExit = false;
            var  lName = "State" + (mCSharpFSMClone.StateCount + 1).ToString();

            do
            {
                try
                {
                    lName = StringForm.getString(lName, this, "Add State");
                    if (lName != null)
                    {
                        if (mCSharpFSMClone.isStateExists(lName))
                        {
                            throw new ArgumentException("State '" + lName + "' already exists. ");
                        }

                        CSScipt lScript = new CSScipt(mBrowser);
                        if (lScript.setupByForm(lName, this) == DialogResult.OK)
                        {
                            mCSharpFSMClone.addState(lName, lScript);

                            updateForm();
                            updateButtons();
                        }

                        lExit = true;
                    }
                }
                catch (Exception lExc)
                {
                    MessageForm.showMessage(lExc.Message, this);
                }
            }while (lName != null && lExit == false);
        }
コード例 #3
0
        public void                         addState(string aName, CSScipt aScript)
        {
            if (String.IsNullOrWhiteSpace(aName))
            {
                throw new ArgumentException("State name is empty. ");
            }

            if (mStateAction.ContainsKey(aName))
            {
                throw new ArgumentException("State '" + aName + "' already exists. ");
            }

            aScript.ScriptException += MCSScript_ScriptException;
            aScript.SwitchToState   += MCSScript_SwitchToState;
            mStateAction.Add(aName, aScript);
            mStates.Add(aName);

            if (mStates.Count == 1)
            {
                mCurrentState = aName;
                raiseValuesChanged();
            }

            mItemHandles = null;
        }
コード例 #4
0
        protected virtual void                              Dispose(bool aDisposing)
        {
            if (!mDisposed)
            {
                if (aDisposing)
                {
                    if (mCSScript != null)
                    {
                        mCSScript.ScriptException -= MCSScript_ScriptException;
                        mCSScript.Dispose();
                        mCSScript = null;
                    }
                }

                mDisposed = true;
            }
        }