private void conMenu_Dialog2_Click(object sender, System.EventArgs e) { //show the disconnection dialog NetworkDrive oNetDrive = new NetworkDrive(); oNetDrive.ShowDisconnectDialog(this); oNetDrive = null; }
private void button3_Click_1(object sender, System.EventArgs e) { var oNetDrive = new NetworkDrive(); zUpdateStatus("Mapping drive..."); try { //set propertys oNetDrive.Force = this.conForce.Checked; oNetDrive.Persistent = this.conPersistant.Checked; oNetDrive.LocalDrive = txtDrive.Text; oNetDrive.PromptForCredentials = conPromptForCred.Checked; oNetDrive.ShareName = txtAddress.Text; oNetDrive.SaveCredentials = conSaveCred.Checked; //match call to options provided if(txtPassword.Text == "" && txtUsername.Text == "") { oNetDrive.MapDrive(); } else if(txtUsername.Text == "") { oNetDrive.MapDrive(txtPassword.Text); } else { oNetDrive.MapDrive(txtUsername.Text, txtPassword.Text); } //update status zUpdateStatus("Drive map successful"); _CB(oNetDrive); } catch(Exception err) { //report error zUpdateStatus("Cannot map drive! - " + err.Message); MessageBox.Show(this, "Cannot map drive!\nError: " + err.Message); } oNetDrive = null; }