Dispose() protected method

Clean up any resources being used.
protected Dispose ( bool disposing ) : void
disposing bool true if managed resources should be disposed; otherwise, false.
return void
Exemplo n.º 1
0
        public void Start(string[] args)
        {
            // TODO handle command line arguments....

            _mainForm           = new MainForm();
            _mainForm.Disposed += (o, e) =>
            {
                LiteDevelopSettings.Instance.Save();
                Current = null;
            };

            _worker         = new BackgroundWorker();
            _worker.DoWork += (o, e) =>
            {
                InitializeExtensionHost();
                LoadExtensions();
            };
            _worker.RunWorkerCompleted += (o, e) =>
            {
                OnInitializedApplication(EventArgs.Empty);
                _splashScreen.Dispose();
            };

            _splashScreen          = new SplashScreen();
            _splashScreen.FadedIn += (o, e) =>
            {
                _worker.RunWorkerAsync();
            };

            Application.Run(_splashScreen);
            Application.Run(_mainForm);
        }
Exemplo n.º 2
0
        protected override void OnUnload(EventArgs e)
        {
            currentDomain.UnhandledException -= new UnhandledExceptionEventHandler(MyHandler);
            currentDomain = null;

            if (EngineIsReady)
            {
                //_Sky.OnDestroy();

                OGame.Dispose();
                _assetsManager.Dispose();
                _physics.Dispose();

                if (_GUIRender != null)
                {
                    _GUIRender.Dispose();
                    _GUIRender = null;
                }

                _soundSystem.Dispose();

                GameLoaded    = false;
                EngineIsReady = false;
            }
            else
            {
                Debug.Log("Window is finished, but the game isnt, somthing is not right (:");
            }

            _SplashScreen.Dispose();
            base.OnUnload(e);
        }
        private async Task CloseApplication()
        {
            using (host)
            {
                TrayIcon.Dispose();
                SplashScreen.Dispose();

                await host.StopAsync(TimeSpan.FromSeconds(5));
            }
        }
Exemplo n.º 4
0
        static void loginForm_Load(object sender, EventArgs e)
        {
            // Close splash
            if (splashScreen == null)
            {
                return;
            }

            splashScreen.Invoke(new Action(splashScreen.Close));
            splashScreen.Dispose();
            splashScreen = null;
        }
