Esempio n. 1
0
        public async Task Logout()
        {
            TimerManager.Instance.StopTimer();
            if (GlobalData.Instance.Device.EnableLogin)
            {
                SscDialog dialog = new SscDialog(Messages.WarningYouAreSignedOut);
                dialog.ShowDialog();
                Application.Current.Shutdown();
            }
            else
            {
                Log.Logger.Debug($"【rt server connected】:{_rtClientService.IsConnected()}");
                Log.Logger.Debug($"【stop rt server begins】:");
                _rtClientService.Stop();
                Log.Logger.Debug($"【rt server connected】:{_rtClientService.IsConnected()}");

                _userInfo.IsLogouted = true;

                foreach (Window currentWindow in Application.Current.Windows)
                {
                    if (currentWindow is LoginView)
                    {
                        Log.Logger.Debug("【already in login view, do nothing】");
                        return;
                    }

                    var meeting = currentWindow.DataContext as IExitMeeting;
                    if (meeting != null)
                    {
                        Log.Logger.Debug("【in meeting view, exit meeting】");
                        IExitMeeting exitMeetingService = meeting;
                        await exitMeetingService.ExitAsync();
                    }
                }

                Log.Logger.Debug("【in main view】");
                HideShell();

                LoginView loginView = IoC.Get <LoginView>();
                loginView.Show();

                _sdkService.Stop();
                _sdkService.IsServerStarted = false;
            }
        }