private void btnFinished_Click(object sender, System.EventArgs e) { FrmParent.PostActivity(); string ControlAddress = tbVSSControlAddress.Text; string UploadAddress = tbVSSUploadAddress.Text; int ControlPort = 0; bool IsUploadFTP = chkIsUploadFTP.Checked; lbVSSControlAddress.ForeColor = Color.Black; lbVSSControlPort.ForeColor = Color.Black; lbUploadAddress.ForeColor = Color.Black; if(ControlAddress == "") { MessageBox.Show("Must enter a Control Address!"); lbVSSControlAddress.ForeColor = Color.Red; return; } try { ControlPort = System.Convert.ToInt32(tbVSSControlPort.Text,10); if((ControlPort < 1)||(ControlPort > 65535)) ControlPort = System.Convert.ToInt32("Mess this up on purpose to trigger catch!",10); } catch { MessageBox.Show("Control Port must be a value between 1 and 65535!"); lbVSSControlPort.ForeColor = Color.Red; return; } if(g_objVSS != null) { if((g_objVSS.ControlAddress.ToUpper() != tbVSSControlAddress.Text.ToUpper())||(g_objVSS.ControlPort != ControlPort)) { if(!FrmParent.OSystem.CheckAddressPortPair(tbVSSControlAddress.Text,ControlPort)) { MessageBox.Show("Address/Port Pair not unique in system"); lbVSSControlAddress.ForeColor = Color.Red; lbVSSControlPort.ForeColor = Color.Red; return; } } } else { if(!FrmParent.OSystem.CheckAddressPortPair(tbVSSControlAddress.Text,ControlPort)) { MessageBox.Show("Address/Port Pair not unique in system"); lbVSSControlAddress.ForeColor = Color.Red; lbVSSControlPort.ForeColor = Color.Red; return; } } if(UploadAddress.Length == 0) { DialogResult DR = MessageBox.Show("Warning Upload Address is blank. You may proceed but uploading video to this Video Storage Server may not work properly until the Upload Address is assigned. Continue?","Proceed without assigning an Upload Address?",MessageBoxButtons.YesNoCancel); if((DR == DialogResult.No)||(DR == DialogResult.Cancel)) { lbUploadAddress.ForeColor = Color.Red; return; } } OysterClassLibrary.Functions F = new OysterClassLibrary.Functions(); OysterClassLibrary.VideoStorageServerTypes AVST = F.ALLVideoStorageServerTypes(); int VSSTypeId = 0; foreach(OysterClassLibrary.VideoStorageServerType VST in AVST) { if(VST.Description == cbVSSType.Text) { VSSTypeId = VST.ID; } } if(g_objVSS == null) { try { F.CreateVideoStorageServer(ControlAddress,ControlPort,UploadAddress,IsUploadFTP,tbStorageDirectory.Text,VSSTypeId); //cvosSysAdmin.CreateVideoStorageServer(ControlAddress,ControlPort,UploadAddress,IsUploadFTP,LoginUser.SystemID,"",ref ErrorNumber); this.DialogResult = DialogResult.OK; } catch(Exception Err) { MessageBox.Show(Err.Message); return; } } else { try { g_objVSS.Update(ControlAddress,ControlPort,UploadAddress,IsUploadFTP,tbStorageDirectory.Text,VSSTypeId); this.DialogResult = DialogResult.OK; } catch(Exception Err) { MessageBox.Show(Err.Message); return; } } }