public void ProcessorScheduling() { //开始进程调度 while (ReadyList.Count > 0) { RunningProcess = ReadyList[0]; lock (ReadyList) { ReadyList.RemoveAt(0); } Prompt($"当前运行进程为{RunningProcess.Name}\n"); ReadyDraw(ReadyList); RunningDraw(RunningProcess); RunningProcess.Run(); //一段很不好的等待方法,很粗暴 DateTime now = DateTime.Now; DateTime end = now.AddSeconds(2); do { } while((DateTime.Now - end).Seconds < 0); if (RunningProcess.state == STATE.FINISH) { FinishedList.Add(RunningProcess); Prompt($"进程{RunningProcess.Name}运行结束\n"); RunningProcess = null; FinishedDraw(FinishedList); RunningDraw(RunningProcess); } else { lock (ReadyList) { ReadyList.Add(RunningProcess); ReadyList = SortListByPriority(ReadyList); } Prompt($"进程{RunningProcess.Name}重新插入到就绪队列\n"); Prompt($"当前优先数为{RunningProcess.priority},剩余运行时间为{RunningProcess.requestTime}\n"); RunningProcess = null; ReadyDraw(ReadyList); RunningDraw(RunningProcess); } //一段很不好的等待方法,很粗暴 now = DateTime.Now; end = now.AddSeconds(2); do { } while((DateTime.Now - end).Seconds < 0); } Prompt("就绪队列为空,所有进程运行结束\n"); }
private async void Page_Loaded(object sender, RoutedEventArgs e) { Global.gamesLists = await API.getGamesFromLocalDatabase(); // using Windows.UI.ViewManagement; Windows.ApplicationModel.Core.CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = false; var titleBar = ApplicationView.GetForCurrentView().TitleBar; // Set active window colors titleBar.ForegroundColor = Windows.UI.Colors.White; titleBar.BackgroundColor = Windows.UI.Colors.Black; titleBar.ButtonForegroundColor = Windows.UI.Colors.White; titleBar.ButtonBackgroundColor = Windows.UI.Colors.Black; titleBar.ButtonHoverForegroundColor = Windows.UI.Colors.White; titleBar.ButtonHoverBackgroundColor = Windows.UI.Colors.DodgerBlue; titleBar.ButtonPressedForegroundColor = Windows.UI.Colors.Gray; titleBar.ButtonPressedBackgroundColor = Windows.UI.Colors.DarkBlue; // Set inactive window colors titleBar.InactiveForegroundColor = Windows.UI.Colors.Gray; titleBar.InactiveBackgroundColor = Windows.UI.Colors.Black; titleBar.ButtonInactiveForegroundColor = Windows.UI.Colors.Gray; titleBar.ButtonInactiveBackgroundColor = Windows.UI.Colors.Black; // Set appropriate list types Wishlist.setFilter(new GameFilter(Global.ListType.WishList)); Wishlist.List.addGames(Global.gamesLists.Find(x => x.Filter.listType.Equals(Global.ListType.WishList))); PlayingList.setFilter(new GameFilter(Global.ListType.PlayingList)); PlayingList.List.addGames(Global.gamesLists.Find(x => x.Filter.listType.Equals(Global.ListType.PlayingList))); FinishedList.setFilter(new GameFilter(Global.ListType.FinishedList)); FinishedList.List.addGames(Global.gamesLists.Find(x => x.Filter.listType.Equals(Global.ListType.FinishedList))); Wishlist.updateList(); PlayingList.updateList(); FinishedList.updateList(); }