Instructions for creating The Client GUI for Project 4


Step1
Open Visual Studio .NET. From the File Menu select New->Project. Select Visual C# Projects 
from Project Types. Select Windows Application from Templates. Give the name for the 
application say "ComponentClient". Change the location where you want to save the project. 
Click OK.

Step2
Select the Form in the Design mode and Change its following properties. In case you don't 
see your property window. Press F4.

Text:Client - Component Library
Name:Client
Size:824, 544
Open the Source code replace Form1 to Client in Main

Step3
Select Form1.cs from the solution explorer rename it to ComponentClient.cs from the 
properties window.

Step4
Add Three Group Boxes.
In the First Group Box add 1 Button, TextBox and a Progress Bar and a Label.
In the second Group box add 3 Radio Buttons and a Button.
In the third Group Box add a TextBox and 2 Buttons.
Add 4 Labels, 4 List Boxes and a status Bar.
Arrange the components as shown in the figure


Step5
Change the properties of the components as follows:

groupBox1:
Text:Extract Selected Component

groupBox2:
Text:Create Component

groupBox3:
Text:Add File

button1:
Name:btnExtract
Text:Extract
Size:104, 24

label1:
Name:lblDestination
Text:DEstination
Font:Size=10, Font Style=Bold
AutoSize=True
Size:200, 24

textBox1:
Name:txtDestination
Text:"blank"
Size:216, 20

progressBar1:
Name:progressExtract
Size:136,24

button2:
Name:btnCreate
Text:Create
Size:80, 24

radioButton1:
Name:rdSys
Text:Sys
Size:48, 16
Checked:True

radioButton2:
Name:rdPrg
Text:Prg
Size:48, 16

radioButton3:
Name:rdMod
Text:Mod
Size:48, 16

textBox2:
Name:txtFile
Text:"blank"
Size:168,20

button3:
Name:btnBrowse
Text:Browse
Size:64, 24

button4:
Name:btnAdd
Text:Add
Size:64, 24

label2:
Text:Systems
Size:192, 24
BorderStyle:Fixed3D
TextAlign:MiddleCenter

label2:
Text:Programs
Size:192, 24
BorderStyle:Fixed3D
TextAlign:MiddleCenter

label2:
Text:Modules
Size:192, 24
BorderStyle:Fixed3D
TextAlign:MiddleCenter

label2:
Text:Files
Size:192, 24
BorderStyle:Fixed3D
TextAlign:MiddleCenter

listBox1:
Name:lstsystems
Size:192, 342

listBox1:
Name:lstprograms
Size:192, 342

listBox1:
Name:lstmodules
Size:192, 342

listBox1:
Name:lstfiles
Size:192, 342
SelectionMode:MultiSimple

statusBar1:
Name:statusbar
Text:Status

Compile and Run. The Application will look like this:




Step6
If you want you can add another button to the right of txtDestination for Folder 
Browse.(optional)
Add SHBrowser.cs to your project.
Go to Project Settings->Configuration Properties->Build
Select Allow Unsafe Code Block to true

Step7
Change the following functions in the Code

private void btnBrowse_Click(object sender, System.EventArgs e)
{
OpenFileDialog f=new OpenFileDialog();
if(f.ShowDialog(this)==DialogResult.OK)
{
txtFile.Text=f.FileName;
}
}

private void btnFolder_Click(object sender, System.EventArgs e)
{
SHBrowser browser=new SHBrowser();
string path=browser.DoBrowse("Select the Folder for Destination");
txtDestination.Text=path;
}

private void btnAdd_Click(object sender, System.EventArgs e)
{
if(txtFile.Text!="") lstfiles.Items.Add(txtFile.Text);
}

Step8
Add your code according to your need.

Hope this helps.

Download the Project