internal bool UpdateState(Menu oldMenu, Item item, Update update, bool reset = true) { if (reset) { oldMenu.CleanUp(); GroupNames.Clear(); foreach (var group in BlockGroups) { group.Clear(); MembersPool.Return(group); } BlockGroups.Clear(); foreach (var group in Ai.BlockGroups) { var groupName = group.Key; GroupNames.Add(groupName); var membersList = MembersPool.Get(); foreach (var comp in group.Value.Comps) { var groupMember = new GroupMember { Comp = comp, Name = groupName }; membersList.Add(groupMember); } BlockGroups.Add(membersList); } } var groupReady = BlockGroups.Count > 0; if (groupReady) { switch (update) { case Update.Parent: _currentMenu = item.ParentName; break; case Update.Sub: _currentMenu = item.SubName; break; default: break; } var menu = Menus[_currentMenu]; if (menu.ItemCount <= 1) { menu.LoadInfo(reset); } } return(groupReady); }
public override void PurgeCache() { var toClear = GroupNames.ToList(); GroupNames.Clear(); foreach (var g in toClear) { Current.LocalCache.Remove("ADMembers-" + g); } }
public override void PurgeCache() { List <string> toClear; lock (GroupNames) { toClear = GroupNames.ToList(); GroupNames.Clear(); } foreach (var g in toClear) { Cache.Remove("ADMembers-" + g); } }
public bool InitWndControls() { using (var wrapper = new DisposableWrapper <ShowAsyncResult>(CWaitingWnd.ShowAsync(Title, Properties.Resources.resFillingGenerationFromOnlineBDWnd, this, CheckAccess()), asyncResult => { if (asyncResult?.hFinishedSearchEvent != null) { asyncResult.hFinishedSearchEvent.Set(); } })) { EndYears.Clear(); StartYears.Clear(); EndYears.Add((int)enEndYearSpecVals.AndYounger); EndYears.Add((int)enEndYearSpecVals.AndElder); for (int i = DateTime.Now.Year - 7; i > DateTime.Now.Year - 100; i--) { StartYears.Add(i); EndYears.Add(i); } GroupNames.Clear(); lock (DBManagerApp.m_AppSettings.m_SettingsSyncObj) { foreach (var groupNameDesc in DBManagerApp.m_AppSettings.m_Settings.AvailableGroupNames) { GroupNames.Add(groupNameDesc.GroupName); } } // Заполняем выпадающие списки текущими значениями LocalDBComps.Clear(); try { foreach (var comp in DBManagerApp.m_Entities.descriptions.ToList()) { var item = new CompDescLocalWorkbook() { ID = comp.id_desc, Name = comp.name, StartDate = DateTime.Today, EndDate = DateTime.Today.AddDays(2) }; item.DestCompFolder = GetDefaultDestCompFolderName(item); item.PropertyChanged += comp_PropertyChanged; LocalDBComps.Add(item); } SelectedComp = LocalDBComps.LastOrDefault(); } catch (Exception ex) { MessageBox.Show(this, string.Format(Properties.Resources.resfmtErrorDuringReadingDataFromOnlineDB, ex.Message), Title, MessageBoxButton.OK, MessageBoxImage.Error); return(false); } cmbMainJudge.Items.Clear(); foreach (var mainJudge in DBManagerApp .m_Entities .groups .Select(arg => arg.main_judge) .Where(arg => !string.IsNullOrEmpty(arg)) .Distinct()) { cmbMainJudge.Items.Add(mainJudge); } cmbMainSecretary.Items.Clear(); foreach (var mainSecretary in DBManagerApp .m_Entities .groups .Select(arg => arg.main_secretary) .Where(arg => !string.IsNullOrEmpty(arg)) .Distinct()) { cmbMainSecretary.Items.Add(mainSecretary); } cmbRow6.Items.Clear(); foreach (var row6 in DBManagerApp .m_Entities .groups .Select(arg => arg.row6) .Where(arg => !string.IsNullOrEmpty(arg)) .Distinct()) { cmbRow6.Items.Add(row6); } } return(true); }