コード例 #1
0
        protected async Task LoadData(string debugLevel = "")
        {
            try
            {
                DebugLevel = debugLevel;
                Expression <Func <DbLog, bool> > predicate = null;

                if (!string.IsNullOrWhiteSpace(debugLevel))
                {
                    predicate = i => i.Level == debugLevel;
                }

                var result = await apiClient.GetLogs(predicate, pageSize, pageIndex *pageSize);

                dbLogItems      = new List <DbLog>(result);
                totalItemsCount = (int)result.InlineCount.Value;
                viewNotifier.Show(L["One item found", Plural.From("{0} items found", totalItemsCount)], ViewNotifierType.Success, L["Operation Successful"]);
            }
            catch (Exception ex)
            {
                viewNotifier.Show(ex.GetBaseException().Message, ViewNotifierType.Error, L["Operation Failed"]);
            }

            await InvokeAsync(StateHasChanged);
        }
コード例 #2
0
        protected async Task LoadUsers()
        {
            try
            {
                apiClient.ClearEntitiesCache();
                var result = await apiClient.GetUsers(null, pageSize, pageIndex *pageSize);

                users           = new List <ApplicationUser>(result);
                totalItemsCount = (int)result.InlineCount.Value;

                viewNotifier.Show(L["One item found", Plural.From("{0} items found", totalItemsCount)], ViewNotifierType.Success, L["Operation Successful"]);
            }
            catch (Exception ex)
            {
                viewNotifier.Show(ex.GetBaseException().Message, ViewNotifierType.Error, L["Operation Failed"]);
            }
        }
コード例 #3
0
        protected async Task LoadData()
        {
            try
            {
                var result = await apiClient.GetApiLogs(null, pageSize, pageIndex *pageSize);

                apiLogItems     = new List <ApiLogItem>(result);
                totalItemsCount = (int)result.InlineCount.Value;
                viewNotifier.Show(L["One item found", Plural.From("{0} items found", totalItemsCount)], ViewNotifierType.Success, L["Operation Successful"]);
            }
            catch (Exception ex)
            {
                viewNotifier.Show(ex.GetBaseException().Message, ViewNotifierType.Error, L["Operation Failed"]);
            }

            await InvokeAsync(StateHasChanged);
        }
コード例 #4
0
        protected async Task LoadKeys(string filter = null)
        {
            localizationRecords = new List <LocalizationRecord>();

            try
            {
                localizationApiClient.ClearEntitiesCache();
                var result = await localizationApiClient.GetLocalizationRecordKeys(pageSize, pageIndex *pageSize, filter);

                localizationRecordKeys = new List <LocalizationRecordKey>(result);
                totalItemsCount        = (int)result.InlineCount.Value;

                matToaster.Add(L["One item found", Plural.From("{0} items found", totalItemsCount)], MatToastType.Success, L["Operation Successful"]);
            }
            catch (Exception ex)
            {
                matToaster.Add(ex.GetBaseException().Message, MatToastType.Danger, L["Operation Failed"]);
            }
        }
コード例 #5
0
        protected async Task LoadKeys()
        {
            currentKey = null;

            try
            {
                localizationApiClient.ClearEntitiesCache();
                var result = await localizationApiClient.GetLocalizationRecordKeys(pageSize, pageIndex *pageSize, filter);

                localizationRecordKeys = new List <LocalizationRecordKey>(result);
                totalItemsCount        = (int)result.InlineCount.Value;

                viewNotifier.Show(L["One item found", Plural.From("{0} items found", totalItemsCount)], ViewNotifierType.Success, L["Operation Successful"]);
            }
            catch (Exception ex)
            {
                viewNotifier.Show(ex.GetBaseException().Message, ViewNotifierType.Error, L["Operation Failed"]);
            }
        }
