Manual Tecnico

72
MANUAL TÉCNICO Simulación del SO FreeBSD AUTORES: CRUZ DEPAZ, Edwin Santiago OCHOA LUIS, Renzo TORERO FARRO, Paulo REYES SUAREZ, Jorge BUSTAMANTE LINO, Omar LINO QUICHE, Javier DOCENTE: Ing. Carlos Orlando Claros Vásquez VIII CICLO - 2012 ING. DE SISTEMAS

Transcript of Manual Tecnico

Page 1: Manual Tecnico

ING. DE SISTEMAS

MANUAL TÉCNICOSimulación del SO FreeBSD

AUTORES: CRUZ DEPAZ, Edwin Santiago OCHOA LUIS, Renzo TORERO FARRO, Paulo REYES SUAREZ, Jorge BUSTAMANTE LINO, Omar LINO QUICHE, Javier

DOCENTE:Ing. Carlos Orlando Claros VásquezVIII CICLO - 2012

Page 2: Manual Tecnico

[ ] Simulacion FreeBSD

Manual Técnico

Splash

2

Page 3: Manual Tecnico

[ ] Simulacion FreeBSD

Splash.resx:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;

namespace Simulador_SistemaOperativo{ public partial class Splash : Form { int count = 0; public Splash() { InitializeComponent();

} const int WS_CAPTION = 0xC00000; protected override CreateParams CreateParams { get { CreateParams p = base.CreateParams; p.Style &= ~WS_CAPTION; return p; } }

private void Splash_Load(object sender, EventArgs e) { Timer tiempo = new Timer(); tiempo.Interval = 1000; tiempo.Tick += new EventHandler(timer1_Tick); tiempo.Enabled = true; }

private void timer1_Tick(object sender, EventArgs e) { count++; //MessageBox.Show(count + ""); if (count == 20) { //MessageBox.Show("Llego a esta parte de codigo...."); // this.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.Close(); } //if(count==27) // this.DialogResult = System.Windows.Forms.DialogResult.Cancel; // MessageBox.Show("hola"); }

private void progressBar1_Click(object sender, EventArgs e) } }

3

Page 4: Manual Tecnico

[ ] Simulacion FreeBSD

Usuario

4

Page 5: Manual Tecnico

[ ] Simulacion FreeBSD

Usuario.resx:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.IO;using System.Windows.Forms;

namespace Simulador_SistemaOperativo{ public partial class usuarios : Form { int cs = 0; //cantidad de veces k se reproduce el sonido public static bool shutdown = false; // nos indica el estado de finalizaion de la aplicacion

String password; System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(usuarios)); System.Media.SoundPlayer sonido = new System.Media.SoundPlayer(); String url_sonido = Path.GetFullPath(@"Sonido_Inicio.wav"); String url_error = Path.GetFullPath(@"dialog-error.wav"); String url_question = Path.GetFullPath(@"dialog-question.wav"); String url_logout = Path.GetFullPath(@"dialog-error.wav");

public usuarios() { InitializeComponent(); this.Load += new EventHandler(usuarios_Load); //sonido.SoundLocation = url_sonido; //sonido.Play(); }

private void label1_Click(object sender, EventArgs e) {

} private void usuarios_Load(object sender, EventArgs e) { //sonido.SoundLocation = url_sonido; //sonido.Play(); splash(); }

private void splash() { using (Splash obj = new Splash())

5

Page 6: Manual Tecnico

[ ] Simulacion FreeBSD

{ if (obj.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) { // MessageBox.Show("Llego.."); this.WindowState = FormWindowState.Maximized; //this.Close(); } } }

const int WS_CAPTION = 0xC00000;

protected override CreateParams CreateParams { get { CreateParams p = base.CreateParams; p.Style &= ~WS_CAPTION; return p; } }

//eventos

private void label1_Click_1(object sender, EventArgs e) { }

private void apagarToolStripMenuItem1_Click(object sender, EventArgs e) { this.Close(); }

private void Btn_santiago_Click_1(object sender, EventArgs e) { Lbl_nom_user.Text = ""; Lbl_nom_user.Text = Lbl_santiago.Text; Btn_image_user.Image = this.Btn_santiago.Image = ((System.Drawing.Image)(resources.GetObject("Btn_santiago.Image"))); password = "santiago"; sonido.SoundLocation = url_question; sonido.Play(); }

private void Btn_ochoa_Click_1(object sender, EventArgs e) { Lbl_nom_user.Text = ""; Lbl_nom_user.Text = Lbl_ochoa.Text; Btn_image_user.Image = this.Btn_ochoa.Image = ((System.Drawing.Image)(resources.GetObject("Btn_ochoa.Image"))); password = "ochoa"; sonido.SoundLocation = url_question; sonido.Play(); }

private void Btn_torero_Click_1(object sender, EventArgs e) { Lbl_nom_user.Text = ""; Lbl_nom_user.Text = Lbl_torero.Text;

6

Page 7: Manual Tecnico

[ ] Simulacion FreeBSD

Btn_image_user.Image = this.Btn_torero.Image = ((System.Drawing.Image)(resources.GetObject("Btn_torero.Image"))); password = "torero"; sonido.SoundLocation = url_question; sonido.Play(); }

private void Btn_reyes_Click(object sender, EventArgs e) { Lbl_nom_user.Text = ""; Lbl_nom_user.Text = Lbl_reyes.Text; Btn_image_user.Image = this.Btn_reyes.Image = ((System.Drawing.Image)(resources.GetObject("Btn_reyes.Image"))); password = "reyes"; sonido.SoundLocation = url_question; sonido.Play(); }

private void Btn_omar_Click(object sender, EventArgs e) { Lbl_nom_user.Text = ""; Lbl_nom_user.Text = Lbl_omar.Text; Btn_image_user.Image = this.Btn_omar.Image = ((System.Drawing.Image)(resources.GetObject("Btn_omar.Image"))); password = "omar"; sonido.SoundLocation = url_question; sonido.Play(); }

private void Btn_lino_Click(object sender, EventArgs e) { Lbl_nom_user.Text = ""; Lbl_nom_user.Text = Lbl_lino.Text; Btn_image_user.Image = this.Btn_lino.Image = ((System.Drawing.Image)(resources.GetObject("Btn_lino.Image"))); password = "lino"; sonido.SoundLocation = url_question; sonido.Play(); }

private void usuarios_Activated(object sender, EventArgs e) { if (cs == 0) { sonido.SoundLocation = url_question; sonido.Play(); cs++; }

if (shutdown) { this.Close(); } }

private void Btn_login_Click(object sender, EventArgs e) { if (Txt_password.Text.Trim() == password) { Escritorio es = new Escritorio(); es.Show();

7

Page 8: Manual Tecnico

[ ] Simulacion FreeBSD

sonido.SoundLocation = url_sonido; sonido.Play(); }

Else

{ Lbl_mensaje_pasword.Text = "Password incorrecto..."; sonido.SoundLocation = url_error; sonido.Play(); }

}

private void Txt_password_KeyDown(object sender, KeyEventArgs e) { Lbl_mensaje_pasword.Text = "";

if (e.KeyCode == Keys.Enter) { if (Txt_password.Text.Trim() == password) { Escritorio es = new Escritorio(); es.Show(); Txt_password.Text = " "; sonido.SoundLocation = url_sonido; sonido.Play(); } else { Lbl_mensaje_pasword.Text = "Password incorrecto..."; sonido.SoundLocation = url_error; sonido.Play(); } } }

private void Btn_cancel_Click(object sender, EventArgs e) { if (MessageBox.Show("Apagar...", "Apagar SO-CODE", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) this.Close(); }

private void usuarios_Deactivate(object sender, EventArgs e) { // splash(); }

}

8

Page 9: Manual Tecnico

[ ] Simulacion FreeBSD

Escritorio

9

Page 10: Manual Tecnico

[ ] Simulacion FreeBSD

Escritorio.resx:

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Diagnostics;using System.IO;using Explorer_Code;using NetworkMonitor;using System.Windows.Forms;

namespace Simulador_SistemaOperativo{ public partial class Escritorio : Form {

#region[variables]

System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Escritorio)); private System.Collections.Specialized.StringCollection directorios; System.Media.SoundPlayer sonido=new System.Media.SoundPlayer(); // String root = Path.GetFullPath(@"Hard_Disk\Desktop\Desktoop_1"); String url_logout = Path.GetFullPath(@"desktop-logout.wav"); String url_question = Path.GetFullPath(@"dialog-question.wav"); public static String url_desktop = Path.GetFullPath(@"Hard_Disk\Desktop\Desktoop_1"); public static String udesktop_1 = Path.GetFullPath(@"Hard_Disk\Desktop\Desktoop_1"); public static String udesktop_2 = Path.GetFullPath(@"Hard_Disk\Desktop\Desktoop_2"); public static String udesktop_3 = Path.GetFullPath(@"Hard_Disk\Desktop\Desktoop_3"); public static String udesktop_4 = Path.GetFullPath(@"Hard_Disk\Desktop\Desktoop_4"); int numero_Desk = 0; //nos indica k escritoeio esta activo; int num_fichero = 0,num_folder=0; public static String url_archivo = ""; //contierne el url del archivo selecionado; public static String ext_ren = ""; //capturamos las extencion; #endregion

public Escritorio() { numero_Desk = 1; InitializeComponent(); desktop_1(); Timer timer01 = new Timer(); timer01.Interval = 1000; timer01.Tick += new EventHandler(tiempo_sistema_Tick);

10

Page 11: Manual Tecnico

[ ] Simulacion FreeBSD

timer01.Enabled = true; }

public void InsertarImagen() { OpenFileDialog file = new OpenFileDialog(); if (file.ShowDialog() == DialogResult.OK) //Seleccionamos la imagen { Bitmap imagen = new Bitmap(file.FileName); //La cargamos en un objeto

switch (numero_Desk) { case 1: Lvw_Desktop.BackgroundImage = (System.Drawing.Image)(imagen); break; case 2: Lvw_desktop2.BackgroundImage = (System.Drawing.Image)(imagen); break; case 3: Lvw_desktop3.BackgroundImage = (System.Drawing.Image)(imagen); break; case 4: Lvw_desktop4.BackgroundImage = (System.Drawing.Image)(imagen); break; }

this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); // this.BackgroundImage = new System.Drawing.Image(); } }

public void crear_archivo(String ext) { string direc = url_desktop; direc = direc + @"\Fichero Vacio ["+num_fichero+"]."+ext; StreamWriter output = new StreamWriter(new FileStream(direc, FileMode.Create)); string ejecutar = ""; output.Write(ejecutar); output.Close(); num_fichero++; actualizar();

}

public void crear_folder() { string direc = url_desktop; direc = direc + @"\Nueva carpeta[" + num_folder + "]"; DirectoryInfo dir = new DirectoryInfo(direc); dir.Create(); num_folder++;

}

public void eliminar_archivo(string path) { if (MessageBox.Show("Desea Eliminar el archivo?", "Eliminar", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { // MessageBox.Show(path);

11

Page 12: Manual Tecnico

[ ] Simulacion FreeBSD

File.Delete(path); actualizar(); toolStripEliminar.Enabled = false; } }

public void eliminar_folder(String path) { if (MessageBox.Show("Desea Eliminar la carpeta?", "Eliminar", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { // MessageBox.Show(path); Directory.Delete(path); actualizar(); toolStripEliminar.Enabled = false; } }

public void identificar_file_directorio(string path) { if (File.Exists(path)) { eliminar_archivo(path); } else { if (Directory.Exists(path)) { eliminar_folder(path); } } }

public void rename_file_folder(string path, string name) { rename ren = new rename(); if (File.Exists(path)) { ren.Txt_nombre.Text = name.Substring(0, name.Length - 4); ext_ren = name.Substring(name.Length - 3, 3); // MessageBox.Show(ext_ren); } else { if (Directory.Exists(path)) { ren.Txt_nombre.Text = name; ext_ren = ""; } } ren.Show(); }

private void PaintListView(string root, ListView desktop_ini) { try { ListViewItem lvi; ListViewItem fold; ListViewItem.ListViewSubItem lvsi; ListViewItem.ListViewSubItem lvfold;

12

Page 13: Manual Tecnico

[ ] Simulacion FreeBSD

int indice=0; String name_f,extencion;

// this.lblCurrentPath.Text = root + " ( Double click to display the path name ) ";

System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(root);

DirectoryInfo[] dirs = dir.GetDirectories(); FileInfo[] files = dir.GetFiles(); // this.Lvw_Desktop.Items.Clear();

desktop_ini.BeginUpdate();

foreach (System.IO.DirectoryInfo folder in dirs) {

fold = new ListViewItem(); name_f = folder.Name; if (name_f.StartsWith("Nueva carpeta")) fold.ImageIndex = 0; else fold.ImageIndex = 1;

fold.Text = folder.Name; fold.Tag = folder.FullName;

lvfold = new ListViewItem.ListViewSubItem(); lvfold.Text = folder.Name.ToString(); fold.SubItems.Add(lvfold);

lvfold = new ListViewItem.ListViewSubItem(); lvfold.Text = folder.LastAccessTime.ToString(); fold.SubItems.Add(lvfold);

desktop_ini.Items.Add(fold); }

foreach (System.IO.FileInfo fi in files) { indice++; lvi = new ListViewItem(); name_f = fi.Name;

switch (name_f) { case "Ccleaner": lvi.ImageIndex = 17; break; case "Chrome": lvi.ImageIndex = 18; break; case "msn": lvi.ImageIndex = 19; break; case "firefox": lvi.ImageIndex = 20; break; case "IExplorer": lvi.ImageIndex = 21; break; case "Opera": lvi.ImageIndex = 22; break; case "Nero": lvi.ImageIndex = 23; break; case "Papelera": lvi.ImageIndex = 24; break; case "Winamp": lvi.ImageIndex = 25; break; case "Windowsmdp": lvi.ImageIndex = 26; break; case "Kernel": lvi.ImageIndex = 27; break; case "Walkman": lvi.ImageIndex = 28; break;

13

Page 14: Manual Tecnico

[ ] Simulacion FreeBSD

case "Reproductorvideo": lvi.ImageIndex = 29; break; case "Adobereader": lvi.ImageIndex = 30; break; case "Mi Pc": lvi.ImageIndex = 31; break;

} extencion = name_f.Substring((name_f.Length - 3), 3);

switch(extencion) { case "cod": lvi.ImageIndex = 3; break; case "rar": lvi.ImageIndex = 4; break; case "png": lvi.ImageIndex = 5; break; case "pdf": lvi.ImageIndex = 6; break; case "bat": lvi.ImageIndex = 8; break; case "cmd": lvi.ImageIndex = 9; break; case "avi": lvi.ImageIndex = 10; break; case "mp3": lvi.ImageIndex = 11; break; case "wav": lvi.ImageIndex = 12; break; case "ava": lvi.ImageIndex = 13; break; //.java case "mpg": lvi.ImageIndex = 14; break; case "TTF": lvi.ImageIndex = 15; break; case ".db": lvi.ImageIndex = 16; break;

}

lvi.Text = fi.Name; lvi.Tag = fi.FullName;

lvsi = new ListViewItem.ListViewSubItem(); lvsi.Text = fi.Length.ToString(); lvi.SubItems.Add(lvsi);

lvsi = new ListViewItem.ListViewSubItem(); lvsi.Text = fi.LastAccessTime.ToString(); lvi.SubItems.Add(lvsi);

desktop_ini.Items.Add(lvi); }

desktop_ini.EndUpdate(); } catch (System.Exception err) { MessageBox.Show(" Error: " + err.Message); }

// this.Lvw_Desktop.View = View.LargeIcon; }

private void desktop_1() { url_desktop = udesktop_1; Lvw_Desktop.Visible = true; Lvw_desktop2.Visible = false; Lvw_desktop3.Visible = false; Lvw_desktop4.Visible = false; Lvw_Desktop.LargeImageList = ImageList_Icon_desktop; Lvw_Desktop.Clear(); PaintListView(url_desktop, Lvw_Desktop); }

14

Page 15: Manual Tecnico

[ ] Simulacion FreeBSD

private void desktop_2() { url_desktop = udesktop_2; Lvw_Desktop.Visible = false; Lvw_desktop2.Visible = true; Lvw_desktop3.Visible = false; Lvw_desktop4.Visible = false; Lvw_desktop2.LargeImageList = ImageList_Icon_desktop; Lvw_desktop2.Clear(); PaintListView(url_desktop, Lvw_desktop2);

}

private void desktop_3() { url_desktop = udesktop_3; Lvw_Desktop.Visible = false; Lvw_desktop2.Visible = false; Lvw_desktop3.Visible = true; Lvw_desktop4.Visible = false; Lvw_desktop3.LargeImageList = ImageList_Icon_desktop; Lvw_desktop3.Clear(); PaintListView(url_desktop, Lvw_desktop3); }

private void desktop_4() { url_desktop = udesktop_4; Lvw_Desktop.Visible = false; Lvw_desktop2.Visible = false; Lvw_desktop3.Visible = false; Lvw_desktop4.Visible = true; Lvw_desktop4.LargeImageList = ImageList_Icon_desktop; Lvw_desktop4.Clear(); PaintListView(url_desktop, Lvw_desktop4); }

private void actualizar() { switch (numero_Desk) { case 1: { Lvw_Desktop.Clear(); PaintListView(url_desktop, Lvw_Desktop); break; } case 2: { Lvw_desktop2.Clear(); PaintListView(url_desktop, Lvw_desktop2); break; } case 3: { Lvw_desktop3.Clear(); PaintListView(url_desktop, Lvw_desktop3); break; } case 4:

15

Page 16: Manual Tecnico

[ ] Simulacion FreeBSD

{ Lvw_desktop4.Clear(); PaintListView(url_desktop, Lvw_desktop4); break; } } }

const int WS_CAPTION = 0xC00000; protected override CreateParams CreateParams { get { CreateParams p = base.CreateParams; p.Style &= ~WS_CAPTION; return p; } }

#region[eventos] //eventos private void Escritorio_Load(object sender, EventArgs e) { Lvw_Desktop.Width = this.Width; Lvw_Desktop.Height = this.Height; Lvw_desktop2.Width = this.Width; Lvw_desktop2.Height = this.Height; Lvw_desktop3.Width = this.Width; Lvw_desktop3.Height = this.Height; Lvw_desktop4.Width = this.Width; Lvw_desktop4.Height = this.Height; ListViewItem listItem = new ListViewItem(); listItem.ImageIndex = 0;

// Add sub-items for Details view. listItem.SubItems.Add("Grupo"); listItem.SubItems.Add("erc"); Lvw_Desktop.Items.Add(listItem);

}

private void Escritorio_Resize(object sender, EventArgs e) { Lvw_Desktop.Width = this.Width; Lvw_Desktop.Height = this.Height; }

private void imagenToolStripMenuItem_Click(object sender, EventArgs e) { }

private void cerrarSesionToolStripMenuItem1_Click(object sender, EventArgs e) { usuarios usu = new usuarios(); if (MessageBox.Show("Cerrar Sesión", "Cerrar Sesión SO-CODE", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { this.Close(); sonido.SoundLocation = url_question;

16

Page 17: Manual Tecnico

[ ] Simulacion FreeBSD

sonido.Play(); }

}

private void apagarToolStripMenuItem3_Click(object sender, EventArgs e) { if (MessageBox.Show("Apagar...", "Apagar SO-CODE", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { usuarios.shutdown = true; sonido.SoundLocation = url_logout; sonido.Play(); new Save_configuration().Show(); this.Close(); } } private void propiedadesToolStripMenuItem_Click(object sender, EventArgs e) { InsertarImagen(); } private void actualizarToolStripMenuItem_Click(object sender, EventArgs e) { actualizar(); // this.Lvw_Desktop.Refresh(); } private void Lvw_Desktop_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.C) { new run().Show(); } } private void tiempo_sistema_Tick(object sender, EventArgs e) { toolReloj.Text = DateTime.Now.ToLongTimeString(); } private void toolStripDesktop1_Click(object sender, EventArgs e) { this.toolStripDesktop1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("toolStripDesktop1.BackgroundImage"))); this.toolStripDesktop2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.toolStripDesktop3.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.toolStripDesktop4.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); numero_Desk = 1; desktop_1(); } private void toolStripDesktop2_Click(object sender, EventArgs e) { this.toolStripDesktop2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("toolStripDesktop1.BackgroundImage"))); this.toolStripDesktop1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.toolStripDesktop3.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));

17

Page 18: Manual Tecnico

[ ] Simulacion FreeBSD

this.toolStripDesktop4.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); numero_Desk = 2; desktop_2(); } private void toolStripDesktop3_Click(object sender, EventArgs e) { this.toolStripDesktop3.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("toolStripDesktop1.BackgroundImage"))); this.toolStripDesktop2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.toolStripDesktop1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.toolStripDesktop4.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); numero_Desk = 3; desktop_3(); } private void toolStripDesktop4_Click(object sender, EventArgs e) { this.toolStripDesktop4.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("toolStripDesktop1.BackgroundImage"))); this.toolStripDesktop2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.toolStripDesktop3.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); this.toolStripDesktop1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image"))); numero_Desk = 4; desktop_4(); } private void toolStripFolder_Click(object sender, EventArgs e) { crear_folder(); actualizar(); }

private void toolStripEdito_texto_Click(object sender, EventArgs e) { crear_archivo("cod"); } private void toolReloj_Click(object sender, EventArgs e) { Fecha_sistemas.Visible = true; } private void Fecha_sistemas_Leave(object sender, EventArgs e) { Fecha_sistemas.Visible = false; } private void nuevoToolStripMenuItem_Click(object sender, EventArgs e) { string path = Path.GetFullPath(@"Hard_Disk\Disco Local (C)\Math_soft\Proyecto_Compiladores\bin\Debug\Proyecto_Compiladores.exe"); System.Diagnostics.Process.Start(path); }

private void toolStripMenuItem16_Click(object sender, EventArgs e) {

18

Page 19: Manual Tecnico

[ ] Simulacion FreeBSD

string path = Path.GetFullPath(@"Hard_Disk\\Disco Local (C)\\Recordatorio\\Recordatorio\\bin\\Debug\\Recordatorio.exe"); System.Diagnostics.Process.Start(path); }

//ejecutamos los iconos;

private void Lvw_Desktop_ItemActivate(object sender, EventArgs e) { try { string sFileName = Lvw_Desktop.FocusedItem.Text; url_archivo = udesktop_1 + "\\" + sFileName; Process.Start(url_archivo); } catch (Exception Exc) { } } private void Lvw_desktop4_ItemActivate(object sender, EventArgs e) { try {

string sFileName = Lvw_desktop4.FocusedItem.Text; url_archivo = udesktop_4 + "\\" + sFileName; Process.Start(url_archivo); } catch (Exception Exc) { } } private void Lvw_desktop3_ItemActivate(object sender, EventArgs e) { try {

string sFileName = Lvw_desktop3.FocusedItem.Text; url_archivo = udesktop_3 + "\\" + sFileName; Process.Start(url_archivo); } catch (Exception Exc) { } } private void Lvw_desktop2_ItemActivate(object sender, EventArgs e) { try { string sFileName = Lvw_desktop2.FocusedItem.Text; url_archivo = udesktop_2 + "\\" + sFileName; Process.Start(url_archivo); } catch (Exception Exc) { } } private void toolStripEliminar_Click(object sender, EventArgs e) { try { identificar_file_directorio(url_archivo); } catch (Exception erc) { } } private void Lvw_Desktop_Click(object sender, EventArgs e) { toolStripRename.Enabled = true;

19

Page 20: Manual Tecnico

[ ] Simulacion FreeBSD

toolStripEliminar.Enabled = true; string sFileName = Lvw_Desktop.FocusedItem.Text; url_archivo = udesktop_1 + "\\" + sFileName; //FileInfo de=new FileInfo(""); } private void Lvw_desktop4_Click(object sender, EventArgs e) { toolStripRename.Enabled = true; toolStripEliminar.Enabled = true; string sFileName = Lvw_desktop4.FocusedItem.Text; url_archivo = udesktop_4 + "\\" + sFileName; } private void Lvw_desktop3_Click(object sender, EventArgs e) { toolStripRename.Enabled = true; toolStripEliminar.Enabled = true; string sFileName = Lvw_desktop3.FocusedItem.Text; url_archivo = udesktop_3 + "\\" + sFileName; } private void Lvw_desktop2_Click(object sender, EventArgs e) { toolStripRename.Enabled = true; toolStripEliminar.Enabled = true; string sFileName = Lvw_desktop2.FocusedItem.Text; url_archivo = udesktop_2 + "\\" + sFileName; } private void toolStripPdf_Click(object sender, EventArgs e) { crear_archivo("pdf"); } private void toolStripArchivo_bat_Click(object sender, EventArgs e) { crear_archivo("bat"); } private void toolStripArchivo_cmd_Click(object sender, EventArgs e) { crear_archivo("cmd"); } private void toolStripArchivo_java_Click(object sender, EventArgs e) { crear_archivo("java"); } private void toolStripArchivo_winrar_Click(object sender, EventArgs e) { crear_archivo("rar"); } private void toolStripArchivo_png_Click(object sender, EventArgs e) { crear_archivo("png"); } private void toolStripRename_Click(object sender, EventArgs e) { try { string name = "";

20

Page 21: Manual Tecnico

[ ] Simulacion FreeBSD

switch (numero_Desk) { case 1: name = Lvw_Desktop.FocusedItem.Text; break; case 2: name = Lvw_desktop2.FocusedItem.Text; break; case 3: name = Lvw_desktop3.FocusedItem.Text; break; case 4: name = Lvw_desktop4.FocusedItem.Text; break; } toolStripRename.Enabled = false; rename_file_folder(url_archivo, name); } catch (Exception erc) { } } #endregion private void toolStripExplorer_Click(object sender, EventArgs e) { Explorer exp = new Explorer(); exp.Show(); } private void toolStripMenuItem8_Click(object sender, EventArgs e) { InsertarImagen(); } private void toolStripMenuItem9_Click(object sender, EventArgs e) { Explorer exp = new Explorer(); exp.Show(); } private void Lvw_desktop4_SelectedIndexChanged(object sender, EventArgs e) {

} private void inicioToolStripMenuItem_Click(object sender, EventArgs e) {

} private void archivoToolStripMenuItem_Click(object sender, EventArgs e) {

} private void misDocumentosToolStripMenuItem1_Click(object sender, EventArgs e) { Form1 objfr = new Form1(); objfr.Show(); } private void virtualPcToolStripMenuItem_Click(object sender, EventArgs e) { run runnn = new run(); runnn.Show();

21

Page 22: Manual Tecnico

[ ] Simulacion FreeBSD

Explorador

22

Page 23: Manual Tecnico

[ ] Simulacion FreeBSD

Explorador.resx:using System;using System.Collections;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Diagnostics;using System.Drawing;using System.IO;using System.Text;using System.Windows.Forms;

namespace Explorer_Code{ public partial class Explorer : Form { // Counters for statusBar1 control FileExplorer fe = new FileExplorer(); private int iFiles = 0; private int iDirectories = 0; String root = Path.GetFullPath("Hard_Disk");

public Explorer() { InitializeComponent(); } private void AddDirectories(TreeNode tnSubNode) { // This method is used to get directories (from disks, or from other directories)

treeView1.BeginUpdate(); iDirectories = 0;

try { DirectoryInfo diRoot;

// If drive, get directories from drives if (tnSubNode.SelectedImageIndex < 11) { diRoot = new DirectoryInfo(tnSubNode.FullPath + "\\"); }

// Else, get directories from directories else { diRoot = new DirectoryInfo(tnSubNode.FullPath);

23

Page 24: Manual Tecnico

[ ] Simulacion FreeBSD

} DirectoryInfo[] dirs = diRoot.GetDirectories();

// Must clear this first, else the directories will get duplicated in treeview tnSubNode.Nodes.Clear() // Add the sub directories to the treeView1 foreach (DirectoryInfo dir in dirs) { iDirectories++; TreeNode subNode = new TreeNode(dir.Name); subNode.ImageIndex = 2; subNode.SelectedImageIndex = 2; tnSubNode.Nodes.Add(subNode); }

} // Throw Exception when accessing directory: C:\System Volume Information // do nothing catch { ; }

treeView1.EndUpdate(); } private void AddFiles(string strPath) { listView1.BeginUpdate(); listView1.Items.Clear(); iFiles = 0; try { DirectoryInfo di = new DirectoryInfo(strPath + "\\"); FileInfo[] theFiles = di.GetFiles(); foreach (FileInfo theFile in theFiles) { iFiles++; ListViewItem lvItem = new ListViewItem(theFile.Name); lvItem.ImageIndex = 6; listView1.SmallImageList = imagesSmall; listView1.LargeImageList = imagesLarge; lvItem.SubItems.Add(theFile.Length.ToString()); lvItem.SubItems.Add(theFile.LastWriteTime.ToShortDateString()); lvItem.SubItems.Add(theFile.LastWriteTime.ToShortTimeString()); listView1.Items.Add(lvItem); } } catch (Exception Exc) { //statusBar1.Text = Exc.ToString(); } listView1.EndUpdate(); } private void treeView1_BeforeExpand(object sender, TreeViewCancelEventArgs e) { if (e.Node.Nodes[0].Text == "") { TreeNode node = fe.EnumerateDirectory(e.Node); } } private void Explorer_Load(object sender, EventArgs e) { // This routine adds all computer drives to the root nodes of treeView1 control

24

Page 25: Manual Tecnico

[ ] Simulacion FreeBSD

//cmdFillList_Click(null, null); optLargeIcon.Tag = View.LargeIcon; optSmallIcon.Tag = View.SmallIcon; optDetails.Tag = View.Details; optList.Tag = View.List; string ruta = root; treeView1.BeginUpdate(); TreeNode dnMyDrives = new TreeNode(ruta); treeView1.Nodes.Add(dnMyDrives); treeView1.EndUpdate(); procesar(ruta, dnMyDrives); // Create file tree } private void procesar(string ruta, TreeNode dnMyDrives) { string[] carpetas = Directory.GetDirectories(ruta); treeView1.BeginUpdate();

foreach (string strDrive in carpetas) { TreeNode dnMyDrives1 = new TreeNode(strDrive.Remove(0, ruta.Length + 1)); String nombre=""; String cad; for (int i = strDrive.Length - 1; i > -1; i--) { cad = strDrive.Substring(i, 1); if (cad.Equals(@"\")) { nombre = strDrive.Substring(i+1,strDrive.Length-(i+1)); i = -1; } }

dnMyDrives.SelectedImageIndex = 1; switch (nombre) { case "Desktop": { // MessageBox.Show("llego.....1"); dnMyDrives.ImageIndex = 4; break; } case "Desktoop_1": { // MessageBox.Show("llego.....2"); dnMyDrives.ImageIndex = 4; break; }

case "Desktoop_2": dnMyDrives.ImageIndex = 4; break; case "Desktoop_3": dnMyDrives.ImageIndex = 4; break; case "Desktoop_4": dnMyDrives.ImageIndex = 4; break; case "Disco Local (C)": dnMyDrives.ImageIndex = 1; break; case "Disco Local (D)": dnMyDrives.ImageIndex = 2; break;

25

Page 26: Manual Tecnico

[ ] Simulacion FreeBSD

case "Unidad CD (E)": dnMyDrives.ImageIndex = 3; break; case "Desktop.cod": dnMyDrives.ImageIndex = 1; break; default: dnMyDrives.ImageIndex = 0; break; } treeView1.SelectedNode = dnMyDrives; dnMyDrives.Nodes.Add(dnMyDrives1); procesar(strDrive, dnMyDrives1); } treeView1.EndUpdate(); } private void listView1_ItemActivate_1(object sender, EventArgs e) { try { string sPath = treeView1.SelectedNode.FullPath; string sFileName = listView1.FocusedItem.Text;

Process.Start(sPath + "\\" + sFileName); } catch (Exception Exc) { MessageBox.Show(Exc.ToString()); } }

private void treeView1_AfterSelect(object sender, TreeViewEventArgs e) { // Get subdirectories from disk, add to treeView1 control //AddDirectories(e.Node); // if node is collapsed, expand it. This allows single click to open folders. treeView1.SelectedNode.Expand(); listView1.Items.Clear(); archivos(e.Node.FullPath.ToString()); carpetas(e.Node.FullPath.ToString()); // Get files from disk, add to listView1 control //statusBar1.Text = iDirectories.ToString() + " Folder(s) " + iFiles.ToString() + " File(s)"; }

private void ViewNew(object sender, EventArgs e) {

// Set the current view mode based on the number in the tag value of the // selected radio button.

listView1.View = (View)(((Control)sender).Tag);

// Display the current view style. this.Text = "Using View: " + listView1.View.ToString(); listView1.SmallImageList = imagesSmall; listView1.LargeImageList = imagesLarge; }

// box correspondiente

// Metodo que coloca los archivos de la ruta indicada en el list // box correspondiente

private void listView1_ColumnClick(object sender, ColumnClickEventArgs e)

26

Page 27: Manual Tecnico

[ ] Simulacion FreeBSD

{ listView1.ListViewItemSorter = new CompareListViewItems(e.Column, true);

// Perform the sort. listView1.Sort(); }

public class CompareListViewItems : IComparer { // This index identifies the column that is used for sorting public readonly int Column;

// Is the sort alphabetic or number? public readonly bool Alphabetic;

public CompareListViewItems(int columnIndex, bool alphabetic) { this.Column = columnIndex; this.Alphabetic = alphabetic; }

public int Compare(object x, object y) { // Convert the items that must be compared into ListViewItem objects. string listX = ((ListViewItem)x).SubItems[Column].Text; string listY = ((ListViewItem)y).SubItems[Column].Text;

// Sort using the specified column and specified sorting type. if (Alphabetic) { return listX.CompareTo(listY);

} else { if (int.Parse(listX) > int.Parse(listY)) { return 1; } else if (int.Parse(listX) == int.Parse(listY)) { return 0; } else { return -1; } } } } private void button1_Click(object sender, EventArgs e) { listView1.Items.Clear(); archivos(textBox1.Text); carpetas(textBox1.Text); }

private void carpetas(string ruta) { DirectoryInfo directory = new DirectoryInfo(ruta + "\\");

27

Page 28: Manual Tecnico

[ ] Simulacion FreeBSD

DirectoryInfo[] theDirectories = directory.GetDirectories(); listView1.BeginUpdate(); foreach (DirectoryInfo theDirectorie in theDirectories) { iFiles++; ListViewItem lvItem = new ListViewItem(theDirectorie.Name); // MessageBox.Show(theDirectorie.Name);

switch (theDirectorie.Name) { case "Desktop": { //MessageBox.Show("llego.....1"); lvItem.ImageIndex = 4; break; } case "Desktoop_1": { // MessageBox.Show("llego.....2"); lvItem.ImageIndex = 4; break; } case "Desktoop_2": lvItem.ImageIndex = 4; break; case "Desktoop_3": lvItem.ImageIndex = 4; break; case "Desktoop_4": lvItem.ImageIndex = 4; break; case "Disco Local (C)": lvItem.ImageIndex = 1; break; case "Disco Local (D)": lvItem.ImageIndex = 2; break; case "Unidad CD (E)": lvItem.ImageIndex = 3; break; case "Desktop.cod": lvItem.ImageIndex = 5; break; default: lvItem.ImageIndex = 0; break; } listView1.SmallImageList = imagesSmall; listView1.LargeImageList = imagesLarge; lvItem.SubItems.Add(""); lvItem.SubItems.Add(theDirectorie.LastWriteTime.ToShortDateString()); lvItem.SubItems.Add(theDirectorie.LastWriteTime.ToShortTimeString()); listView1.Items.Add(lvItem); } listView1.EndUpdate(); }

// Metodo que coloca los archivos de la ruta indicada en el list // box correspondiente private void archivos(string ruta) { DirectoryInfo directory = new DirectoryInfo(ruta + "\\"); FileInfo[] theFiles = directory.GetFiles(); listView1.BeginUpdate(); foreach (FileInfo theFile in theFiles) { iFiles++; ListViewItem lvItem = new ListViewItem(theFile.Name); lvItem.ImageIndex = 5; listView1.SmallImageList = imagesSmall; listView1.LargeImageList = imagesLarge; lvItem.SubItems.Add(theFile.Length.ToString()); lvItem.SubItems.Add(theFile.LastWriteTime.ToShortDateString()); lvItem.SubItems.Add(theFile.LastWriteTime.ToShortTimeString()); listView1.Items.Add(lvItem); }

28

Page 29: Manual Tecnico

[ ] Simulacion FreeBSD

listView1.EndUpdate(); } }}

Reproductor

29

Page 30: Manual Tecnico

[ ] Simulacion FreeBSD

Reproductor.resxusing System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;

namespace Simulador_SistemaOperativo{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } string ruta;

30

Page 31: Manual Tecnico

[ ] Simulacion FreeBSD

private void abrirToolStripMenuItem_Click(object sender, EventArgs e) {

} private void reproducirToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog abrirarchivo = new OpenFileDialog(); abrirarchivo.Filter = "Archivo|*.avi;*.mpeg;*.wmv;*.rmvb;*.mp3;*.mp4;"; abrirarchivo.ShowDialog(); ruta = abrirarchivo.FileName;

axWindowsMediaPlayer1.URL = ruta; Form1.ActiveForm.Text = ruta; } }}

Run

31

Page 32: Manual Tecnico

[ ] Simulacion FreeBSD

32

Page 33: Manual Tecnico

[ ] Simulacion FreeBSD

Run.resx:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;

namespace Simulador_SistemaOperativo{ public partial class run : Form { public run() { InitializeComponent(); }

private void run_Load(object sender, EventArgs e) { Cbx_comand.Focus(); }

}}

Webcam33

Page 34: Manual Tecnico

[ ] Simulacion FreeBSD

Webcam:

34

Page 35: Manual Tecnico

[ ] Simulacion FreeBSD

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using AForge.Video;using AForge.Video.DirectShow;

namespace WebCam{ public partial class Form1 : Form { private bool ExistenDispositivos = false; private FilterInfoCollection DispositivosDeVideo; private VideoCaptureDevice FuenteDeVideo = null; public Form1() { InitializeComponent(); BuscarDispositivos(); }

public void CargarDispositivos(FilterInfoCollection Dispositivos) { for (int i = 0; i < Dispositivos.Count; i++) cboDispositivos.Items.Add(Dispositivos[i].Name.ToString()); cboDispositivos.Text = cboDispositivos.Items[0].ToString(); }

public void BuscarDispositivos() { DispositivosDeVideo = new FilterInfoCollection(FilterCategory.VideoInputDevice); if (DispositivosDeVideo.Count == 0) ExistenDispositivos = false; else { ExistenDispositivos = true; CargarDispositivos(DispositivosDeVideo); } } public void TerminarFuenteDeVideo() { if (!(FuenteDeVideo == null)) if (FuenteDeVideo.IsRunning) { FuenteDeVideo.SignalToStop(); FuenteDeVideo = null; } }

private void video_NuevoFrame(object sender, NewFrameEventArgs eventArgs) { Bitmap Imagen = (Bitmap)eventArgs.Frame.Clone(); EspacioCamara.Image = Imagen; }

private void btnIniciar_Click(object sender, EventArgs e) {

35

Page 36: Manual Tecnico

[ ] Simulacion FreeBSD

if (btnIniciar.Text == "Iniciar") { if (ExistenDispositivos) { FuenteDeVideo = new VideoCaptureDevice(DispositivosDeVideo[cboDispositivos.SelectedIndex].MonikerString); FuenteDeVideo.NewFrame += new NewFrameEventHandler(video_NuevoFrame); FuenteDeVideo.Start(); Estado.Text = " Ejecutando dispositivo"; btnIniciar.Text = "Detener"; cboDispositivos.Enabled = false; groupBox1.Text = DispositivosDeVideo[cboDispositivos.SelectedIndex].Name.ToString(); } else Estado.Text = "Error: No se encuentra dispositivo."; } else { if (FuenteDeVideo.IsRunning) { TerminarFuenteDeVideo(); Estado.Text = " Dispositivo detenido"; btnIniciar.Text = "Iniciar"; cboDispositivos.Enabled = true; } }

} private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (btnIniciar.Text == "Detener") btnIniciar_Click(sender, e); } }}

36

Page 37: Manual Tecnico

[ ] Simulacion FreeBSD

Calculadora

37

Page 38: Manual Tecnico

[ ] Simulacion FreeBSD

Calculadora.resx:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;

namespace Proyectogestor{ public partial class Form1 : Form {

//Variables globales...

float num1; string op; public Form1() { InitializeComponent(); } //Boton igual... private void butIgual_Click(object sender, EventArgs e) { float num2; try { num2 = float.Parse(textVisor.Text);

switch (op) { case "sumar": textVisor.Text = "" + suma(num1, num2); break;

case "restar": textVisor.Text = "" + resta(num1, num2); break;

case "multiplicar": textVisor.Text = "" + multi(num1, num2); break;

case "dividir": textVisor.Text = "" + divi(num1, num2); break;

case "potenciar": textVisor.Text = "" + Math.Pow(num1, num2); break;

} }

catch (Exception aviso) { MessageBox.Show(aviso.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information);

38

Page 39: Manual Tecnico

[ ] Simulacion FreeBSD

throw; }

}

//Metodos de las operaciones...

public float suma(float num3, float num4) { try { return (num3 + num4); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information); throw; } } public float resta(float num3, float num4) { try { return (num3 - num4); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information); throw; } }

public float multi(float num3, float num4) { try { return (num3 * num4); } catch (Exception ex1) { MessageBox.Show(ex1.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information); throw; } }

public float divi(float num3, float num4) { try { return (num3 / num4);

39

Page 40: Manual Tecnico

[ ] Simulacion FreeBSD

} catch (Exception ex1) { MessageBox.Show(ex1.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information); throw; } }

//Numeros...

private void but0_Click(object sender, EventArgs e) { textVisor.Text = textVisor.Text + "0"; } private void butComa_Click(object sender, EventArgs e) { textVisor.Text = textVisor.Text + ","; butComa.Enabled = false; } private void but1_Click(object sender, EventArgs e) { textVisor.Text = textVisor.Text + "1"; } private void but2_Click(object sender, EventArgs e) { textVisor.Text = textVisor.Text + "2"; } private void but3_Click(object sender, EventArgs e) { textVisor.Text = textVisor.Text + "3"; } private void but4_Click(object sender, EventArgs e) { textVisor.Text = textVisor.Text + "4"; } private void but5_Click(object sender, EventArgs e) { textVisor.Text = textVisor.Text + "5"; } private void but6_Click(object sender, EventArgs e) { textVisor.Text = textVisor.Text + "6"; } private void but7_Click(object sender, EventArgs e) { textVisor.Text = textVisor.Text + "7"; } private void but8_Click(object sender, EventArgs e) { textVisor.Text = textVisor.Text + "8"; }

private void but9_Click(object sender, EventArgs e) { textVisor.Text = textVisor.Text + "9"; }

40

Page 41: Manual Tecnico

[ ] Simulacion FreeBSD

//Botones adicionales...

private void butSalir_Click(object sender, EventArgs e) { Close(); }

private void butLimpiar_Click(object sender, EventArgs e) { textVisor.Text = ""; } //Botones de operaciones...

private void butMas_Click(object sender, EventArgs e) { butComa.Enabled = true;

try { num1 = float.Parse(textVisor.Text); } catch (Exception aviso) { MessageBox.Show(aviso.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information); throw; } textVisor.Text = ""; op = "sumar"; }

private void butMenos_Click(object sender, EventArgs e) { butComa.Enabled = true;

try { num1 = float.Parse(textVisor.Text); } catch (Exception aviso) { MessageBox.Show(aviso.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information); throw; } textVisor.Text = ""; op = "restar"; }

private void butPor_Click(object sender, EventArgs e) { butComa.Enabled = true;

try { num1 = float.Parse(textVisor.Text);

41

Page 42: Manual Tecnico

[ ] Simulacion FreeBSD

} catch (Exception aviso) { MessageBox.Show(aviso.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information); throw; } textVisor.Text = ""; op = "multiplicar"; } private void butDivis_Click(object sender, EventArgs e) { butComa.Enabled = true;

try { num1 = float.Parse(textVisor.Text); } catch (Exception aviso) { MessageBox.Show(aviso.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information); throw; } textVisor.Text = ""; op = "dividir"; } private void butPot_Click(object sender, EventArgs e) { butComa.Enabled = true;

try { num1 = float.Parse(textVisor.Text); } catch (Exception aviso) { MessageBox.Show(aviso.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Information); throw; } textVisor.Text = ""; op = "potenciar"; }

}}

42

Page 43: Manual Tecnico

[ ] Simulacion FreeBSD

Puzzle

Puzzle.resx:43

Page 44: Manual Tecnico

[ ] Simulacion FreeBSD

/* * Created by SharpDevelop. * User: JunMan * Date: 17/10/2008 * Time: 11:32 * este codigo me costo hacerlo media hora tu lo haras en menos suerte * mi correo es [email protected] * puedo aportar con mas codigo escribanme * To change this template use Tools | Options | Coding | Edit Standard Headers. */

using System;using System.Collections.Generic;using System.Drawing;using System.Windows.Forms;

namespace puzzle{

/// <summary>/// Description of MainForm./// </summary>public partial class MainForm{private int n;String pos;

private bool a=false,b=false,c=false,d=false,ee=false,i=false,f=false,g=false,h=false;

private int []A= new int[10];private int []B= new int[10];[STAThread]public static void Main(string[] args){

Application.EnableVisualStyles();Application.SetCompatibleTextRenderingDefault(false);Application.Run(new MainForm());

}

public MainForm(){

//// The InitializeComponent() call is required for

Windows Forms designer support.//InitializeComponent();

//// TODO: Add constructor code after the

InitializeComponent() call.//

}public void llenar(){

b1.BackgroundImage=b11.BackgroundImage;b2.BackgroundImage=b12.BackgroundImage;b3.BackgroundImage=b13.BackgroundImage;b4.BackgroundImage=b14.BackgroundImage;b5.BackgroundImage=b15.BackgroundImage;b6.BackgroundImage=b16.BackgroundImage;b7.BackgroundImage=b17.BackgroundImage;b8.BackgroundImage=b18.BackgroundImage;b9.BackgroundImage=b19.BackgroundImage;

44

Page 45: Manual Tecnico

[ ] Simulacion FreeBSD

}public void llenar2(){ int i,j,k;

string p,q;Random rnd = new Random();

for (i=1;i<=9;i++){

B[i]=i;}for (i=1;i<=9;i++){

A[i]=rnd.Next(1, 9);}verificallenado();

}public void verificallenado(){

int i,j,k,sw=0;for (i=1;i<=8;i++){

for(j=i+1;j<=9;j++){

if(A[i]==A[j])A[j]=0;

}}for (i=1;i<=9;i++){

for(j=1;j<=9;j++){

if(A[i]==B[j])B[j]=0;

}}for (i=1;i<=9;i++){

for(j=1;j<=9;j++){

if(A[i]==0){

if(B[j]!=0){

A[i]=B[j];B[j]=0;

}}

}}

}

void Button1Click(object sender, System.EventArgs e){label1.Visible=false;

llenar2();System.ComponentModel.ComponentResourceManager

resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));

45

Page 46: Manual Tecnico

[ ] Simulacion FreeBSD

int z;String p;z=A[1]; p=z.ToString(); this.b1.BackgroundImage = ((System.Drawing.Image)

(resources.GetObject("b1"+p+".BackgroundImage"))); z=A[2]; p=z.ToString();this.b2.BackgroundImage = ((System.Drawing.Image)

(resources.GetObject("b1"+p+".BackgroundImage")));z=A[3]; p=z.ToString();this.b3.BackgroundImage = ((System.Drawing.Image)

(resources.GetObject("b1"+p+".BackgroundImage")));z=A[4]; p=z.ToString();this.b4.BackgroundImage = ((System.Drawing.Image)

(resources.GetObject("b1"+p+".BackgroundImage")));z=A[5]; p=z.ToString();this.b5.BackgroundImage = ((System.Drawing.Image)

(resources.GetObject("b1"+p+".BackgroundImage")));z=A[6]; p=z.ToString();this.b6.BackgroundImage = ((System.Drawing.Image)

(resources.GetObject("b1"+p+".BackgroundImage")));z=A[7]; p=z.ToString();this.b7.BackgroundImage = ((System.Drawing.Image)

(resources.GetObject("b1"+p+".BackgroundImage")));z=A[8]; p=z.ToString();this.b8.BackgroundImage = ((System.Drawing.Image)

(resources.GetObject("b1"+p+".BackgroundImage")));z=A[9]; p=z.ToString();this.b9.BackgroundImage = ((System.Drawing.Image)

(resources.GetObject("b1"+p+".BackgroundImage")));

}public void movidas(){

n=n+1;string p;p=n.ToString();mov.Text=p;

}

void MainFormLoad(object sender, System.EventArgs e){

llenar();}

void Button2Click(object sender, System.EventArgs e){

llenar();verifica();

}

void B2Click(object sender, System.EventArgs e){

b=true;if(c==true&&b2.BackgroundImage==aux.BackgroundImage ){

46

Page 47: Manual Tecnico

[ ] Simulacion FreeBSD

b2.BackgroundImage=b3.BackgroundImage;b3.BackgroundImage=aux.BackgroundImage;

b=false;movidas();}if(a==true&&b2.BackgroundImage==aux.BackgroundImage ){

b2.BackgroundImage=b1.BackgroundImage;b1.BackgroundImage=aux.BackgroundImage;

b=false;a=false;movidas();}if(ee==true&&b2.BackgroundImage==aux.BackgroundImage ){

b2.BackgroundImage=b5.BackgroundImage;b5.BackgroundImage=aux.BackgroundImage;

b=false;ee=false;movidas();}

}

void B3Click(object sender, System.EventArgs e){c=true;

if(b==true&&b3.BackgroundImage==aux.BackgroundImage ){

b3.BackgroundImage=b2.BackgroundImage;b2.BackgroundImage=aux.BackgroundImage;

c=false;movidas();b=false;}if(f==true&&b3.BackgroundImage==aux.BackgroundImage){

b3.BackgroundImage=b6.BackgroundImage;b6.BackgroundImage=aux.BackgroundImage;

c=false;f=false;movidas();}

}

void B6Click(object sender, System.EventArgs e){

f=true;if(c==true&&b6.BackgroundImage==aux.BackgroundImage ){

b6.BackgroundImage=b3.BackgroundImage;b3.BackgroundImage=aux.BackgroundImage ;

f=false;c=false;movidas();}if(ee==true&&b6.BackgroundImage==aux.BackgroundImage){

b6.BackgroundImage=b5.BackgroundImage;b5.BackgroundImage=aux.BackgroundImage;f=false;ee=false;movidas();

}if(i==true&&b6.BackgroundImage==aux.BackgroundImage){

47

Page 48: Manual Tecnico

[ ] Simulacion FreeBSD

b6.BackgroundImage=b9.BackgroundImage;b9.BackgroundImage=aux.BackgroundImage;i=false;f=false;movidas();

}

}

void B1Click(object sender, System.EventArgs e){

a=true;if(b==true&&b1.BackgroundImage==aux.BackgroundImage ){

b1.BackgroundImage=b2.BackgroundImage;b2.BackgroundImage=aux.BackgroundImage;a=false;b=false;movidas();

}if(d==true&&b1.BackgroundImage==aux.BackgroundImage){

b1.BackgroundImage=b4.BackgroundImage;b4.BackgroundImage=aux.BackgroundImage;d=false;a=false;movidas();

}

}

void B5Click(object sender, System.EventArgs e){ee=true;

if(b==true&&b5.BackgroundImage==aux.BackgroundImage ){

b5.BackgroundImage=b2.BackgroundImage;b2.BackgroundImage=aux.BackgroundImage;ee=false;b=false;movidas();

}if(f==true&&b5.BackgroundImage==aux.BackgroundImage){

b5.BackgroundImage=b6.BackgroundImage;b6.BackgroundImage=aux.BackgroundImage;ee=false;f=false;movidas();

}if(d==true&&b5.BackgroundImage==aux.BackgroundImage){

b5.BackgroundImage=b4.BackgroundImage;b4.BackgroundImage=aux.BackgroundImage;ee=false;d=false;movidas();

}if(h==true&&b5.BackgroundImage==aux.BackgroundImage){

b5.BackgroundImage=b8.BackgroundImage;b8.BackgroundImage=aux.BackgroundImage;ee=false;h=false;movidas();

}}

void B4Click(object sender, System.EventArgs e){

d=true;if(a==true&&b4.BackgroundImage==aux.BackgroundImage){

b4.BackgroundImage=b1.BackgroundImage;b1.BackgroundImage=aux.BackgroundImage;a=false;d=false;movidas();

}

48

Page 49: Manual Tecnico

[ ] Simulacion FreeBSD

if(ee==true&&b4.BackgroundImage==aux.BackgroundImage){

b4.BackgroundImage=b5.BackgroundImage;b5.BackgroundImage=aux.BackgroundImage;ee=false;d=false;movidas();

}if(g==true&&b4.BackgroundImage==aux.BackgroundImage){

b4.BackgroundImage=b7.BackgroundImage;b7.BackgroundImage=aux.BackgroundImage;g=false;d=false;movidas();

}}

void B8Click(object sender, System.EventArgs e){h=true;

if(ee==true&&b8.BackgroundImage==aux.BackgroundImage){

b8.BackgroundImage=b5.BackgroundImage;b5.BackgroundImage=aux.BackgroundImage;ee=false;h=false;movidas();

}if(g==true&&b8.BackgroundImage==aux.BackgroundImage){

b8.BackgroundImage=b7.BackgroundImage;b7.BackgroundImage=aux.BackgroundImage;g=false;h=false;movidas();

}if(i==true&&b8.BackgroundImage==aux.BackgroundImage){

b8.BackgroundImage=b9.BackgroundImage;b9.BackgroundImage=aux.BackgroundImage;i=false;h=false;movidas();

}}

void B9Click(object sender, System.EventArgs e){i=true;

if(f==true&&b9.BackgroundImage==aux.BackgroundImage){

b9.BackgroundImage=b6.BackgroundImage;b6.BackgroundImage=aux.BackgroundImage;i=false;f=false;movidas();

}if(h==true&&b9.BackgroundImage==aux.BackgroundImage){

b9.BackgroundImage=b8.BackgroundImage;b8.BackgroundImage=aux.BackgroundImage;i=false;h=false;movidas();

}

}

void B7Click(object sender, System.EventArgs e){g=true;

if(d==true&&b7.BackgroundImage==aux.BackgroundImage){

b7.BackgroundImage=b4.BackgroundImage;b4.BackgroundImage=aux.BackgroundImage;g=false;d=false;movidas();

}

49

Page 50: Manual Tecnico

[ ] Simulacion FreeBSD

if(h==true&&b7.BackgroundImage==aux.BackgroundImage){

b7.BackgroundImage=b8.BackgroundImage;b8.BackgroundImage=aux.BackgroundImage;g=false;h=false;movidas();

}}public void verifica(){

if(b1.BackgroundImage==b11.BackgroundImage&&b2.BackgroundImage==b12.BackgroundImage&&b3.BackgroundImage==b13.BackgroundImage&&b4.BackgroundImage==b14.BackgroundImage&&b5.BackgroundImage==b15.BackgroundImage&&b6.BackgroundImage==b16.BackgroundImage&&b7.BackgroundImage==b17.BackgroundImage&&b8.BackgroundImage==b18.BackgroundImage&&b9.BackgroundImage==b19.BackgroundImage)

{

label1.Visible=true;

}}

void TextBox1TextChanged(object sender, System.EventArgs e){

}}

}

50

Page 51: Manual Tecnico

[ ] Simulacion FreeBSD

MazeTriang

51

Page 52: Manual Tecnico

[ ] Simulacion FreeBSD

MazeTraing.resx:using System;using System.Collections.Generic;using System.Drawing;using System.Text;using System.Windows.Forms;// coded by Yelinna Pulliti// http://toyscaos.tripod.com

namespace MazeTry{ public partial class Form1 : Form { private Maze Lab; private bool primeraVez;

public Form1() { InitializeComponent(); }

private void Form1_Paint(object sender, PaintEventArgs e) { Graphics g = e.Graphics; // padd == 20. LimiteV y LimiteH deben ser mùltiplos de padd

int limiteV = 0, limiteH = 0; while (limiteV < this.Height-80) limiteV += 20;

while (limiteH < this.Width) limiteH += 20;

Lab.Generar(g, limiteH , limiteV, primeraVez); primeraVez = false; }

private void Form1_Load(object sender, EventArgs e) { primeraVez = true; Lab = new Maze(); } }}

52

Page 53: Manual Tecnico

[ ] Simulacion FreeBSD

Juego:Serpientes y escaleras

53

Page 54: Manual Tecnico

[ ] Simulacion FreeBSD

Juego:/* * FrmJuego.cs * * Desarrollado por Fernando López Guevara ([email protected]) * * Copyright (C) 2009 * */

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using Juego.Resources;using Juego.Core;

namespace Juego.WinApp{ public partial class FrmJuego : Form { #region Miembros

private SortedDictionary<String, PictureBox> _pics; private SerpientesYEscaleras _Juego; private Jugador _turno;

#endregion

#region Propiedades

public SerpientesYEscaleras Juego { get { return this._Juego; } set { this._Juego = value; } }

public SortedDictionary<String, PictureBox> Pics { get { return this._pics; } set { this._pics = value; } }

#endregion

#region Metodos

/// <summary> /// Contructor

54

Page 55: Manual Tecnico

[ ] Simulacion FreeBSD

/// </summary>

public FrmJuego() { InitializeComponent(); this.Inicializar(); this.SetearRecursos(); }

/// <summary> /// Setea los Labels /// </summary> private void SetearRecursos() { this.Text = Etiquetas.GBL_TI_TituloJuego;

IntPtr hIcon = ((Bitmap)Util.TransparentarImagen(Images.Joystick, Color.White)).GetHicon(); this.Icon = Icon.FromHandle(hIcon);

this.tsbJuegoNuevo.Image = Util.TransparentarImagen(Images.Juego, Color.White); this.tsbJuegoNuevo.Text = Etiquetas.GBL_ET_JuegoNuevo; this.tsbJuegoNuevo.ToolTipText = Etiquetas.GBL_ET_JuegoNuevo;

this.tsbAyuda.Text = Etiquetas.GBL_ET_Ayuda; this.tsbAyuda.Image = Util.TransparentarImagen(Images.Help, Color.White); this.tsbAyuda.ToolTipText = Etiquetas.GBL_ET_Ayuda;

this.tsbAcerca.Image = Util.TransparentarImagen(Images.Information, Color.White); this.tsbAcerca.Text = Etiquetas.GBL_ET_Acercade; this.tsbAcerca.ToolTipText = Etiquetas.GBL_ET_Acercade;

this.tsbSalir.Image = Util.TransparentarImagen(Images.Exit, Color.White); this.tsbSalir.Text = Etiquetas.GBL_ET_Salir; this.tsbSalir.ToolTipText = Etiquetas.GBL_ET_Salir;

this.tsbTerminar.Image = Util.TransparentarImagen(Images.Cancelar, Color.White); this.tsbTerminar.Text = Etiquetas.GBL_ET_TerminarJuego; this.tsbTerminar.ToolTipText = Etiquetas.GBL_ET_TerminarJuego;

this.tsbConfiguration.Text = Etiquetas.GBL_ET_Configuracion; this.tsbConfiguration.Image = Util.TransparentarImagen(Images.Wrench, Color.White); this.tsbConfiguration.ToolTipText = Etiquetas.GBL_ET_Configuracion;

this.gpbJugadores.Text = Etiquetas.GBL_ET_Jugadores;

this.btnTirarDado.Image = Util.TransparentarImagen(Images.ControllerAdd, Color.White); this.btnTirarDado.Text = Etiquetas.GBL_ET_TirarDado; }

/// <summary> /// Inicializa el Form /// </summary>

55

Page 56: Manual Tecnico

[ ] Simulacion FreeBSD

private void Inicializar() { this.tlpTablero.BackgroundImage = Images.Tablero; }

/// <summary> /// Prepara las instancias el juego /// </summary> private void PrepararJuego() { this.Juego = new SerpientesYEscaleras(); this.Juego.TurnoChanged += new EventHandler<JugadorEventArgs>(Juego_TurnoChanged); this.Juego.RefrescarPantalla += new EventHandler<JugadorEventArgs>(RefrescarPantalla);

this.Pics = new SortedDictionary<String, PictureBox>();

for (int i = 1; i < 81; i++) { PictureBox pb = (PictureBox)this.tlpTablero.Controls[String.Format("pbCasillero{0}", i)];

if (pb != null) { pb.Image = null; this.Pics.Add(i.ToString(), pb); pb.SizeMode = PictureBoxSizeMode.CenterImage; } } }

/// <summary> /// Actualiza la Pantalla en caso de Reglas del juego /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RefrescarPantalla(object sender, JugadorEventArgs e) { this.LimpiarCasillero(e.Jugador, e.Posicion);

foreach (Jugador j in this.Juego.Jugadores) { this.SetearImagenJugador(j); } }

/// <summary> /// Notifica el Cambio de Turno /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Juego_TurnoChanged(object sender, JugadorEventArgs e) { this._turno = e.Jugador; this.lblTurno.Text = String.Format(Etiquetas.GBL_ET_Turno, this._turno.Nombre);

if (!this.lblTurno.Visible) this.lblTurno.Visible = true; }

56

Page 57: Manual Tecnico

[ ] Simulacion FreeBSD

/// <summary> /// Sale del Form /// </summary> /// <param name="sender"></param> private void tsbSalir_Click(object sender, EventArgs e) { this.Close(); }

/// <summary> /// Muestra la Ventana de Jugadores y Prepara el Juego /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsbJuegoNuevo_Click(object sender, EventArgs e) {

FrmJugadores frm = new FrmJugadores();

frm.ShowDialog();

if (frm.ListaJugadores.Count > 0) { this.PrepararJuego();

this.Juego.JuegoNuevo(frm.ListaJugadores);

this.SetearPantalla(); } }

/// <summary> /// Muestra los Controles /// </summary>private void SetearPantalla() {

this.SetEstado(); this.gpbJugadores.Visible = true; this.btnTirarDado.Visible = true; this.tsbTerminar.Enabled = true; this.btnTirarDado.Enabled = true; this.lstEstado.Items.Clear(); this.tsbJuegoNuevo.Enabled = false; this.tlpTablero.Visible = true; this.lstEstado.Visible = true; }

/// <summary> /// Muestra el estado de cada Jugador /// </summary> private void SetEstado() {

Int32 i = 1;

foreach (Jugador j in this.Juego.Jugadores) { Label lbl = (Label)this.gpbJugadores.Controls[String.Format("lblJugador{0}", i)];

if (lbl != null)

57

Page 58: Manual Tecnico

[ ] Simulacion FreeBSD

{ lbl.Text = String.Format(Etiquetas.GBL_ET_EstadoJugador, i, j.Nombre, j.Posicion); lbl.Visible = true;

PictureBox pb = (PictureBox)this.gpbJugadores.Controls[String.Format("pbJugador{0}", i)]; if (pb != null) { pb.Visible = true; pb.Image = Util.TransparentarImagen(j.Imagen); } }

i++; } }

/// <summary> /// Termina el Juego /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsbTerminar_Click(object sender, EventArgs e) { this.gpbJugadores.Visible = false;

foreach (Control c in this.gpbJugadores.Controls) { if (c.Name.Contains(Etiquetas.GBL_ET_Jugador)) c.Visible = false; }

this.btnTirarDado.Visible = false; this.tsbTerminar.Enabled = false; this.tsbJuegoNuevo.Enabled = true; this.tlpTablero.Visible = false; this.lstEstado.Visible = false; }

/// <summary> /// Muestra la ventana Acerca de... /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tsbAcerca_Click(object sender, EventArgs e) { AboutBoxJuego abj = new AboutBoxJuego(); abj.ShowDialog(); }

/// <summary> /// Tira el dado /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnTirarDado_Click(object sender, EventArgs e) { this.LimpiarCasillero(this._turno);

this._turno.DadoTirado += new EventHandler<StatEventArgs>(turno_DadoTirado);

58

Page 59: Manual Tecnico

[ ] Simulacion FreeBSD

this._turno.TirarDado(); this.SetearImagenJugador(this._turno); this.Juego.MoverJugador(this._turno); this.SetEstado(); this.btnTirarDado.Enabled = !this.Juego.JuegoTerminado;

if (this.Juego.JuegoTerminado) { MessageBox.Show(String.Format(Etiquetas.GBL_MG_Ganador, this.Juego.JugadorGanador)); this.tsbJuegoNuevo.Enabled = true; this.tsbTerminar.Enabled = false; }

}

/// <summary> /// Notifica los resultados de la tirada de dado /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void turno_DadoTirado(object sender, StatEventArgs e) { String state = String.Format(Etiquetas.GBL_MG_Jugada, new Object[4] { ((Jugador)sender).Nombre, e.ValorDado, e.PosicionAnterior, e.PosicionNueva });

this.lstEstado.Items.Insert(0, state);

((Jugador)sender).DadoTirado -= turno_DadoTirado; }

/// <summary> /// Limpia un casillero /// </summary> /// <param name="j"></param> private void LimpiarCasillero(Jugador j) { this.LimpiarCasillero(j, -1); }

/// <summary> /// Limpia Casillero /// </summary> /// <param name="j"></param> /// <param name="posAnt"></param> private void LimpiarCasillero(Jugador j, Int32 posAnt) { if (j.Posicion > 0 && j.Posicion < 81) { PictureBox pb;

pb = this.Pics[j.Posicion.ToString()];

if (pb != null) pb.Image = null;

59

Page 60: Manual Tecnico

[ ] Simulacion FreeBSD

if (posAnt > 0) { pb = this.Pics[posAnt.ToString()];

if (pb != null) pb.Image = null; } } }

/// <summary> /// Setea la imagen de un jugador en un casillero /// </summary> /// <param name="j"></param> private void SetearImagenJugador(Jugador j) { if (j.Posicion > 0 && j.Posicion < 81) { PictureBox pb = this.Pics[j.Posicion.ToString()];

if (pb != null) { pb.Image = Util.TransparentarImagen(j.Imagen); ; } } }

#endregion

private void tsbAyuda_Click(object sender, EventArgs e) { FrmAyuda frm = new FrmAyuda(); frm.ShowDialog(); }

private void tsbConfiguration_Click(object sender, EventArgs e) { FrmConfiguracion frm = new FrmConfiguracion();

frm.ShowDialog(); } }}

60