/// <summary> /// new constructor with spreasheet as parameter, and Spreadsheetmodel /// it will call the spreadsheet model constructor first /// </summary> /// <param name="ss"></param> public Form1(Spreadsheet ss, SpreadsheetModel ssm) : this() { this.ss = ss; this.spreadsheetmodel = ssm; BindingModelEvent(); }
public filechooser(SpreadsheetModel ssm) : this() { this.spreadsheetmodel = ssm; ssm.AuthenticationSuccessEvent += AuthenticationSuccessEvent; ssm.ERROR_Event += DuplicateFileName; }
public filechooser(SpreadsheetModel ssm) : this() { this.spreadsheetmodel = ssm; ssm.AuthenticationSuccessEvent += AuthenticationSuccessEvent; ssm.AuthenticationFailEvent += AuthenticationFailEvent; }
public filechooser(SpreadsheetModel ssm) : this() { this.spreadsheetmodel = ssm; BindingModelEvent(); String command = "PASSWORD\x1B" + SpreadsheetModel.password + "\n"; // initial the password command spreadsheetmodel.Connect(command); }
/// <summary> /// constructor with all the filename exist in the server and spreadsheetmodel who has socket /// </summary> public filechooser(String filenames, SpreadsheetModel ssm) : this() { this.filenames = filenames; spreadsheetmodel = ssm; BindingModelEvent(); // bingding the FileChooser event to spreadsheetmodel each_filename = CommandParser(filenames); foreach (String item in each_filename) { if (item != "FILELIST") fileChooser.Items.Add(item); } }
private void opencreateToolStripMenuItem_Click(object sender, EventArgs e) { String command = "PASSWORD\x1B" + SpreadsheetModel.password + "\n"; // initial the password command SpreadsheetModel ssm = new SpreadsheetModel(); //SpreadsheetApplicationContext appContext = SpreadsheetApplicationContext.getAppContext(); //appContext.RunForm(new SpreadsheetGUI.Form1()); spreadsheetPanel1.Invoke(new Action(() => { Thread thread = new Thread(() => { Application.Run(new FileChooser.filechooser(ssm)); }); thread.Start(); })); ssm.Connect(command); }
/// <summary> /// Authentication /// When the spreadsheet client is run the user will be prompted to enter /// a password to gain access to the server. The format of the message /// with which the client will request authentication is as follows: /// /// PASSWORD[esc]password\n /// </summary> private void button1_Click(object sender, EventArgs e) { //check if the IP address and the port is vaild. if (!Is_The_IP_Vaild()) { return; } SpreadsheetModel.IP = ServerIP.Text; // get the server Ip address. SpreadsheetModel.password = Password.Text; // get the password for authentication. String command = "PASSWORD\x1B" + SpreadsheetModel.password + "\n"; // initial the password command. spreadsheetmodel = new SpreadsheetModel(); // initial the spreadsheetmodel. BindingModelEvent(); // binding the function to the model. spreadsheetmodel.Connect(command); // Connect the socket to the server. }
private void opencreateToolStripMenuItem_Click(object sender, EventArgs e) { SpreadsheetModel ssm = new SpreadsheetModel(); //ssm.Connect(command); spreadsheetPanel1.Invoke(new Action(() => { Thread thread = new Thread(() => { Application.Run(new FileChooser.filechooser(ssm)); }); thread.Start(); })); }