Exemplo n.º 5
0
        private void DrawSplashScreen(SpriteBatch spriteBatch)
        {
            if (SplashScreen != null)
            {
                if (SplashScreen.IsPlaying)
                {
                    spriteBatch.Begin();
                    spriteBatch.Draw(SplashScreen.GetTexture(), new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
                    spriteBatch.End();

                    if (PlayerInput.KeyHit(Keys.Space) || PlayerInput.KeyHit(Keys.Enter) || PlayerInput.LeftButtonDown())
                    {
                        SplashScreen.Dispose(); SplashScreen = null;
                    }
                }
                else
                {
                    SplashScreen.Dispose(); SplashScreen = null;
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Creates the Security Center object and blocks until the Report Center is told to close
        /// or the user closes the Report Center.
        /// </summary>
        private void Run()
        {
            mReportMDI = new frmReportCenterMDIParent(); //ReportCenter();

            try
            {
                if (mSplashScreen == null)
                {
                    SetSplashScreen();
                }
                mSplashScreen.Show();
                mSplashScreen.Status = Resources.splashInfoLoadStationSettings;
                //get intial module level data
                ModuleComm comm = new ModuleComm();
                Configuration.operatorID   = comm.GetOperatorId();
                Configuration.LoginStaffID = comm.GetStaffId();
                Configuration.mMachineID   = comm.GetMachineId();
                GetGamingDate(); // Rally DE525
                GetSettings();
                Utilities.InitLog();

                mSplashScreen.Status = Resources.infoCheckingReports;

                if (mReportMDI.LoadReports(mSplashScreen))
                {
                    // Listen for the event where something wants the Security Center to stop.
                    StopMe       += new EventHandler(mReportMDI.ExitReportCenter);
                    BringToFront += new EventHandler(ComeToFrontEvent);

                    mSplashScreen.CloseForm();
                    mSplashScreen.Dispose();
                    Utilities.Log("Start running...", LoggerLevel.Information);
                    Application.Run(mReportMDI);
                }
            }
            catch (Exception e)
            {
                Utilities.Log("ReportCenterModule.Run()...Exception.Message =" + e.Message, LoggerLevel.Severe);
                Utilities.Log("Exception.Stack=" + e.StackTrace, LoggerLevel.Severe);

                MessageForm.Show(Resources.errorStart + "\n" + e.Message + "\n\n" + e.StackTrace, Resources.report_center);
            }
            finally
            { // Shutdown
                if (mSplashScreen != null)
                {
                    mSplashScreen.Close();
                    mSplashScreen.Dispose();
                }

                if (mReportMDI != null)
                {
                    mReportMDI.Close();
                    mReportMDI = null;
                }

                OnStop();
                lock (m_syncRoot)
                {
                    // Mark the module as stopped.
                    m_isStopped = true;
                }
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Dispose of this controller and cleanup.
        /// </summary>
        public void Dispose()
        {
            //Save UI
            var activeWindow = sceneViewController.ActiveWindow;

            if (activeWindow != null)
            {
                AnomalyConfig.CameraConfig.MainCameraPosition = activeWindow.Translation;
                AnomalyConfig.CameraConfig.MainCameraLookAt   = activeWindow.LookAt;
            }

            if (guiManager != null && AnomalyConfig.WindowsFile != null)
            {
                ConfigFile configFile = new ConfigFile(AnomalyConfig.WindowsFile);
                guiManager.saveUI(configFile, GetType().Assembly.GetName().Version);
                configFile.writeConfigFile();
            }

            //Clear resources
            resourceController.clearResources();
            resourceController.applyToScene();
            if (virtualTextureLink != null)
            {
                virtualTextureLink.Dispose();
            }

            //Dispose
            if (consoleWindow != null)
            {
                Log.Default.removeLogListener(consoleWindow);
                consoleWindow.Dispose();
            }
            if (splashScreen != null)
            {
                splashScreen.Dispose();
            }
            if (mainObjectEditor != null)
            {
                mainObjectEditor.Dispose();
            }
            if (debugVisualizer != null)
            {
                debugVisualizer.Dispose();
            }
            if (mainForm != null)
            {
                mainForm.Dispose();
            }
            if (mdiLayout != null)
            {
                mdiLayout.Dispose();
            }
            if (selectionMovementTools != null)
            {
                selectionMovementTools.Dispose();
            }
            if (guiManager != null)
            {
                guiManager.Dispose();
            }
            if (sceneViewController != null)
            {
                sceneViewController.Dispose();
            }
            if (eventManager != null)
            {
                eventManager.Dispose();
            }
            if (inputHandler != null)
            {
                inputHandler.Dispose();
            }
            if (systemTimer != null)
            {
                systemTimer.Dispose();
            }
            if (lightManager != null)
            {
                pluginManager.RendererPlugin.destroySceneViewLightManager(lightManager);
            }
            if (frameClearManager != null)
            {
                frameClearManager.Dispose();
            }
            if (pluginManager != null)
            {
                pluginManager.Dispose();
            }
            if (mainWindow != null)
            {
                mainWindow.Dispose();
            }

            AnomalyConfig.save();
            logListener.Dispose();
        }
        public void Dispose()
        {
            liveResourceManager.changeResourcesToMatch(emptyResourceManager);
            liveResourceManager.initializeResources();

            var activeWindow = sceneViewController.ActiveWindow;

            if (activeWindow != null)
            {
                OgreModelEditorConfig.CameraConfig.MainCameraPosition = activeWindow.Translation;
                OgreModelEditorConfig.CameraConfig.MainCameraLookAt   = activeWindow.LookAt;
            }

            IDisposableUtil.DisposeIfNotNull(virtualTextureDebugger);
            IDisposableUtil.DisposeIfNotNull(materialEditor);

            if (textureCompiler != null)
            {
                OgreModelEditorConfig.LastTextureCompilerSourceDirectory = textureCompiler.CurrentSrc;
                textureCompiler.Dispose();
            }

            if (consoleWindow != null)
            {
                Log.Default.removeLogListener(consoleWindow);
                consoleWindow.Dispose();
            }
            if (splashScreen != null)
            {
                splashScreen.Dispose();
            }
            if (objectMover != null)
            {
                objectMover.Dispose();
            }
            if (guiManager != null)
            {
                guiManager.Dispose();
            }
            if (sceneViewController != null)
            {
                sceneViewController.Dispose();
            }
            if (mdiLayout != null)
            {
                mdiLayout.Dispose();
            }
            if (virtualTextureLink != null)
            {
                virtualTextureLink.Dispose();
            }
            if (modelController != null)
            {
                modelController.Dispose();
            }
            if (eventManager != null)
            {
                eventManager.Dispose();
            }
            if (inputHandler != null)
            {
                inputHandler.Dispose();
            }
            if (systemTimer != null)
            {
                systemTimer.Dispose();
            }
            if (lightManager != null)
            {
                pluginManager.RendererPlugin.destroySceneViewLightManager(lightManager);
            }
            if (frameClearManager != null)
            {
                frameClearManager.Dispose();
            }
            if (mainWindow != null)
            {
                mainWindow.Dispose();
            }
            if (pluginManager != null)
            {
                pluginManager.Dispose();
            }

            OgreModelEditorConfig.save();
            logListener.Dispose();
        }
Exemplo n.º 9
0
        /// <summary>
        /// Creates the Security Center object and blocks until the Security Center is told to close
        /// or the user closes the Security Center.
        /// </summary>
        private void Run()
        {
            //SecurityMDI sc = null;
            sc = new SecurityCenterMDIParent();

            try
            {
                if (mSplashScreen == null)
                {
                    SetSplashScreen();
                }
                mSplashScreen.Show();
                mSplashScreen.Status = Properties.Resources.splashInfoLoadStationSettings;

                //get intial module level data
                ModuleComm comm = new ModuleComm();
                Configuration.operatorID   = comm.GetOperatorId();
                Configuration.LoginStaffID = comm.GetStaffId();
                Configuration.mMachineID   = comm.GetMachineId();
                GetWorkstationSettings();
                GetPasswordSettings();

                // Create and initialize new object.
                mSplashScreen.Status = Properties.Resources.splashInfoLoadModuleLevelData;
                sc.LoadData();

                // Listen for the event where something wants the Security Center to stop.
                StopMe       += new EventHandler(sc.ExitSecurityCenter);
                BringToFront += new EventHandler(BringToFrontEvent);

                // Initialize Logger
                Utilities.InitLog();
                Utilities.Log("SecurityCenter start running...", LoggerLevel.Information);

                //Start Fix RALY DE 2991
                //// Get our current operator
                //try
                //{
                //    m_currentOp = GetOperator(comm.GetOperatorId());
                //}
                //catch (Exception e)
                //{
                //    MessageForm.Show(mSplashScreen, string.Format(CultureInfo.CurrentCulture, Resources.GetOperatorDataFailed, e.Message), Resources.SecurityCenterName);

                //    Utilities.Log("Get operator data failed: " + e.Message, LoggerLevel.Severe);
                //    return;
                //}
                //End FIX RALLY DE 2991

                // Get our Staff and module permissions
                try
                {
                    m_currentStaff = GetStaff(comm.GetStaffId());
                }
                catch (Exception e)
                {
                    MessageForm.Show(mSplashScreen, string.Format(CultureInfo.CurrentCulture, Resources.GetStaffDataFailed, e.Message), Resources.SecurityCenterName);

                    Utilities.Log("Get staff info failed: " + e.Message, LoggerLevel.Severe);
                    return;
                }

                // Get our Permissions
                try
                {
                    GetStaffPermissionList();
                }
                catch (Exception e)
                {
                    MessageForm.Show(mSplashScreen, string.Format(CultureInfo.CurrentCulture, Resources.GetStaffPermsFailed, e.Message), Resources.SecurityCenterName);

                    Utilities.Log("Get staff module features failed: " + e.Message, LoggerLevel.Severe);
                    return;
                }

                mSplashScreen.CloseForm();
                mSplashScreen.Dispose();

                sc.CurentStaff = m_currentStaff;
                Application.Run(sc);
            }
            catch (Exception e)
            {
                Utilities.Log("Exception.Message =" + e.Message, LoggerLevel.Severe);
                Utilities.Log("Exception.Stack=" + e.StackTrace, LoggerLevel.Severe);
                MessageForm.Show(Properties.Resources.errorStart, Properties.Resources.securityCenter);
            }
            finally
            { // Shutdown
                if (mSplashScreen != null)
                {
                    mSplashScreen.Close();
                    mSplashScreen.Dispose();
                }
                if (sc != null)
                {
                    sc.Close();
                    sc = null;
                }

                OnStop();
                lock (m_syncRoot)
                {
                    // Mark the module as stopped.
                    m_isStopped = true;
                }
                Utilities.Log("Leaving SecurityCenter...", LoggerLevel.Information);
            }
        }
Exemplo n.º 10
0
 void splashScreen_Hidden(SplashScreen sender)
 {
     splashScreen.Dispose();
     splashScreen = null;
 }
Exemplo n.º 11
0
 void closeForm()
 {
     defaultSplashScreen.Close();
     defaultSplashScreen.Dispose();
 }