示例#1
0
 private void StopHostServiceAndDisposeEngineHostHandler()
 {
     if (EngineHostHandler.ServiceName != "" || EngineHostHandler.ServiceName != null)
     {
         EngineHostHandler.Dispose();
     }
 }
示例#2
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();
            }
        }
示例#3
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");
        }
示例#4
0
        //when room was deleted by host
        private void DataPlaceholder_TheRoomWasDeleted(object sender, RoomDeletionReasonsEventArgs e)
        {
            //close game window if it is opened
            SynchCont.Post(_ => CloseGameWindow(), null);

            if (e.DeletionReason == DeletionReason.ClosedByHost)
            {
                //not being host
                if (openedPageNumber == 1 && !IsHostPlayer)
                {
                    SynchCont.Post(_ => openedPageNumber        = 0, null);
                    SynchCont.Post(_ => MainWindowFrame.Content = null, null);
                    Task.Run(() => RoomDeletionReasonMessageBox(e.DeletionReason));
                }
            }
            else
            {
                SynchCont.Post(_ => openedPageNumber        = 0, null);
                SynchCont.Post(_ => MainWindowFrame.Content = null, null);
                SynchCont.Post(_ => EngineHostHandler.Dispose(), null);
                Task.Run(() => RoomDeletionReasonMessageBox(e.DeletionReason));
            }
        }