private void Button_scan_Click(object sender, EventArgs e) { button_scan.Enabled = false; UnicastIPAddressInformation ipInfo = ((EthernetInterface)box_interface.SelectedValue).IP; IPAddress host = ipInfo.Address; (IPAddress start, IPAddress end, int count) = NetworkManager.GetSubnetRange(host, ipInfo.IPv4Mask); scanEvent = new CountdownEvent(count); panel_list.Controls.Clear(); panel_main.Controls.Clear(); WaitPanel panel = new WaitPanel(ref scanEvent); panel.Dock = DockStyle.Fill; panel_main.Controls.Add(panel); IPAddress ip = start; while (!ip.Equals(end)) { ThreadPool.QueueUserWorkItem(TestModule, ip); ip = NetworkManager.NextAddress(ip); } }
private void sendPetition_Click(object sender, System.EventArgs e) { WaitPanel p = new WaitPanel("Wait_04", base.Size.Width, base.Size.Height); p.setWaitPanel("Trwa generowanie wniosku", "Proszę czekać"); p.setSize(this.passwordPanel.Size); p.setLocation(this.passwordPanel.Location); base.Controls.Add(p.getPanel()); base.Controls[p.getName()].BringToFront(); p.setVisible(true); string uri = "certificates/csrwrite"; Certificate certificate = new Certificate(); certificate.generateCSR(this.ou, this.user, this.passwordCert1.Text); string postData = "csr=" + HttpUtility.UrlEncode(certificate.getCSR()) + "&token=" + HttpUtility.UrlEncode(this.token); p.setWaitPanel("Trwa wysyłanie wniosku", "Proszę czekać"); Code res = this.con.postReq(uri, postData, 0); if (res.getcode() == 0) { MessageBox.Show("Wniosek o licencje został wysłany", "Uwaga"); } else { MessageBox.Show(res.getText(), "Uwaga"); } p.setVisible(false); base.Close(); }
private void addFilesToolStripMenuItem_Click(object sender, EventArgs e) { if (openVideoDialog.ShowDialog() == DialogResult.OK) { this.Enabled = false; WaitPanel.Left = (this.Width / 2) - (WaitPanel.Width / 2); WaitPanel.Top = (this.Height / 2) - (WaitPanel.Height / 2); WaitPanel.Visible = true; WaitPanel.BringToFront(); FileList.BeginUpdate(); WaitPanel.Refresh(); try { foreach (string fileName in openVideoDialog.FileNames) { Application.DoEvents(); AddFileToList(fileName); } } finally { WaitPanel.Visible = false; FileList.EndUpdate(); this.Enabled = true; } } }
private void addFolderTreeToolStripMenuItem_Click(object sender, EventArgs e) { if (Directory.Exists(_settings.LastDirectory)) { openFolderDialog.SelectedPath = _settings.LastDirectory; } if (openFolderDialog.ShowDialog() == DialogResult.OK) { string folderPath = openFolderDialog.SelectedPath; _settings.LastDirectory = folderPath; this.Enabled = false; WaitPanel.Left = (this.Width / 2) - (WaitPanel.Width / 2); WaitPanel.Top = (this.Height / 2) - (WaitPanel.Height / 2); WaitPanel.Visible = true; WaitPanel.BringToFront(); FileList.BeginUpdate(); WaitPanel.Refresh(); try { var files = ListFiles(folderPath, SearchOption.AllDirectories); foreach (string file in files) { Application.DoEvents(); AddFileToList(file); } } finally { WaitPanel.Visible = false; FileList.EndUpdate(); this.Enabled = true; } } }
/// <summary> /// Start a thread to load the document /// </summary> override internal void LoadDocument() { Tracer.Verbose("XpsReportDocument:LoadDocument", "START"); try { base.LoadDocument(); Worker.DoWork += new DoWorkEventHandler(bw_DoWork); Worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted); // Start the asynchronous operation. if (!string.IsNullOrEmpty(Context.FullName) || Context.Entity != null) { Worker.RunWorkerAsync(base.Context); } else { WaitPanel.Stop(); } } catch (Exception all) { Tracer.Error("XpsReportDocument.LoadDocument", all); } finally { Tracer.Verbose("XpsReportDocument:LoadDocument", "END"); } }
/// <summary> /// Thread completed management /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { // First, handle the case where an exception was thrown. if (e.Error != null) { Tracer.Error("HelpDocument.bw_RunWorkerCompleted", e.Error); } else { Tracer.Verbose("HelpDocument:bw_RunWorkerCompleted", "START"); try { if (e.Result != null && e.Result is XpsDocument) { XpsDocument xps = (XpsDocument)e.Result; documentViewer1.Document = xps.GetFixedDocumentSequence(); ContentData = xps; } WaitPanel.Stop(); } catch (Exception all) { Tracer.Error("HelpDocument.bw_RunWorkerCompleted", all); } finally { Tracer.Verbose("HelpDocument:bw_RunWorkerCompleted", "END"); } } }
/// <summary> /// Thread completed management /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { // First, handle the case where an exception was thrown. if (e.Error != null) { Tracer.Error("TemplateDocument.bw_RunWorkerCompleted", e.Error); return; } else { Tracer.Verbose("TemplateDocument:bw_RunWorkerCompleted", "START"); try { if (e.Result != null && e.Result is string) { this.SyntaxEditor.Text = e.Result as string; } WaitPanel.Stop(); } catch (Exception all) { Tracer.Error("TemplateDocument.bw_RunWorkerCompleted", all); } finally { Tracer.Verbose("TemplateDocument:bw_RunWorkerCompleted", "END"); } } }
public RegionList() { this.InitializeComponent(); this.path = System.IO.Path.GetTempPath() + "KBW"; this.con = new Connection(); this.jns = ""; this.wait = new WaitPanel("Wait2", base.Width, base.Height); base.Controls.Add(this.wait.getPanel()); base.Controls[this.wait.getName()].BringToFront(); this.start = null; this.licensepath = ""; }
/// <summary> /// After the thread complete, load the xaml home document /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { // First, handle the case where an exception was thrown. if (e.Error != null) { Tracer.Error("HomeDocument.bw_RunWorkerCompleted", e.Error); } else { Tracer.Verbose("HomeDocument:bw_RunWorkerCompleted", "START"); UrlSaveHelper hlp = (UrlSaveHelper)e.Result; // Finally, handle the case where the operation succeeded. if (File.Exists(base.Context.FullName)) { try { FileStream fs = File.OpenRead(base.Context.FullName); FlowDocViewer.Document = (FlowDocument)XamlReader.Load(fs); fs.Close(); Tracer.Verbose("HomeDocument:bw_RunWorkerCompleted", "Internet document loaded"); } catch (Exception) { //load the config from resources using (Stream fs = Application.ResourceAssembly.GetManifestResourceStream("ReflectionStudio.Resources.Embedded.Home.xaml")) { if (fs == null) { throw new InvalidOperationException("Could not find embedded resource"); } FlowDocViewer.Document = (FlowDocument)XamlReader.Load(fs); fs.Close(); Tracer.Verbose("HomeDocument:bw_RunWorkerCompleted", "Local document loaded"); } } ParseHyperlink(FlowDocViewer.Document); WaitPanel.Stop(); Tracer.Verbose("HomeDocument:bw_RunWorkerCompleted", "END"); } } }
private void LoginNext_Click(object sender, System.EventArgs e) { if (this.con.IsAvailableNetworkActive()) { WaitPanel p = new WaitPanel("Wait_04", base.Size.Width, base.Size.Height); p.setWaitPanel("Trwa autoryzacja użytkownika", "Proszę czekać"); p.setSize(this.passwordPanel.Size); p.setLocation(this.passwordPanel.Location); base.Controls.Add(p.getPanel()); base.Controls[p.getName()].BringToFront(); p.setVisible(true); string postData = "flag=kalkulator&login="******"&password="******"") { this.user = logData.getUser(); this.ou = string.Concat(new string[] { logData.getElections(), "-", logData.getJns(), "-", logData.getRola() }); if (logData.getRola() == "P" || logData.getRola() == "Z") { this.ou = this.ou + "-" + logData.getObwodu(); } this.token = logData.getToken(); this.step1(); } else { MessageBox.Show("Podano błędny login lub hasło", "Uwaga"); base.Close(); } } else { MessageBox.Show("Nie masz połaczenia z internetem!", "Uwaga"); base.Close(); } }
public SendProtocol() { this.InitializeComponent(); this.codeWarning = ""; this.headerName = ""; this.committeeName = ""; this.candidatesName = ""; this.protocolDefinitionName = ""; this.validateDefinitionName = ""; this.protocolDefinition = new XmlDocument(); this.candidates = new XmlDocument(); this.committee = new XmlDocument(); this.validateDefinition = new XmlDocument(); this.header = new XmlDocument(); this.path = System.IO.Path.GetTempPath() + "KBW"; this.goodcertificate = false; this.wait = new WaitPanel("Wait3", base.Width, base.Height); this.form = null; }
public RegionList(Start start, string licensepath, string jns) { this.con = new Connection(); this.path = System.IO.Path.GetTempPath() + "KBW"; this.InitializeComponent(); this.licensepath = licensepath; this.jns = jns; this.start = start; this.Text = this.Text + " (" + Kalkulator1.instalClass.Version.getVersion().ToString() + ")"; this.wait = new WaitPanel("Wait99", base.Width, base.Height); base.Controls.Add(this.wait.getPanel()); base.Controls[this.wait.getName()].BringToFront(); this.exit = false; this.getRegions(true); if (this.exit) { base.Close(); } }
private void FixedUpdate() { if (isTouch) { touchTimer += Time.fixedDeltaTime; if (touchTimer > returnTimer) { CloseCircle(); touchTimer = 0; isTouch = false; isCheck = false; } } if (!isCheck) { return; } for (int i = 0; i < moveImageList.Count; i++) { if (WaitPanel.IsInCircle(transform.localPosition, 800, moveImageList[i].currentPos)) { if (!moveImageList[i].bigImageList.Contains(bigImage)) { moveImageList[i].bigImageList.Add(bigImage); moveImageList[i].isInCircle = true; } } else { if (moveImageList[i].bigImageList.Contains(bigImage)) { moveImageList[i].bigImageList.Remove(bigImage); if (moveImageList[i].bigImageList.Count <= 0) { moveImageList[i].isInCircle = false; } } } } currentPos = this.transform.localPosition; }
private void log_Click(object sender, System.EventArgs e) { if (this.con.IsAvailableNetworkActive()) { bool logged = this.c.readKey(this.licensePath, this.password.Text); if (logged) { WaitPanel p = new WaitPanel("Wait_04", base.Size.Width, base.Size.Height); p.setWaitPanel("Trwa importowanie danych", "Proszę czekać"); p.setSize(this.passwordPanel.Size); p.setLocation(this.passwordPanel.Location); base.Controls.Add(p.getPanel()); base.Controls[p.getName()].BringToFront(); p.setVisible(true); string[] filenameTab = this.name.Split(new char[] { '\\' }); string filename = filenameTab[filenameTab.Length - 1]; string uri = "protocols/import"; string post = "flag=import&filename=" + HttpUtility.UrlEncode(filename); string[] item = filename.Split(new char[] { '-' }); post = post + "&akcja=" + HttpUtility.UrlEncode(item[0].Replace('_', '/')); post = post + "&jsn=" + item[1]; post = post + "&obw=" + item[2]; post = post + "&inst=" + item[3]; string[] okr = item[4].Replace(".xml", "").Split(new char[] { ' ' }); post = post + "&okr=" + okr[0]; string xml = string.Concat(new string[] { "<import><header><jns_kod>", item[1], "</jns_kod><nrObwodu>", item[2], "</nrObwodu>" }); xml = xml + "<id_intytucji>" + this.instId + "</id_intytucji>"; xml = xml + "<id_okregu>" + this.okregId + "</id_okregu></header></import>"; try { Certificate cer = new Certificate(); cer.SignXmlText(xml, System.IO.Path.GetTempPath() + "KBW\\tmp\\import.xml", this.password.Text, this.licensePath); System.IO.StreamReader sr = new System.IO.StreamReader(System.IO.Path.GetTempPath() + "KBW\\tmp\\import.xml"); xml = sr.ReadToEnd(); sr.Close(); } catch (System.Exception ex) { MessageBox.Show("Import protokołu: " + ex.Message, "Error"); } post = post + "&xmlImport=" + HttpUtility.UrlEncode(xml); ResponseData res = this.con.postImport(uri, post, 0); if (res.getCode().getcode() == 0) { System.IO.StreamWriter sw = new System.IO.StreamWriter(this.name, false); sw.Write(res.getXml()); sw.Close(); this.form2.imported = true; base.Close(); } else { MessageBox.Show(res.getCode().getText(), "Import"); this.form2.imported = false; } p.setVisible(true); } else { this.label6.Visible = true; this.form2.imported = false; } } else { MessageBox.Show("Nie masz połaczenia z internetem!", "Uwaga"); base.Close(); } }
protected override void Awake() { base.Awake(); instance = this; }
private void send_Click(object sender, System.EventArgs e) { this.obwodList_Validated(this.obwodList, e); this.currentLwyb_Validated(this.currentLwyb, e); this.attendanceHour_Validated(this.attendanceHour, e); this.number_Validated(this.attendanceValue, e); if ((!this.errorValue.Visible && !this.errorHour.Visible && !this.errorOBW.Visible && !this.errorCurrentLwyb.Visible) || (!this.errorValue.Visible && !this.errorHour.Visible && !this.errorOBW.Visible && this.errorCurrentLwyb.Visible && this.errorCurrentLwyb.Text == "Liczba wyborców uprawnionych do głosowania jest mniejsza od 110% i większa od 90% szacowanej liczby wyborców (" + (this.obwodList.SelectedItem as AttendanceOBWItem).getLwyb().ToString() + ").")) { WaitPanel p = new WaitPanel("Wait_04", base.Size.Width, base.Size.Height); p.setWaitPanel("Trwa importowanie danych", "Proszę czekać"); p.setSize(this.FormPanel.Size); p.setLocation(this.FormPanel.Location); base.Controls.Add(p.getPanel()); base.Controls[p.getName()].BringToFront(); p.setVisible(true); string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"; xml += "<save>"; string hour = ""; try { if (this.attendanceHour.SelectedItem != null) { hour = (this.attendanceHour.SelectedItem as AttendanceItem).getName(); } } catch (System.Exception ex) { } string value = ""; try { if (this.attendanceValue.Text != null) { value = this.attendanceValue.Text; } } catch (System.Exception ex) { } string text = xml; xml = string.Concat(new string[] { text, "<attendance><attendanceHour>", hour, "</attendanceHour><attendanceValue>", value, "</attendanceValue><currentLwyb>", this.currentLwyb.Text, "</currentLwyb></attendance>" }); xml += "<header>"; xml += this.getHeader(this.header); xml += "</header>"; xml += "</save>"; Commit c = new Commit(this.licensePath, this); c.ShowDialog(); if (this.logged) { try { Certificate cer = new Certificate(); cer.SignXmlText(xml, System.IO.Path.GetTempPath() + "KBW\\tmp\\attendance.xml", this.password, this.licensePath); System.IO.StreamReader sr = new System.IO.StreamReader(System.IO.Path.GetTempPath() + "KBW\\tmp\\attendance.xml"); xml = sr.ReadToEnd(); sr.Close(); string uri = "attendances/readval/" + HttpUtility.UrlEncode((this.attendanceHour.SelectedItem as AttendanceItem).getName()); string post = "xml=" + HttpUtility.UrlEncode(xml); Connection con = new Connection(); Code res = con.postReq(uri, post, 0); MessageBox.Show(res.getText(), "Komunikat"); } catch (System.Exception ex) { MessageBox.Show("Błąd utworzenia wiadomości: " + ex.Message, "Uwaga"); } } p.setVisible(false); } }
private void Awake() { instance = this; }
public SendProtocol(ProtocolsList form, XmlDocument header, string protocolDefinition, string candidates, string committee, string validateDefinition, string save, string OU, string licensePath) { this.InitializeComponent(); this.Text = this.Text + " (" + Kalkulator1.instalClass.Version.getVersion().ToString() + ")"; this.licensePath = licensePath; this.path = System.IO.Path.GetTempPath() + "KBW"; this.preview.Width = 750; this.codeWarning = ""; this.wait = new WaitPanel("Wait3", base.Width, base.Height); base.Controls.Add(this.wait.getPanel()); base.Controls[this.wait.getName()].BringToFront(); this.form = form; this.OU = OU; form.wait.setWaitPanel("Trwa otwieranie formularza protokołu", "Proszę czekać"); form.wait.setVisible(true); this.errorProvider1 = new ErrorProvider(); string[] p = protocolDefinition.Split(new char[] { '\\' }); this.protocolDefinitionName = p[p.Length - 1].Replace('_', '/').Replace(".xml", ""); string[] p2 = candidates.Split(new char[] { '\\' }); this.candidatesName = p2[p2.Length - 1].Replace('_', '/').Replace(".xml", ""); string[] p3 = committee.Split(new char[] { '\\' }); this.committeeName = p3[p3.Length - 1].Replace('_', '/').Replace(".xml", ""); string[] p4 = validateDefinition.Split(new char[] { '\\' }); this.validateDefinitionName = p4[p4.Length - 1].Replace('_', '/').Replace(".xml", ""); string[] p5 = this.committeeName.Split(new char[] { '-' }); if (p5.Length > 2) { this.headerName = p5[0] + "-" + p5[1]; } form.wait.setWaitPanel("Trwa otwieranie formularza protokołu - wczytywanie danych", "Proszę czekać"); try { this.header = new XmlDocument(); this.header = header; this.savePath = save; if (protocolDefinition != "") { this.protocolDefinition = new XmlDocument(); if (System.IO.File.Exists(protocolDefinition)) { this.protocolDefinition.Load(protocolDefinition); } } if (candidates != "") { this.candidates = new XmlDocument(); if (System.IO.File.Exists(candidates)) { this.candidates.Load(candidates); } } if (committee != "") { this.committee = new XmlDocument(); if (System.IO.File.Exists(committee)) { this.committee.Load(committee); } } if (validateDefinition != "") { this.validateDefinition = new XmlDocument(); if (System.IO.File.Exists(validateDefinition)) { this.validateDefinition.Load(validateDefinition); } } if (save != "") { this.save = new XmlDocument(); if (System.IO.File.Exists(save)) { this.save.Load(save); } } } catch (XmlException e) { MessageBox.Show("Nieprawidłowy XML: " + e.Message, "Error"); } this.goodcertificate = false; form.wait.setWaitPanel("Trwa otwieranie formularza protokołu - sprawdzanie plikow definicyjnych formularza protokołu", "Proszę czekać"); try { bool isKlk = true; bool isupdatedKlk = true; string kom = "Nieaktualnie pliki definicyjne: "; int i = 0; XmlNode klk = this.save.SelectSingleNode("/save/header/defklk"); foreach (XmlNode j in klk) { XmlNode name = j.Attributes.GetNamedItem("name"); XmlNode data_wersji = j.Attributes.GetNamedItem("data_wersji"); if (name != null && data_wersji != null) { if (this.protocolDefinitionName == name.Value) { XmlNode wersja = this.protocolDefinition.SelectSingleNode("/protokol_info").Attributes.GetNamedItem("data_wersji"); if (wersja != null && data_wersji.Value != wersja.Value) { if (i == 0) { string text = kom; kom = string.Concat(new string[] { text, this.protocolDefinitionName, " (wymagany z dnia ", data_wersji.Value, ")" }); } else { string text = kom; kom = string.Concat(new string[] { text, ", ", this.protocolDefinitionName, " (wymagany z dnia ", data_wersji.Value, ")" }); } i++; isupdatedKlk = false; } } else { if (this.candidatesName == name.Value) { XmlNode wersja = this.candidates.SelectSingleNode("/listy").Attributes.GetNamedItem("data_aktualizacji"); if (wersja != null && data_wersji.Value != wersja.Value) { if (i == 0) { string text = kom; kom = string.Concat(new string[] { text, this.candidatesName, " (wymagany z dnia ", data_wersji.Value, ")" }); } else { string text = kom; kom = string.Concat(new string[] { text, ", ", this.candidatesName, " (wymagany z dnia ", data_wersji.Value, ")" }); } i++; isupdatedKlk = false; } } else { if (this.committeeName == name.Value) { XmlNode wersja = this.committee.SelectSingleNode("/komisja_sklad").Attributes.GetNamedItem("data_wersji"); if (wersja != null && data_wersji.Value != wersja.Value) { if (i == 0) { string text = kom; kom = string.Concat(new string[] { text, this.committeeName, " (wymagany z dnia ", data_wersji.Value, ")" }); } else { string text = kom; kom = string.Concat(new string[] { text, ", ", this.committeeName, " (wymagany z dnia ", data_wersji.Value, ")" }); } i++; isupdatedKlk = false; } } else { if (this.validateDefinitionName == name.Value) { XmlNode wersja = this.validateDefinition.SelectSingleNode("/validate_info").Attributes.GetNamedItem("data_wersji"); if (wersja != null && data_wersji.Value != wersja.Value) { if (i == 0) { string text = kom; kom = string.Concat(new string[] { text, this.validateDefinitionName, " (wymagany z dnia ", data_wersji.Value, ")" }); } else { string text = kom; kom = string.Concat(new string[] { text, ", ", this.validateDefinitionName, " (wymagany z dnia ", data_wersji.Value, ")" }); } i++; isupdatedKlk = false; } } else { if (!(this.headerName == name.Value)) { isKlk = false; break; } XmlNode wersja = this.header.SelectSingleNode("/akcja_wyborcza").Attributes.GetNamedItem("data_aktualizacji"); if (wersja != null && data_wersji.Value != wersja.Value) { if (i == 0) { string text = kom; kom = string.Concat(new string[] { text, this.headerName, " (wymagany z dnia ", data_wersji.Value, ")" }); } else { string text = kom; kom = string.Concat(new string[] { text, ", ", this.headerName, " (wymagany z dnia ", data_wersji.Value, ")" }); } i++; isupdatedKlk = false; } } } } } } } if (!isKlk) { MessageBox.Show("Nie posiadasz wszystkich potrzebnych plików klk", "Uwaga"); base.Close(); } else { if (!isupdatedKlk) { MessageBox.Show("Nie posiadasz odpowiednich plików klk. " + kom, "Uwaga"); base.Close(); } else { form.wait.setWaitPanel("Trwa otwieranie formularza protokołu - ładowanie podglądu", "Proszę czekać"); string controlSum = ""; XmlNode saveStep = this.save.SelectSingleNode("/save/step"); if (saveStep != null && saveStep.InnerText == "0") { string docXml = ""; XmlNode saveheader = this.save.SelectSingleNode("/save/header"); if (header != null) { docXml += header.OuterXml; } XmlNode savestep = this.save.SelectSingleNode("/save/step"); if (savestep != null) { docXml += savestep.OuterXml; } XmlNode saveform = this.save.SelectSingleNode("/save/form"); if (form != null) { docXml += saveform.OuterXml; } XmlNode savekomisja_sklad = this.save.SelectSingleNode("/save/komisja_sklad"); if (savekomisja_sklad != null) { docXml += savekomisja_sklad.OuterXml; } XmlNode savehardWarningCode = this.save.SelectSingleNode("/save/hardWarningCode"); if (savehardWarningCode != null) { docXml += savehardWarningCode.OuterXml; } XmlNode savesoftError = this.save.SelectSingleNode("/save/softError"); if (savesoftError != null) { docXml += savesoftError.OuterXml; } XmlNode savehardError = this.save.SelectSingleNode("/save/hardError"); if (savehardError != null) { docXml += savehardError.OuterXml; } XmlNode savehardWarning = this.save.SelectSingleNode("/save/hardWarning"); if (savehardWarning != null) { docXml += savehardWarning.OuterXml; } ClassMd5 k = new ClassMd5(); controlSum = k.CreateMD5Hash(docXml); } string docDefinition = protocolDefinition.Replace(".xml", ".docx"); printProtocolNew protocol = new printProtocolNew(); string[] partfilepath = this.savePath.Split(new char[] { '\\' }); string[] dataPath = partfilepath[partfilepath.Length - 1].Split(new char[] { '-' }); string jns = dataPath[1].Replace("Jns", ""); string inst = dataPath[3].Replace("Inst", ""); string obwod = dataPath[2].Replace("Obw", ""); string instJNS = dataPath[4].Replace("Obw", ""); string okreg = dataPath[5].Replace("Okr", ""); okreg = okreg.Replace(".xml", ""); protocol.ProtocolPrint(this.header, this.save, this.candidates, docDefinition, controlSum, false, obwod, inst, okreg, candidates, instJNS); form.wait.setWaitPanel("Trwa wczytywanie licencji", "Proszę czekać"); bool isP = false; bool isZ = false; XmlNode com = this.save.SelectSingleNode("/save/komisja_sklad"); foreach (XmlNode j in com) { XmlNode funkcja = j.Attributes.GetNamedItem("funkcja"); if (funkcja != null) { if (funkcja.Value == "ZASTĘPCA") { isZ = true; } if (funkcja.Value == "PRZEWODNICZĄCY") { isP = true; } } if (isZ && isP) { break; } } if (isP) { this.zORp += "P"; } if (isZ) { this.zORp += "Z"; } this.getSignPage(); this.LicencesTable.CellClick += new DataGridViewCellEventHandler(this.getLicense_CellClick); } } } catch (System.Exception e2) { MessageBox.Show("Nie mozna wczytać danych. " + e2.Message, "Uwaga"); base.Close(); } form.wait.setVisible(false); }
private void log_Click(object sender, System.EventArgs e) { if (this.con.IsAvailableNetworkActive()) { Certificate cert = new Certificate(); bool logged = cert.readKey(this.licensePath, this.password.Text); if (logged) { WaitPanel panelWait = new WaitPanel("Wait_04", base.Size.Width, base.Size.Height); panelWait.setWaitPanel("Trwa wysyłanie prośby o przyznanie kodu odblokowującego przez pełnomocnika.", "Proszę czekać"); panelWait.setSize(this.passwordPanel.Size); panelWait.setLocation(this.passwordPanel.Location); base.Controls.Add(panelWait.getPanel()); base.Controls[panelWait.getName()].BringToFront(); panelWait.setVisible(true); this.label6.Visible = false; try { cert.SignXmlText(this.xml, System.IO.Path.GetTempPath() + "KBW\\tmp\\eksportCode.xml", this.password.Text, this.licensePath); System.IO.StreamReader sr = new System.IO.StreamReader(System.IO.Path.GetTempPath() + "KBW\\tmp\\eksportCode.xml"); this.xml = sr.ReadToEnd(); sr.Close(); } catch (System.Exception ex) { MessageBox.Show("Wprowadzanie kodu: " + ex.Message, "Error"); } string post2 = this.postWarning + this.postWarning2 + "&flag=export&flag2=akcept&xml=" + HttpUtility.UrlEncode(this.xml); string uri = "protocols/export"; ResponseData cod = this.con.postSendCode(uri, post2, 0); if (cod.getCode().getcode() == 0) { WaitPanel p = new WaitPanel("Wait_04", base.Size.Width, base.Size.Height); p.setWaitPanel("Trwa sprawdzanie czy ostrzeżenie/a twarde zostały zaakceptowane - oczekiwanie na przyznanie kodu odblokowującego przez pełnomocnika.", "Proszę czekać"); p.setSize(this.passwordPanel.Size); p.setLocation(this.passwordPanel.Location); base.Controls.Add(p.getPanel()); base.Controls[p.getName()].BringToFront(); p.setVisible(true); bool response = false; int count = 0; while (!response) { count++; string post3 = "flag=export&flag2=check&" + this.postWarning2 + "&xml=" + HttpUtility.UrlEncode(this.xml); ResponseData cod2 = this.con.postSendCode(uri, post3, 0); if (cod2.getCode().getcode() == 10) { this.f.codeField.Text = cod2.getXml(); response = true; base.Close(); } else { if (cod2.getCode().getcode() == 9) { p.setWaitPanel("Protokół z ostrzeżeniami twardymi został odrzucony", "Proszę czekać"); response = true; } else { if (cod2.getCode().getcode() != 11) { if (MessageBox.Show(cod2.getCode().getText() + " Spróbować jeszcze raz?", "Oczekiwanie na odpowiedź", MessageBoxButtons.YesNo) == DialogResult.No) { response = true; base.Close(); } } } } if (count % 11 == 0) { if (MessageBox.Show("Protokół ciągle oczekuje na akceptacje. Kontynuować sprawdzanie?", "Oczekiwanie na odpowiedź", MessageBoxButtons.YesNo) == DialogResult.No) { response = true; base.Close(); } } } base.Close(); } else { MessageBox.Show(cod.getCode().getText(), "Komuniakt"); base.Close(); } panelWait.setVisible(true); } else { this.label6.Visible = true; } } else { MessageBox.Show("Nie masz połaczenia z internetem! Podłącz internet i spróbuj jeszcze raz.", "Uwaga"); base.Close(); } }