Beispiel #1
0
        //while closing app - save the data
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (rulesWindow == null)
            {
                //delete user from room when clising the app
                DeleteUserFromRoomAlgorithmMethod(LeavingTheRoomWindowType.MainWindow);

                //logging out
                Logout();

                //stop the engine host service if it is running
                EngineHostHandler.StopService("MakaoGameHostService");

                //stop the game client service
                EngineClientHandler.Dispose();

                var logger = NLog.LogManager.GetCurrentClassLogger();
                logger.Info("Saving user data ended successfully.");
            }
            else
            {
                e.Cancel = true;
                if (rulesWindow.WindowState == WindowState.Minimized)
                {
                    rulesWindow.WindowState = WindowState.Normal;
                }
                rulesWindow.Activate();
            }
        }
Beispiel #2
0
        //event when timer counts the time
        private void StopServiceTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            //stop the timer
            if (StopServiceTimer != null)
            {
                StopServiceTimer.Stop();
                StopServiceTimer.Dispose();
                StopServiceTimer = null;
            }

            EngineHostHandler.StopService("MakaoGameHostService");
        }