Beispiel #1
0
        public void AddTask(WCFGameUser gameUser, bool isClosing)
        {
            if (IsBusy)
            {
                return;
            }

            StepBtn.DeleteStepTimer();

            IsBusy = true;
            Application.Current.Dispatcher.BeginInvoke(new Action(() =>
            {
                App.TaskFactory.StartNew(() =>
                {
                    try
                    {
                        _Game.GameService.DisConnect(gameUser);

                        if (isClosing)
                        {
                            Environment.Exit(555);
                        }
                    }
                    catch (Exception exp)
                    {
                        App.Agot2.errorView.ShowByDispatcher(App.GetResources("text_error"), App.GetResources("text_disconnect") + exp.Message);
                    }

                    IsBusy = false;
                });
            }), DispatcherPriority.ApplicationIdle);
        }
Beispiel #2
0
        public void Sync(WCFGameUser serverUser)
        {
            if (Game != null)
            {
                if (Game.ClientGameUser == this && serverUser.NeedReConnect)
                {
                    MainWindow.ClientInfo.ClientGameId = Game.WCFGame.Id;
                }
            }

            if (WCFGameUser.Login != serverUser.Login)
            {
                WCFGameUser.Login = serverUser.Login;
                GPUser            = MainWindow.GamePortal.GetUser(WCFGameUser.Login);
                base.OnPropertyChanged("GPUser");
            }
            WCFGameUser.NewChat = serverUser.NewChat;
            WCFGameUser.NewStep = serverUser.NewStep;
        }
Beispiel #3
0
        public ExtGameUser(ExtGame game, WCFGameUser wcfGameUser)
        {
            Game        = game;
            WCFGameUser = wcfGameUser;

            if (wcfGameUser.Login == "Вестерос")
            {
                GPUser = MainWindow.GamePortal.Vesteros;
            }
            else if (!string.IsNullOrEmpty(wcfGameUser.Login))
            {
                GPUser = MainWindow.GamePortal.GetUser(wcfGameUser.Login);
            }

            if (!string.IsNullOrEmpty(WCFGameUser.HomeType))
            {
                ExtHomeType = MainWindow.ClientInfo.WorldData.HomeType.Single(p => p.WCFHomeType.Name == WCFGameUser.HomeType);
            }

            Sync(wcfGameUser);
        }