private DisplayCollection _GetAttachedDisplays() { DisplayCollection attachedDisplays = new DisplayCollection(); List <MonitorHandle> monitorHandles = _EnumerateAllMonitors(); foreach (MonitorHandle handle in monitorHandles) { List <PhysicalMonitorDesc> physicalMonitors = _GetPhysicalMonitors(handle); foreach (PhysicalMonitorDesc physicalMonitor in physicalMonitors) { /*get the capabilities and supported color temperature of each display*/ uint capabilitiesFlags = 0, colorTempFlags = 0; _QueryMonitorCapabilities(physicalMonitor, out capabilitiesFlags, out colorTempFlags); /*get the min, max, and current brightness from the display*/ uint maxBrightness = 0, minBrightness = 0, currentBrightness = 0; _QueryMonitorBrightnessInfo(physicalMonitor, out minBrightness, out maxBrightness, out currentBrightness); lock ( m_displayListLock ) { attachedDisplays.Add(new Display(physicalMonitor, minBrightness, maxBrightness, currentBrightness, capabilitiesFlags, colorTempFlags)); } } } return(attachedDisplays); }
private async void TypeSelectedItemChanged(string type) { if (type == "喜欢" && likePage != 0) { DisplayCollection.Clear(); likeList.ForEach(x => DisplayCollection.Add(x)); } else if (type == "收藏" && markPage != 0) { DisplayCollection.Clear(); markList.ForEach(x => DisplayCollection.Add(x)); } else { await QueryNote(type); } }
private async Task QueryNote(string type) { UserContentProvider user = new UserContentProvider(); if (type == "喜欢") { if (likePage == 0) { DisplayCollection = new ObservableCollection <NoteItem>(); likeList = new List <NoteItem>(); } List <Note> temp = await user.QueryLikeNotes(likePage, GlobalValue.CurrentUserContext.UserId, GlobalValue.CurrentUserContext.MobileToken); temp.ForEach(x => { var v = ConvertToNoteItem(x); likeList.Add(v); DisplayCollection.Add(v); }); likePage++; } else { if (markPage == 0) { DisplayCollection = new ObservableCollection <NoteItem>(); markList = new List <NoteItem>(); } List <BookmarkResult> temp = await user.QueryBookmark(markPage, GlobalValue.CurrentUserContext.UserId, GlobalValue.CurrentUserContext.MobileToken); temp.ForEach(x => { var v = ConvertToNoteItem(x.Note); markList.Add(v); DisplayCollection.Add(v); }); } }