操作系統(tǒng)課程設(shè)計(jì)_第1頁
操作系統(tǒng)課程設(shè)計(jì)_第2頁
操作系統(tǒng)課程設(shè)計(jì)_第3頁
操作系統(tǒng)課程設(shè)計(jì)_第4頁
操作系統(tǒng)課程設(shè)計(jì)_第5頁
已閱讀5頁,還剩24頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、操作系統(tǒng)(co zu x tn)課程設(shè)計(jì)Windows系統(tǒng)資源管理器與任務(wù)(rn wu)管理器小組成員:計(jì)科4班 趙偉 20115334計(jì)科4班 王勇博 20115332計(jì)科4班 尹春梅 20115323共二十九頁Windows任務(wù)(rn wu)管理器功能模塊共二十九頁Windows任務(wù)(rn wu)管理器功能流程圖共二十九頁功能實(shí)現(xiàn)(shxin)代碼(部分)菜單欄: this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem this.mnuFile, this.選項(xiàng)ToolStripMenuItem, this

2、.窗口(chungku)ToolStripMenuItem, this.mnuAbout); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = menuStrip1; this.menuStrip1.Size = new System.Drawing.Size(556, 25); this.menuStrip1.TabIndex = 0; this.menuStrip1.Text = menuStrip1; / / 窗口ToolStripMenuItem / this.窗口Tool

3、StripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem 共二十九頁this.最大化ToolStripMenuItem, this.最小化ToolStripMenuItem, this.前置(qin zh)ToolStripMenuItem1); this.窗口ToolStripMenuItem.Name = 窗口ToolStripMenuItem; this.窗口ToolStripMenuItem.Size = new System.Drawing.Size(44, 21); this.窗口Tool

4、StripMenuItem.Text = 窗口; / / 最大化ToolStripMenuItem / this.最大化ToolStripMenuItem.Name = 最大化ToolStripMenuItem; this.最大化ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.最大化ToolStripMenuItem.Text = 最大化; this.最大化ToolStripMenuItem.Click += new System.EventHandler(this.最大化ToolStripMenuItem_Cli

5、ck); / / 最小化ToolStripMenuItem / 共二十九頁this.最小化ToolStripMenuItem.Name = 最小化ToolStripMenuItem; this.最小化ToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.最小化ToolStripMenuItem.Text = 最小化; this.最小化ToolStripMenuItem.Click += new System.EventHandler(this.最小化ToolStripMenuItem_Click); / / 前置(qin

6、 zh)ToolStripMenuItem1 / this.前置ToolStripMenuItem1.Name = 前置ToolStripMenuItem1; this.前置ToolStripMenuItem1.Size = new System.Drawing.Size(152, 22); this.前置ToolStripMenuItem1.Text = 前置; this.前置ToolStripMenuItem1.Click += new System.EventHandler(this.前置ToolStripMenuItem1_Click);共二十九頁 右鍵菜單欄: this.contex

7、tMenuStrip4.Items.AddRange(new System.Windows.Forms.ToolStripItem this.前置ToolStripMenuItem, this.切換至ToolStripMenuItem, this.轉(zhuǎn)到進(jìn)程ToolStripMenuItem1); this.contextMenuStrip4.Name = contextMenuStrip4; this.contextMenuStrip4.Size = new System.Drawing.Size(125, 70);應(yīng)用程序管理: private void btReApp_Click(obje

8、ct sender, EventArgs e) LvApp.Items.Clear(); List Apps = SystemInfo.FindAllApps(this.Handle.ToInt32(); /獲得系統(tǒng)(xtng)中的當(dāng)前應(yīng)用程序 foreach (AppInfo app in Apps) ListViewItem item = new ListViewItem(app.appName); item.SubItems.Add(app.appStatus); LvApp.Items.Add(item); 共二十九頁進(jìn)程管理(gunl): private void tmrProces

9、s_Tick(object sender, EventArgs e) int oldWorkingSet = 0; /記錄進(jìn)程舊的內(nèi)存大小 int oldTimePercent = 0; /記錄進(jìn)程舊的CPU百分比 int newTimePercent = 0; int lvProcessCount = LvC.Items.Count; TimeSpan ts = (TimeSpan)(DateTime.Now - lastSysTime); double sysTimeSpan = ts.TotalMilliseconds; Hashtable htProcess = new Hashtab

10、le(); /進(jìn)程哈希表 List pInfo = sInfo.GetProcessInfo(); for (int i = 0; i 0 ? LvC.FindItemWithText(pInfoi.ProcessID.ToString(), false, 0, false) : null;共二十九頁 if (item != null) /找到節(jié)點(diǎn)(ji din)則更新 #region 計(jì)算cpu占用率 double processorTimeSpan = (double)Math.Abs(pInfoi.ProcessorTime - (double)item.Tag); if (sysTim

11、eSpan != 0) processorTimeSpan = processorTimeSpan / sysTimeSpan; newTimePercent = (int)(processorTimeSpan * 100 / sInfo.ProcessorCount); /if (newTimePercent 100 | newTimePercent 0) / / newTimePercent = 0; / if (newTimePercent = 100) newTimePercent = 99; 共二十九頁else newTimePercent = 0; #endregion /緩沖(h

12、unchng),沒有改變的數(shù)值不更新,避免界面閃爍 oldTimePercent = int.Parse(item.SubItems2.Text); if (newTimePercent != oldTimePercent) item.SubItems2.Text = string.Format(0:00, newTimePercent); oldWorkingSet = int.Parse(item.SubItems3.Text); if (pInfoi.WorkingSet != oldWorkingSet) item.SubItems3.Text = pInfoi.WorkingSet.

