Example #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;
                    }

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

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

                LoginView loginView = DependencyResolver.Current.GetService <LoginView>();
                loginView.Show();

                _sdkService.Stop();
                _sdkService.SetMeetingAgentStatus(false);
            }
        }