/// <summary> /// Инициализировать доступный контент пользователя. /// </summary> public void Init(UserData userData, DataAccess dataAccess) { if (userData == null) { throw new ArgumentNullException("userData"); } try { reportItemDict.Clear(); dataWndItemDict.Clear(); ReportItems.Clear(); DataWndItems.Clear(); AddContentFromBase(userData.UserRights, userData.UiObjSpecs, dataAccess); AddContentFromPlugins(userData.PluginSpecs); ReportItems.Sort(); DataWndItems.Sort(); } catch (Exception ex) { log.WriteException(ex, Localization.UseRussian ? "Ошибка при инициализации доступного контента пользователя" : "Error initializing accessible user content"); } }
public async void Load() { var dialogs = UserDialogs.Instance; dialogs.ShowLoading(); await Task.Delay(500); ReportItems.Clear(); List <ReportItem> items = ReportItemDatabase.ListReportsOrdered(DateControl.Month, DateControl.Year); foreach (var item in items) { ReportItems.Add(item); } dialogs.HideLoading(); }
private async Task setItemsAsync() { IsBusy = true; ReportItems.Clear(); ObservableCollection <ReportItem> allReports = null; try { // if select groupid, get reports referensed group if (!string.IsNullOrWhiteSpace(TargetGroupId)) { //allReports = await CustomFunction.Get<ObservableCollection<ReportItem>> // ($"api/values/reportsbygroup/{TargetGroupId}/{this.CurrentDate.Year}/{this.CurrentDate.Month}"); allReports = await ReportGroupManager.DefaultManager.GetReportsByGroup (TargetGroupId, CurrentDate.Year, CurrentDate.Month); } // default else { allReports = await ReportManager.DefaultManager.GetItemsAsync(this.CurrentDate.Year, this.CurrentDate.Month); } } catch (Exception e) { DebugUtil.WriteLine("UserReportListViewModel > " + e.Message); } if (allReports != null) { foreach (var item in allReports) { ReportItems.Add(item); } } IsBusy = false; }
private void Reload() { ReportItems.Clear(); LoadAllItems().AddToCollection(ReportItems); }