public DeviceRoleViewModel(DeviceRole deviceRole) { SaveCmd = new RelayCommand(Save); CancelCmd = new RelayCommand(() => Close("")); ViewModelAttachment = new ViewModelAttachment <DeviceRole>(); var dtos = AuthorizationDevices.Select(x => new ListBoxItem { ID = x.DeviceID, DisplayName = x.Name, IsSelected = deviceRole.HasDeviceAuthorization(x.DeviceID) }); DeviceDtos = new ObservableCollection <SelectableItem>(dtos); CurrentDeviceRole = deviceRole; if (deviceRole.DeviceRoleID != 0) { Name = deviceRole.RoleName; if (deviceRole.DeviceRolePermissions.Any()) { var firstPermission = deviceRole.DeviceRolePermissions.First(); SelectedTimezone = Timezones.FirstOrDefault(x => x.TimeZoneID == firstPermission.AllowedAccessTimeZoneID); SelectedPermissionAction = (int)firstPermission.PermissionAction; } } else { SelectedTimezone = Timezones.FirstOrDefault(); SelectedPermissionAction = PermissionActionDict.FirstOrDefault().ItemID.Value; } Title = (deviceRole.DeviceRoleID == 0) ? "新增设备角色" : "修改设备角色"; }
/// <summary> /// Initializes a new instance of the <see cref="CakeMailRestClient"/> class. /// </summary> /// <param name="apiKey">The API Key received from CakeMail</param> /// <param name="host">The host where the API is hosted. The default is api.wbsrvc.com</param> /// <param name="httpClient">Allows you to inject your own HttpClient. This is useful, for example, to setup the HtppClient with a proxy</param> public CakeMailRestClient(string apiKey, string host = DEFAULT_HOST, HttpClient httpClient = null) { _mustDisposeHttpClient = httpClient == null; _httpClient = httpClient; ApiKey = apiKey; BaseUrl = new Uri($"https://{host.TrimEnd('/')}/"); Version = typeof(CakeMailRestClient).GetTypeInfo().Assembly.GetName().Version.ToString(); UserAgent = $"CakeMail .NET REST Client/{Version} (+https://github.com/Jericho/CakeMail.RestClient)"; _fluentClient = new FluentClient(this.BaseUrl, httpClient) .SetUserAgent(this.UserAgent); _fluentClient.BaseClient.DefaultRequestHeaders.Add("apikey", this.ApiKey); _fluentClient.Filters.Remove <DefaultErrorFilter>(); _fluentClient.Filters.Add(new DiagnosticHandler()); _fluentClient.Filters.Add(new CakeMailErrorHandler()); Campaigns = new Campaigns(_fluentClient); Clients = new Clients(_fluentClient); Countries = new Countries(_fluentClient); Permissions = new Permissions(_fluentClient); Lists = new Lists(_fluentClient); Timezones = new Timezones(_fluentClient); Mailings = new Mailings(_fluentClient); Relays = new Relays(_fluentClient); Segments = new Segments(_fluentClient); Users = new Users(_fluentClient); SuppressionLists = new SuppressionLists(_fluentClient); Templates = new Templates(_fluentClient); Triggers = new Triggers(_fluentClient); }
/// <summary> /// FindAsync movies, people and tv shows by an external id. /// The following trypes can be found based on the specified external id's /// - Movies: Imdb /// - People: Imdb, FreeBaseMid, FreeBaseId, TvRage /// - TV Series: Imdb, FreeBaseMid, FreeBaseId, TvRage, TvDb /// </summary> /// <param name="source">The source the specified id belongs to</param> /// <param name="id">The id of the object you wish to located</param> /// <returns>A list of all objects in TMDb that matched your id</returns> public async Task <Timezones> GetTimezonesAsync() { RestRequest req = _client.Create("timezones/list"); RestResponse <List <Dictionary <string, List <string> > > > resp = await req.ExecuteGet <List <Dictionary <string, List <string> > > >().ConfigureAwait(false); List <Dictionary <string, List <string> > > item = await resp.GetDataObject().ConfigureAwait(false); if (item == null) { return(null); } Timezones result = new Timezones(); result.List = new Dictionary <string, List <string> >(); foreach (Dictionary <string, List <string> > dictionary in item) { KeyValuePair <string, List <string> > item1 = dictionary.First(); result.List[item1.Key] = item1.Value; } return(result); }
public async Task TestTimezonesListAsync() { Timezones result = await TMDbClient.GetTimezonesAsync(); Assert.NotEmpty(result.List); List <string> single = result.List["DK"]; await Verify(single); }
public void TestTimezonesList() { Timezones result = Config.Client.GetTimezonesAsync().Sync(); Assert.NotNull(result); Assert.True(result.List.Count > 200); List <string> item = result.List["DK"]; Assert.NotNull(item); Assert.Equal(1, item.Count); Assert.Equal("Europe/Copenhagen", item[0]); }
public void TestTimezonesList() { Timezones result = _config.Client.GetTimezones().Result; Assert.IsNotNull(result); Assert.IsTrue(result.List.Count > 200); List <string> item = result.List["DK"]; Assert.IsNotNull(item); Assert.AreEqual(1, item.Count); Assert.AreEqual("Europe/Copenhagen", item[0]); }
/// <summary> /// Find movies, people and tv shows by an external id. /// The following trypes can be found based on the specified external id's /// - Movies: Imdb /// - People: Imdb, FreeBaseMid, FreeBaseId, TvRage /// - TV Series: Imdb, FreeBaseMid, FreeBaseId, TvRage, TvDb /// </summary> /// <param name="source">The source the specified id belongs to</param> /// <param name="id">The id of the object you wish to located</param> /// <returns>A list of all objects in TMDb that matched your id</returns> public async Task <Timezones> GetTimezones() { RestRequest req = new RestRequest("timezones/list"); IRestResponse <List <Dictionary <string, List <string> > > > resp = await _client.ExecuteGetTaskAsync <List <Dictionary <string, List <string> > > >(req).ConfigureAwait(false); if (resp.Data == null) { return(null); } Timezones result = new Timezones(); result.List = new Dictionary <string, List <string> >(); foreach (Dictionary <string, List <string> > dictionary in resp.Data) { KeyValuePair <string, List <string> > item1 = dictionary.First(); result.List[item1.Key] = item1.Value; } return(result); }
/// <summary> /// Find movies, people and tv shows by an external id. /// The following trypes can be found based on the specified external id's /// - Movies: Imdb /// - People: Imdb, FreeBaseMid, FreeBaseId, TvRage /// - TV Series: Imdb, FreeBaseMid, FreeBaseId, TvRage, TvDb /// </summary> /// <param name="source">The source the specified id belongs to</param> /// <param name="id">The id of the object you wish to located</param> /// <returns>A list of all objects in TMDb that matched your id</returns> public Timezones GetTimezones() { RestRequest req = new RestRequest("timezones/list"); IRestResponse <List <Dictionary <string, List <string> > > > resp = _client.Get <List <Dictionary <string, List <string> > > >(req); if (resp.Data == null) { return(null); } Timezones result = new Timezones(); result.List = new Dictionary <string, List <string> >(); foreach (Dictionary <string, List <string> > dictionary in resp.Data) { KeyValuePair <string, List <string> > item1 = dictionary.First(); result.List[item1.Key] = item1.Value; } return(result); }
public DefaultTimezoneAttribute(Timezones Timezone) { this.Timezone = Timezone; }
public static void date_default_timezone_set(Timezones timezone) { }