|
@@ -2,6 +2,7 @@
|
|
using KdanCommon.Helpers;
|
|
using KdanCommon.Helpers;
|
|
using System;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
|
|
+using System.Globalization;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
using System.Net.NetworkInformation;
|
|
using System.Net.NetworkInformation;
|
|
using System.Text;
|
|
using System.Text;
|
|
@@ -23,6 +24,7 @@ namespace KdanCommon.CMSCollection
|
|
private List<ISetting> _settingList = null;
|
|
private List<ISetting> _settingList = null;
|
|
private HttpClient _httpClient = null;
|
|
private HttpClient _httpClient = null;
|
|
private Uri _windowsCardsUri = null;
|
|
private Uri _windowsCardsUri = null;
|
|
|
|
+ private Uri _windowsEventbarUri = null;
|
|
private Uri _pdfViewerEventBarSettingUri = null;
|
|
private Uri _pdfViewerEventBarSettingUri = null;
|
|
private Uri _pdfOtherSettingUri = null;
|
|
private Uri _pdfOtherSettingUri = null;
|
|
private string _appType = null;
|
|
private string _appType = null;
|
|
@@ -39,6 +41,7 @@ namespace KdanCommon.CMSCollection
|
|
_windowsCardsUri = new Uri($"{CMSDomain}/items/windows_cards");
|
|
_windowsCardsUri = new Uri($"{CMSDomain}/items/windows_cards");
|
|
_pdfViewerEventBarSettingUri = new Uri($"{CMSDomain}/items/pdf_remote_config");
|
|
_pdfViewerEventBarSettingUri = new Uri($"{CMSDomain}/items/pdf_remote_config");
|
|
_pdfOtherSettingUri = new Uri($"{CMSDomain}/items/PDF_UWP_RemoteConfig");
|
|
_pdfOtherSettingUri = new Uri($"{CMSDomain}/items/PDF_UWP_RemoteConfig");
|
|
|
|
+ _windowsEventbarUri = new Uri($"{CMSDomain}/items/windows_eventbar");
|
|
_appType = appType;
|
|
_appType = appType;
|
|
_loadCardsOnly = loadCardOnly;
|
|
_loadCardsOnly = loadCardOnly;
|
|
_settingList = new List<ISetting>();
|
|
_settingList = new List<ISetting>();
|
|
@@ -191,6 +194,37 @@ namespace KdanCommon.CMSCollection
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public async Task<List<WindowsEnentbarSetting>> GetWindowsEventbarAsync()
|
|
|
|
+ {
|
|
|
|
+ var current = DateTime.UtcNow.ToString("s", CultureInfo.GetCultureInfo("en-us"));
|
|
|
|
+ string region = GetSystemRegion();
|
|
|
|
+ string lang = GetAppLanguage();
|
|
|
|
+ var querys = new List<KeyValuePair<string, string>>();
|
|
|
|
+ querys.Add(new KeyValuePair<string, string>("deep[event_information][_filter][languages_code][_eq]", lang));
|
|
|
|
+ querys.Add(new KeyValuePair<string, string>("filter[_or][0][include_regions][_eq]", "true"));
|
|
|
|
+ querys.Add(new KeyValuePair<string, string>("filter[_or][0][regions][_contains]", region));
|
|
|
|
+ querys.Add(new KeyValuePair<string, string>("filter[_or][1][include_regions][_eq]", "false"));
|
|
|
|
+ querys.Add(new KeyValuePair<string, string>("filter[_or][1][regions][_ncontains]", region));
|
|
|
|
+ querys.Add(new KeyValuePair<string, string>("filter[_or][2][include_regions][_eq]", "false"));
|
|
|
|
+ querys.Add(new KeyValuePair<string, string>("filter[_or][2][regions][_null]", "true"));
|
|
|
|
+ querys.Add(new KeyValuePair<string, string>("filter[start][_lte]", current));
|
|
|
|
+ querys.Add(new KeyValuePair<string, string>("filter[end][_gte]", current));
|
|
|
|
+ querys.Add(new KeyValuePair<string, string>("filter[app_types][_contains]", _appType));
|
|
|
|
+ querys.Add(new KeyValuePair<string, string>("filter[status][_eq]", "published"));
|
|
|
|
+ querys.Add(new KeyValuePair<string, string>("fields", "*,event_information.*"));
|
|
|
|
+ var result = await _httpClient.GetRequest(_windowsEventbarUri, querys);
|
|
|
|
+ if (result.StatusCode == HttpStatusCode.Ok)
|
|
|
|
+ {
|
|
|
|
+ var jsonString = await result.Content.ReadAsStringAsync();
|
|
|
|
+ var response = JsonTool.DeserializeJSON<WindowsEventbarResponse>(jsonString);
|
|
|
|
+ if (response != null && response.Data != null && response.Data.Length > 0)
|
|
|
|
+ {
|
|
|
|
+ return response.Data.ToList();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
private string GetSystemRegion()
|
|
private string GetSystemRegion()
|
|
{
|
|
{
|
|
var geographyCountryCode = new GeographicRegion().CodeTwoLetter;
|
|
var geographyCountryCode = new GeographicRegion().CodeTwoLetter;
|