Пример #1
0
        private void RefreshStatusText()
        {
            CanRefresh         = false;
            AuthenticationName = /*Environment.UserName;*/ System.Security.Principal.WindowsIdentity.GetCurrent().Name;
            SetAllStatusToPending();

            Task.Run(async() =>
            {
                _refreshThreadStatus[0] = true;
                var status = await _adService.ConnectionStatus(AdService.ConnectionType.Default);
                Application.Current.Dispatcher.Invoke(() =>
                {
                    DefaultConnectionStatus = status ? "Success" : "Failed";
                    DefaultColor            = GetStatusColor(status);
                    CanRefresh = UpdateRefreshStatus(0);
                });
            });
            Task.Run(async() =>
            {
                _refreshThreadStatus[1] = true;
                var status = await _adService.ConnectionStatus(AdService.ConnectionType.Staff);
                Application.Current.Dispatcher.Invoke(() =>
                {
                    StaffConnectionStatus = status ? "Success" : "Failed";
                    StaffColor            = GetStatusColor(status);
                    CanRefresh            = UpdateRefreshStatus(1);
                });
            });
            Task.Run(async() =>
            {
                _refreshThreadStatus[2] = true;
                var status = await _adService.ConnectionStatus(AdService.ConnectionType.NonStaff);
                Application.Current.Dispatcher.Invoke(() =>
                {
                    NonStaffConnectionStatus = status ? "Success" : "Failed";
                    NonStaffColor            = GetStatusColor(status);
                    CanRefresh = UpdateRefreshStatus(2);
                });
            });
            Task.Run(async() =>
            {
                _refreshThreadStatus[3] = true;
                var status = await _adService.ConnectionStatus(AdService.ConnectionType.Computers);
                Application.Current.Dispatcher.Invoke(() =>
                {
                    ComputerConnectionStatus = status ? "Success" : "Failed";
                    ComputerColor            = GetStatusColor(status);
                    CanRefresh = UpdateRefreshStatus(3);
                });
            });
        }