private void Clear() { txtSearchKey.Clear(); txtSearchKey.Focus(); grdSearch.DataSource = new BindingSource(CollectCategoryAll, null); if (InitialIds.Any()) { SetCheckState(check: 1, filter: x => InitialIds.Contains(x.Id)); } SortGridData(); }
protected override void InitLayout() { base.InitLayout(); if (ParentForm == null) { return; } ParentForm.KeyPreview = false; txtSearchKey.KeyDown += (sender, e) => control_KeyDown(sender, e); ParentForm.Load += (sender, e) => { var tasks = new List <Task> { LoadApplicationControlAsync(), LoadCompanyAsync(), LoadControlColorAsync(), Task.Run(async() => SectionsAll = await GetSectionsAsync()), Task.Run(async() => SectionsWithLoginUser = await GetSectionsWithLoginUserAsync()) }; ProgressDialog.Start(ParentForm, Task.WhenAll(tasks), false, SessionKey); }; ParentForm.Shown += (sender, ea) => { grdSearch.Template = CreateGridTemplate(); grdSearch.DataSource = new BindingSource(SectionsAll, null); if (AllSection) { SetCheckState(check: 1); } else { var ids = InitialIds.Any() ? InitialIds : new List <int>(SectionsWithLoginUser.Select(x => x.Id)); SetCheckState(check: 1, filter: x => ids.Contains(x.Id)); } InitialIds = GetCheckedIds(); SortGridData(); grdSearch.CurrentCellDirtyStateChanged += (_, __) => grdSearch.CommitEdit(GrapeCity.Win.MultiRow.DataErrorContexts.Commit); }; }
protected override void InitLayout() { base.InitLayout(); if (ParentForm == null) { return; } ParentForm.KeyPreview = false; txtSearchKey.KeyDown += (sender, e) => control_KeyDown(sender, e); ParentForm.Load += (sender, e) => { var tasks = new List <Task> { LoadApplicationControlAsync(), LoadCompanyAsync(), LoadControlColorAsync(), Task.Run(async() => DepartmentsAll = await GetDepartmentsAsync()) }; ProgressDialog.Start(ParentForm, Task.WhenAll(tasks), false, SessionKey); }; ParentForm.Shown += (sender, e) => { grdSearch.Template = CreateGridTemplate(); grdSearch.DataSource = new BindingSource(DepartmentsAll, null); if (!AllSelected && InitialIds.Any()) { SetCheckState(check: 1, filter: x => InitialIds.Contains(x.Id)); } else { SetCheckState(check: 1); } InitialIds = GetCheckedIds(); SortGridData(); }; }
private void InitializeUserComponent() { grdSearch.SetupShortcutKeys(); FormWidth = 700; FormHeight = 600; FunctionKeysSetter = buttons => { foreach (var button in buttons) { if (button.Name == "btnF01" || button.Name == "btnF02" || button.Name == "btnF03") { button.Anchor = AnchorStyles.Left | AnchorStyles.Top; } else if (button.Name == "btnF10" || button.Name == "btnF08" || button.Name == "btnF09") { button.Anchor = AnchorStyles.Top | AnchorStyles.Right; } else { button.Visible = false; } } }; this.Load += (s, e) => { var tasks = new List <Task>(); if (ApplicationControl == null) { tasks.Add(LoadApplicationControlAsync()); } if (Company == null) { tasks.Add(LoadCompanyAsync()); } tasks.Add(LoadControlColorAsync()); var categorySearch = new CategorySearch(); categorySearch.CompanyId = CompanyId; categorySearch.CategoryType = CategoryType.Collect; //Task<List<Category>> categoryTask = GetCollectCategoryListAsync(categorySearch); Task <List <Category> > categoryTask = GetCollectCategoryListAsync(); tasks.Add(categoryTask); ProgressDialog.Start(ParentForm, Task.WhenAll(tasks), false, SessionKey); CollectCategoryAll = categoryTask.Result; ParentForm.Shown += (sender, ea) => { grdSearch.Template = CreateGridTemplate(); grdSearch.DataSource = new BindingSource(CollectCategoryAll, null); if (!AllSelected && InitialIds.Any()) { SetCheckState(check: 1, filter: x => InitialIds.Contains(x.Id)); } else { SetCheckState(check: 0); } InitialIds = GetCheckedIds(); SortGridData(); }; }; }