public static void Init() { // Load config file GraphicsConfiguration graphicsConfig = new GraphicsConfiguration(); Configuration config = graphicsConfig.LoadConfiguration(); // Declare variables to correct Resolution resolution = config.Resolution; RefreshRate refreshRate = config.RefreshRate; GraphicsAdapter adapter; // Load existing adapters List <GraphicsAdapter> adapters = DevicesHandler.GetGraphicsAdapters(); // Find corresponding monitor ID adapter = FindAdapter(adapters, config); if (adapter == null) { // Unable to find adapter, use the default one adapter = adapters[0]; resolution = adapter.Resolutions[0]; refreshRate = resolution.RefreshRates[0]; } // Change config config.GraphicsAdapter = adapter; config.Resolution = resolution; config.RefreshRate = refreshRate; // Re-save graphicsConfig.SaveConfiguration(config); }
public async static void Reload() { if (_deviceEntity == null) { _deviceEntity = DevicesHandler.GetDeviceEntity(); if (_deviceEntity == null) { return; } } try { var ctx = await RemoteDatabase.GetDbContextAsync(); // Get all users who have accesses on this device, and Administrators. Include Fingerprints to the request, as they're needed by FPReaderHandle. //Cache = ctx.GrantedUsers.Where(gu => gu.GrantedAccesses.Any(ga => ga.DeviceId == _deviceEntity.DeviceId) || gu.UserRank.Rank == UserRank.Administrator).Include(gu => gu.Fingerprints).ToList(); Cache = ctx.GrantedUsers.Include(gu => gu.Fingerprints).ToList(); ctx.Database.Connection.Close(); ctx.Dispose(); } catch (Exception error) { ExceptionMessageBox exp = new ExceptionMessageBox(error, "Unable to get data from local DB [Users Cache]"); exp.ShowDialog(); } }
public JsonInventory getCurrentInventory() { try { List <TagInfo> lstTag = new List <TagInfo>(); for (int loop = 1; loop <= DevicesHandler.NbDrawer; loop++) { List <string> TmpListCtrlPerDrawer = new List <string>(DevicesHandler.GetTagFromDictionnary(loop, DevicesHandler.ListTagPerDrawer)); List <string> TmpListCtrlPerDrawerAdded = new List <string>(DevicesHandler.GetTagFromDictionnary(loop, DevicesHandler.ListTagAddedPerDrawer)); List <string> TmpListCtrlPerDrawerRemoved = new List <string>(DevicesHandler.GetTagFromDictionnary(loop, DevicesHandler.ListTagRemovedPerDrawer)); foreach (string uid in TmpListCtrlPerDrawerAdded) { if (TmpListCtrlPerDrawer.Contains(uid)) { TmpListCtrlPerDrawer.Remove(uid); } lstTag.Add(new TagInfo() { tagUID = uid, DrawerId = loop, Movement = 1, }); } foreach (string uid in TmpListCtrlPerDrawer) { lstTag.Add(new TagInfo() { tagUID = uid, DrawerId = loop, Movement = 0, }); } foreach (string uid in TmpListCtrlPerDrawerRemoved) { lstTag.Add(new TagInfo() { tagUID = uid, DrawerId = loop, Movement = -1, }); } } JsonInventory ji = new JsonInventory(); ji.listOfTags = lstTag.ToArray(); ji.Status = "Success"; return(ji); } catch (Exception exp) { JsonInventory ret = new JsonInventory(); ret.Status = "Failed"; ret.Reason = "Exception : " + exp.InnerException + " - " + exp.Message; ret.listOfTags = null; return(ret); } }
public void SetUp() { SetUpParsedData(); SetUpVariables(); SetUpFilePathBuilder(); SetUpDeviceDataBuilder(); SetUpBlobClientProvider(); SetUpZipArchiveProvider(); SetUpParsers(); _sut = new DevicesHandler(_parserProvider, _filePathBuilder, _blobClientProvider, _zipArchiveProvider, _deviceDataBuilder); }