public MainViewModel() { if (LicenseManager.UsageMode == LicenseUsageMode.Designtime) { return; } GoodPing = Settings.Default.GoodPingInMS; DefaultPingTime = Settings.Default.DefaultPingTimeInMS; _authenticationProvider = IoC.Instance.Resolve <IAuthenticationProvider>(); _authenticationProvider.AuthenticatedUserChanged += (sender, args) => { OnPropertyChanged(UserInfoPropertyName); UpdateSysEnvironmentInfo(GetSysDbInfo()); WriteWorker(null); if (WMSEnvironment.Instance.AuthenticatedUser != null && _chatManager != null) { new TaskFactory().StartNew(() => { var signature = WMSEnvironment.Instance.AuthenticatedUser.GetSignature(); using (var mgr = IoC.Instance.Resolve <IBaseManager <UserGroup> >()) { var rooms = mgr.GetFiltered(string.Format("USERGROUPCODE in (select g.USERGROUPCODE_R from RUSER2GROUP g where g.USERCODE_R = '{0}')", signature), FilterHelper.GetAttrEntity <UserGroup>(UserGroup.UserGroupCodePropertyName, UserGroup.USERGROUPNAMEPropertyName)). ToDictionary(r => r.GetKey <string>(), r => r.GetProperty <string>(UserGroup.USERGROUPNAMEPropertyName)); _chatManager.SetDefaultRooms(rooms); } _chatManager.Disconnect(); _chatManager.Connect(signature, signature); }); } GetWorkers(); SetMandantNames(); }; // отображаем информацию о пользователе OnPropertyChanged(UserInfoPropertyName); // запускаем пинг _pinger = new Timer(CheckStatus, null, 0, DefaultPingTime); if (IoC.Instance.TryResolve <IChatManager>(out _chatManager)) { _chatManager.Message += chatManager_Message; _chatManager.StateChanged += _chatManager_StateChanged; } PingStateIndex = 0; _sysMsgState = 0; AboutCommand = new DelegateCustomCommand(ShowAboutBox, () => true); LoginCommand = new DelegateCustomCommand(Login, CanReAuthenticate); LogoffCommand = new DelegateCustomCommand(Logoff, () => !SystemUpdate); SystemMessageCommand = new DelegateCustomCommand(CreateSysMsg, () => !SystemUpdate); //ClearCacheCommand = new DelegateCustomCommand(ClearCache, () => true); SysDbInfoCommand = new DelegateCustomCommand(OnSysDbInfo, () => true); LiteCacheClearCommand = new DelegateCustomCommand(LiteClearCache, () => !SystemUpdate); DashboardShowCommand = new DelegateCustomCommand(DashboardShow, () => !SystemUpdate); TopologyShowCommand = new DelegateCustomCommand(TopologyShow, () => !SystemUpdate); PrintReportCommand = new DelegateCustomCommand(PrintReport, () => !SystemUpdate); PropertyCommand = new DelegateCustomCommand(PropertyShow, () => !SystemUpdate); WorkingManageShowCommand = new DelegateCustomCommand(WorkingManageShow, () => !SystemUpdate); PackingShowCommand = new DelegateCustomCommand(PackingShow, () => !SystemUpdate); CustomsShowCommand = new DelegateCustomCommand(CustomsShow, () => !SystemUpdate); ChatShowCommand = new DelegateCustomCommand(ChatShow, CanChatShow); NextSDCLCommand = new DelegateCustomCommand(NextSDCL, () => !SystemUpdate); AddWorkerCommand = new DelegateCustomCommand(AddWorker); SetWorkerCommand = new DelegateCustomCommand <string>(SetWorker); MandantsCommand = new DelegateCustomCommand(ShowSelectMandant); SystemMessageSubject = StringResources.StateRun; SystemMessage = string.Format(StringResources.EnjoyYourWork, Environment.NewLine); InfoWorkers = new ObservableCollection <ItemInfo>(); }