13、ToString(); item.Tag = pInfoi.ProcessorTime; 共二十九頁 else /否則添加(tin ji)節(jié)點(diǎn) item = new ListViewItem(pInfoi.ProcessID.ToString(); item.SubItems.Add(pInfoi.ProcessName); item.SubItems.Add(string.Format(0:00, 0); item.SubItems.Add(pInfoi.WorkingSet.ToString(); item.SubItems.Add(pInfoi.ProcessPath); item.Ta

14、g = pInfoi.ProcessorTime; LvC.Items.Add(item); /add 共二十九頁程序運(yùn)行結(jié)果(ji gu)基本(jbn)界面共二十九頁進(jìn)程(jnchng)狀態(tài)查看共二十九頁CPU狀態(tài)(zhungti)等性能查看共二十九頁Windows資源管理器模塊(m kui)共二十九頁Windows資源管理器功能(gngnng)流程圖共二十九頁功能實(shí)現(xiàn)代碼(di m)(部分)菜單欄: this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem this.文件(wnjin)ToolStripMen

15、uItem, this.編輯ToolStripMenuItem, this.查看ToolStripMenuItem, this.工具TToolStripMenuItem, this.幫助ToolStripMenuItem); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = menuStrip1; this.menuStrip1.Size = new System.Drawing.Size(739, 25); this.menuStrip1.TabIndex = 0; this.m

16、enuStrip1.Text = menuStrip1;共二十九頁右鍵菜單: this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem this.打開ToolStripMenuItem1, this.查看(chkn)ToolStripMenuItem1, this.刷新ToolStripMenuItem1, this.toolStripMenuItem3, this.剪切ToolStripMenuItem2, this.復(fù)制ToolStripMenuItem2, this.刪除ToolStripMe

17、nuItem2, this.粘貼ToolStripMenuItem1, this.新建文件夾ToolStripMenuItem, this.toolStripMenuItem4, this.屬性ToolStripMenuItem1, this.全部選定ToolStripMenuItem1); this.contextMenuStrip1.Name = contextMenuStrip1; this.contextMenuStrip1.Size = new System.Drawing.Size(101, 236); this.contextMenuStrip1.Opening += new S

18、ystem.ComponentModel.CancelEventHandler(this.contextMenuStrip1_Opening);共二十九頁圖標(biāo)工具欄圖標(biāo): this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButton1.Image = (System.Drawing.Image)(resources.GetObject(toolStripButton1.Image); this.toolStripButton2.Dis

19、playStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButton2.Image = (System.Drawing.Image)(resources.GetObject(toolStripButton2.Image); this.toolStripButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButton3.Image = (System.Drawing

20、.Image)(resources.GetObject(toolStripButton3.Image); this.toolStripButton4.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.toolStripButton4.Image = (System.Drawing.Image)(resources.GetObject(toolStripButton4.Image);共二十九頁圖標(biāo)列表(li bio)圖標(biāo): /列出文件 foreach (FileInfo file in files)

21、 ListViewItem fileItem = listView1.Items.Add(file.Name); if (file.Extension = .exe | file.Extension = ) /程序文件或無擴(kuò)展名Icon fileIcon = GetSystemIcon.GetIconByFileName(file.FullName); imageList2.Images.Add(file.Name, fileIcon); imageList3.Images.Add(file.Name, fileIcon); fileItem.ImageKey = file.Name; els

22、e /其它文件if (!imageList2.Images.ContainsKey(file.Extension) /ImageList中不存在此類圖標(biāo)Icon fileIcon = GetSystemIcon.GetIconByFileName(file.FullName); imageList2.Images.Add(file.Extension, fileIcon); imageList3.Images.Add(file.Extension, fileIcon); fileItem.ImageKey = file.Extension; 共二十九頁新建文本文檔 private void C

23、reatText() try string path = Path.Combine(currentPath, 新建文本文檔 .txt); int i = 1; string newPath = path; while (File.Exists(newPath) newPath = newPath.Replace(newPath.Substring(newPath.Length - 5), 1), i.ToString(); i+; StreamWriter sw = File.CreateText(newPath); ListUpdate(currentPath); catch (Except

24、ion ee) MessageBox.Show(ee.Message.ToString(); 共二十九頁新建Microsoft Word文檔 private void CreatMicword() try string path = Path.Combine(currentPath, 新建Microsoft Word文檔 .doc); int i = 1; string newPath = path; while (File.Exists(newPath) newPath = newPath.Replace(newPath.Substring(newPath.Length - 5), 1),

25、i.ToString(); i+; StreamWriter sw = File.CreateText(newPath); ListUpdate(currentPath); catch (Exception ee) MessageBox.Show(ee.Message.ToString(); 共二十九頁復(fù)制(fzh) private void Copy() if (listView1.SelectedItems.Count = 0) return; sources = new string100;/源文件,用于黏貼 int i = 0; foreach (ListViewItem item i

26、n listView1.SelectedItems) sourcesi+ = item.Name; IsMove = false; 共二十九頁粘貼 private void Paste() if (sources0 = null) /無源文件則返回(fnhu) return; if (!Directory.Exists(currentPath) /當(dāng)前路徑無效則返回 return; for (int i = 0; sourcesi != null; i+) if (File.Exists(sourcesi) /文件 CopyFile(sourcesi); else if (Directory.Exists(sourcesi) /目錄 CopyDirecto

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論