コード例 #6
0
        protected async Task LoadLocalizationRecords(LocalizationRecordKey key)
        {
            if (key != null)
            {
                try
                {
                    if (currentKey != null)
                    {
                        currentKey.LocalizationRecords = null;
                    }

                    currentKey = key;
                    localizationApiClient.ClearEntitiesCache();
                    var result = await localizationApiClient.GetLocalizationRecords(key);

                    currentKey.LocalizationRecords = new List <LocalizationRecord>(result);

                    LocalizationCultures.Clear();

                    LocalizationCultures.AddRange(SupportedCultures
                                                  .Where(i => !currentKey.LocalizationRecords.Any(l => l.Culture == i)));

                    if (LocalizationCultures.Count > 0)
                    {
                        newLocalizationRecord = new LocalizationRecord()
                        {
                            ContextId = currentKey.ContextId, MsgId = currentKey.MsgId, Culture = LocalizationCultures[0]
                        }
                    }
                    ;

                    viewNotifier.Show(L["One item found", Plural.From("{0} items found", result.Count())], ViewNotifierType.Success, L["Operation Successful"]);
                }
                catch (Exception ex)
                {
                    viewNotifier.Show(ex.GetBaseException().Message, ViewNotifierType.Error, L["Operation Failed"]);
                }
            }

            StateHasChanged();
        }
コード例 #7
0
        protected async Task LoadLocalizationRecords(LocalizationRecordKey key)
        {
            if (key != null)
            {
                try
                {
                    currentKey = key;
                    localizationApiClient.ClearEntitiesCache();
                    var result = await localizationApiClient.GetLocalizationRecords(key);

                    localizationRecords = new List <LocalizationRecord>(result);

                    LocalizationCultures.Clear();

                    LocalizationCultures.AddRange(BlazorBoilerplate.Shared.Localizer.Settings.SupportedCultures
                                                  .Where(i => !localizationRecords.Any(l => l.Culture == i)));

                    if (LocalizationCultures.Count > 0)
                    {
                        newLocalizationRecord = new LocalizationRecord()
                        {
                            ContextId = currentKey.ContextId, MsgId = currentKey.MsgId, Culture = LocalizationCultures[0]
                        }
                    }
                    ;

                    matToaster.Add(L["One item found", Plural.From("{0} items found", result.Count())], MatToastType.Success, L["Operation Successful"]);
                }
                catch (Exception ex)
                {
                    matToaster.Add(ex.GetBaseException().Message, MatToastType.Danger, L["Operation Failed"]);
                }
            }
            else
            {
                localizationRecords = new List <LocalizationRecord>();
            }

            StateHasChanged();
        }
コード例 #8
0
        protected async Task LoadPluralFormRules()
        {
            PluralFormRules = new List <PluralFormRule>();

            try
            {
                localizationApiClient.ClearEntitiesCache();
                var result = await localizationApiClient.GetPluralFormRules();

                PluralFormRules = new List <PluralFormRule>(result);

                LocalizationCultures.Clear();

                LocalizationCultures.AddRange(BlazorBoilerplate.Shared.Localizer.Settings.SupportedCultures
                                              .Where(i => !PluralFormRules.Any(l => l.Language == i)));

                matToaster.Add(L["One item found", Plural.From("{0} items found", PluralFormRules.Count)], MatToastType.Success, L["Operation Successful"]);
            }
            catch (Exception ex)
            {
                matToaster.Add(ex.GetBaseException().Message, MatToastType.Danger, L["Operation Failed"]);
            }
        }
コード例 #9
0
        protected async Task LoadPluralFormRules()
        {
            PluralFormRules = new List <PluralFormRule>();

            try
            {
                localizationApiClient.ClearEntitiesCache();
                var result = await localizationApiClient.GetPluralFormRules();

                PluralFormRules = new List <PluralFormRule>(result);

                LocalizationCultures.Clear();

                LocalizationCultures.AddRange(SupportedCultures
                                              .Where(i => !PluralFormRules.Any(l => l.Language == i)));

                viewNotifier.Show(L["One item found", Plural.From("{0} items found", PluralFormRules.Count)], ViewNotifierType.Success, L["Operation Successful"]);
            }
            catch (Exception ex)
            {
                viewNotifier.Show(ex.GetBaseException().Message, ViewNotifierType.Error, L["Operation Failed"]);
            }
        }