예제 #1
0
        void BeforeChange()
        {
            JsonMonitor m = RetrieveMonitor();

            if (m != null)
            {
                if (m.IsReadOnly)
                {
                    throw new InvalidOperationException("Marked as read-only");
                }

                m.IsModified = true;
            }
        }
예제 #2
0
        public JsonMonitor CreateMonitor()
        {
            if (m_Parent != null)
            {
                throw new InvalidOperationException("CreateMonitor is only allowed for the root node");
            }

            if (m_Monitor != null)
            {
                throw new InvalidOperationException("CreateMonitor must not be called several times");
            }

            m_Monitor = new JsonMonitor();
            return(m_Monitor);
        }