Here we are building an desktop app. That perform Multiple Basic computer operations.
MAIN PAGE
So, this desktop app allows you to perform following actions:
You can access following things via this app.
- Notepad
- Paint
- Calculator
- Task manager
- Ms. Word
- Excel
- Media Player
- Sound Recorder
- Notepad
Explaining Main Page View.
This Main page contain 10 buttons a simple text and a image is placed on button to explain its functionality.
What the app can done?
Whenever you click on a button this app can check weather the requesting app exists on your system or not. if exists than it can open the app for you otherwise a message box is displayed that "File Not Found"
Main Page CODE
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace MultitaskingApp { public partial class MainPage : Form { public MainPage() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { try { System.Diagnostics.Process.Start("notepad"); } catch (Exception Ex) { MessageBox.Show("File Not Found \n \n \n" + Ex); } } private void button2_Click(object sender, EventArgs e) { try { System.Diagnostics.Process.Start("mspaint"); } catch (Exception Ex) { MessageBox.Show("File Not Found \n \n \n" + Ex); } } private void button3_Click(object sender, EventArgs e) { try { System.Diagnostics.Process.Start("calc"); } catch (Exception Ex) { MessageBox.Show("File Not Found \n \n \n" + Ex); } } private void button4_Click(object sender, EventArgs e) { try { System.Diagnostics.Process.Start("Taskmgr"); } catch (Exception Ex) { MessageBox.Show("File Not Found \n \n \n" + Ex); } } private void button5_Click(object sender, EventArgs e) { try { System.Diagnostics.Process.Start("winword"); } catch (Exception Ex) { MessageBox.Show("File Not Found \n \n \n" + Ex); } } private void button6_Click(object sender, EventArgs e) { try { System.Diagnostics.Process.Start("Excel"); } catch (Exception Ex) { MessageBox.Show("File Not Found \n \n \n" + Ex); } } private void button7_Click(object sender, EventArgs e) { try { System.Diagnostics.Process.Start("wmplayer"); } catch (Exception Ex) { MessageBox.Show("File Not Found \n \n \n" + Ex); } } private void button8_Click(object sender, EventArgs e) { try { System.Diagnostics.Process.Start("psr"); } catch (Exception Ex) { MessageBox.Show("File Not Found \n \n \n" + Ex); } } private void button9_Click(object sender, EventArgs e) { try { System.Diagnostics.Process.Start("wordpad"); } catch (Exception Ex) { MessageBox.Show("File Not Found \n \n \n" + Ex); } } private void MainPage_Load(object sender, EventArgs e) { } private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { MessageBox.Show("Umair hassan"); } private void exitToolStripMenuItem_Click(object sender, EventArgs e) { Application.Exit(); } } }
Explaining Code
Every Button contain a try catch block like this
try { System.Diagnostics.Process.Start("wordpad"); } catch (Exception Ex) { MessageBox.Show("File Not Found \n \n \n" + Ex); } }
Firstly try block execute and if requesting app exists than it start the process
otherwise catch block is executed that shows a message box "File Not Found"
Screen also contain a MenuStrip contain About and Exit.
By clicking on about .. Author Name is displayed.
By clicking on Exit .. Application.Exit(); Function calls.
No comments:
Post a Comment