コード例 #1
0
        /// <summary>
        /// Reloads the composition.
        /// </summary>
        /// <remarks>Reloading is useful if you want to run simulation multiple times in one execution time.
        /// Some models aren't able to run simulation after it was already run, and may crash in such case.
        /// That's because they need to create new instance of them, on which the <c>Initialize</c> method
        /// is called.
        /// Reloading is done same way like when you save the composition to OPR file, restarts the application,
        /// and open this OPR file again. Of course, it is done only internally in the memory.</remarks>
        public void Reload()
        {
            XmlDocument xmlDocument = new XmlDocument();

            SaveToXmlDocument(xmlDocument);

            // preserve members that aren't saved to XML
            bool oldShouldBeSaved = _shouldBeSaved;

            Release();
            AssemblySupport.ReleaseAll();

            LoadFromXmlDocument(Path.GetDirectoryName(_filePath), xmlDocument);

            _shouldBeSaved = oldShouldBeSaved;
        }
コード例 #2
0
        /// <summary>
        /// Initializes this composition.
        /// </summary>
        public void Initialize()
        {
            _models      = new List <UIModel>();
            _connections = new List <UIConnection>();

            _triggerInvokeTime = new DateTime(1900, 1, 1);

            _showEventsInListbox = true;

            _logFileName = "CompositionRun.log";

            _oprFile    = null;
            _oprUnsaved = false;

            _runThread       = null;
            _running         = false;
            _runInSameThread = false;

            AssemblySupport.ReleaseAll();
        }