private void button2_Click(object sender, EventArgs e) { if (savepages()) { var p = new Prompt(LocRm.GetString("Name"), ""); if (p.ShowDialog(this) == DialogResult.OK) { var t = p.Val.Replace(",","").Trim(); if (t != "") { var cg = MainForm.Conf.Permissions.ToList(); cg.Add(new configurationGroup {featureset = 0, name = t, password = ""}); MainForm.Conf.Permissions = cg.ToArray(); initgroups(); } } p.Dispose(); } }
private void btnAddPreset_Click(object sender, EventArgs e) { var p = new Prompt(LocRm.GetString("EnterName"),""); if (p.ShowDialog(this)==DialogResult.OK) { var s = p.Val.Trim(); if (!String.IsNullOrEmpty(s)) { if (CameraControl.PTZ != null) { CameraControl.PTZ.AddPreset(s); PopOnvifPresets(); } } } p.Dispose(); }
private void btnTestSMTP_Click(object sender, EventArgs e) { SaveSMTPSettings(); var p = new Prompt(LocRm.GetString("TestMailTo"), MainForm.Conf.SMTPFromAddress); if (p.ShowDialog(this) == DialogResult.OK) { MessageBox.Show(this, Mailer.Send(p.Val, LocRm.GetString("test"), LocRm.GetString("ISpyMessageTest")) ? LocRm.GetString("MessageSent") : LocRm.GetString("FailedCheckLog")); } }
private void btnFeatureSet_Click(object sender, EventArgs e) { if (MainForm.Group != "Admin") { var ap = EncDec.DecryptData(MainForm.Conf.Permissions.First(q => q.name == "Admin").password,MainForm.Conf.EncryptCode); var p = new Prompt(LocRm.GetString("AdminPassword"), "", true); p.ShowDialog(this); string pwd = p.Val; p.Dispose(); if (pwd != ap) { MessageBox.Show(this, LocRm.GetString("PasswordIncorrect")); return; } } var f = new Features(); f.ShowDialog(this); f.Dispose(); MainClass.RenderResources(); }
private void linkLabel8_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { var p = new Prompt(LocRm.GetString("NetworkAddress"), "http://192.168.0.1/onvif/device_service"); if (p.ShowDialog(this) == DialogResult.OK) { Uri u; if (!Uri.TryCreate(p.Val, UriKind.Absolute, out u)) { MessageBox.Show(this, LocRm.GetString("InvalidURI")); return; } var devHolder = new DeviceDescriptionHolder { Uris = new[] { u }, Address = "" }; devHolder.Address += u.DnsSafeHost + "; "; devHolder.Address = devHolder.Address.TrimEnd(';', ' '); if (devHolder.Address == "") { devHolder.IsInvalidUris = true; devHolder.Address = LocRm.GetString("InvalidURI"); } devHolder.Name = u.AbsoluteUri; devHolder.Location = LocRm.GetString("Unknown"); devHolder.DeviceIconUri = null; MainForm.ONVIFDevices.Add(devHolder); lbONVIFDevices.Items.Add(new MainForm.ListItem2(devHolder.Name, MainForm.ONVIFDevices.Count - 1)); } p.Dispose(); }
private void linkLabel6_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { if (lbONVIFDevices.SelectedIndex > -1) { var dev = MainForm.ONVIFDevices[lbONVIFDevices.SelectedIndex]; var p = new Prompt(LocRm.GetString("NetworkAddress"), dev.Uris[0].AbsoluteUri); if (p.ShowDialog(this) == DialogResult.OK) { Uri u; if (!Uri.TryCreate(p.Val, UriKind.Absolute, out u)) { MessageBox.Show(this, LocRm.GetString("InvalidURI")); return; } dev.Uris = new[] {u}; dev.Address = ""; dev.Address += u.DnsSafeHost + "; "; dev.Address = dev.Address.TrimEnd(';', ' '); if (dev.Address == "") { dev.IsInvalidUris = true; dev.Address = LocRm.GetString("InvalidURI"); } dev.Name = u.AbsoluteUri; dev.Location = LocRm.GetString("Unknown"); dev.DeviceIconUri = null; lbONVIFDevices.Refresh(); } p.Dispose(); } }