private void button19_Click(object sender, EventArgs e) { Form4 f4 = new Form4(); f4.ShowDialog(); }
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { Form4 f4 = new Form4(); f4.ShowDialog(); }
private void button1_Click(object sender, EventArgs e) { string password = SecurePasswordHasher.Hash(txtpass.Text); string html = string.Empty; string url = @"https://localhost:8080/searchu?username="******"C:/Users/Dragos/source/repos/WindowsFormsApp1/node/security/rootCA.pem"; //X509Certificate cert = new X509Certificate2(Certificate,"cert112",); //X509Certificate cert = new X509Certificate(); //cert.Import() //request.ClientCertificates.Add(new X509Certificate2(X509Certificate2.CreateFromCertFile(Certificate))); // if everything else fails System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; // request.ClientCertificates.Add(new X509Certificate("C:/Users/Dragos/source/repos/WindowsFormsApp1/node/security/server.crt","cert112")); // The path to the certificate. //string Certificate = "C:/Users/Dragos/source/repos/WindowsFormsApp1/node/security/rootCA.pem"; // Load the certificate into an X509Certificate object. // X509Certificate cert = new X509Certificate(); /*string file="C:/Users/Dragos/source/repos/WindowsFormsApp1/node/security/rootCA.pem"; // Contains name of certificate file * X509Store store = new X509Store(StoreName.Root, StoreLocation.LocalMachine); * store.Open(OpenFlags.ReadWrite); * store.Add(new X509Certificate2(X509Certificate2.CreateFromCertFile(file))); * store.Close();*/ //X509Certificate2 Cert = new X509Certificate2(); //string file = "C:/Users/Dragos/source/repos/WindowsFormsApp1/node/security/certificate.pkcs12"; // Contains name of certificate file //Cert.Import(file, "123", X509KeyStorageFlags.PersistKeySet); //request.ClientCertificates.Add(Cert); /*string file = "C:/Users/Dragos/source/repos/WindowsFormsApp1/node/security/rootCA.pem"; * X509Certificate2 mycert = new X509Certificate2(); * mycert.Import(file, "cert112", X509KeyStorageFlags.PersistKeySet); * request.ClientCertificates.Add(mycert);*/ request.AutomaticDecompression = DecompressionMethods.GZip; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) using (Stream stream = response.GetResponseStream()) using (StreamReader reader = new StreamReader(stream)) { html = reader.ReadToEnd(); } Console.WriteLine(html); if (html == "Baza de date offline") { MessageBox.Show("Baza de date offline"); } else { try { //Console.WriteLine(html); var resultscan = JsonConvert.DeserializeObject <List <RootObject> >(html); try { obj = resultscan[0]; bool vf; Console.WriteLine(obj.password); vf = SecurePasswordHasher.Verify(txtpass.Text, obj.password); if (vf) { name = obj.username; if (obj.admin == 1) { using (Form5 f5 = new Form5()) { this.Hide(); f5.ShowDialog(this); this.Close(); } } else if (obj.admin == 0) { using (Form8 f8 = new Form8()) { this.Hide(); f8.ShowDialog(this); this.Close(); } /* * AppCointainer container = new AppCointainer(); * container.Tabs.Add( * new TitleBarTab(container) * { * Content = new Form6 * { * Text= "New Tab" * } * } * ); * * container.SelectedTabIndex = 0; * this.Hide(); * TitleBarTabsApplicationContext applicationContext = new TitleBarTabsApplicationContext(); * applicationContext.Start(container); */ } else { using (Form4 f4 = new Form4()) { this.Hide(); f4.ShowDialog(this); this.Close(); } } } else { MessageBox.Show("Nume de utilizator sau parola incorecta."); } } // catch { MessageBox.Show("Nume de utilizator sau parola incorecta."); } } catch { MessageBox.Show("A cazut serverul."); } } } catch { MessageBox.Show("A cazut serverul"); } // RootObject obj= JsonConvert.DeserializeObject<RootObject>(html); }
private void button12_Click(object sender, EventArgs e) { int sortColumn = -1; Form4 newForm = new Form4(); newForm.comboBox1.Items.Add("이름 오름차순"); newForm.comboBox1.Items.Add("이름 내림차순"); newForm.comboBox1.Items.Add("변경이름 오름차순"); newForm.comboBox1.Items.Add("변경이름 내림차순"); newForm.comboBox1.Items.Add("파일크기 오름차순"); newForm.comboBox1.Items.Add("파일크기 내림차순"); newForm.comboBox1.Items.Add("수정시간 오름차순"); newForm.comboBox1.Items.Add("수정시간 내림차순"); newForm.comboBox1.Items.Add("만든시간 오름차순"); newForm.comboBox1.Items.Add("만든시간 내림차순"); newForm.comboBox1.SelectedIndex = 0; newForm.StartPosition = FormStartPosition.CenterParent; DialogResult dialog_value = newForm.ShowDialog(); if (dialog_value == DialogResult.OK) { switch (newForm.input1) { case 0: sortColumn = 0; listView1.Sorting = SortOrder.Ascending; break; case 1: sortColumn = 0; listView1.Sorting = SortOrder.Descending; break; case 2: sortColumn = 1; listView1.Sorting = SortOrder.Ascending; break; case 3: sortColumn = 1; listView1.Sorting = SortOrder.Descending; break; case 4: sortColumn = 3; listView1.Sorting = SortOrder.Ascending; break; case 5: sortColumn = 3; listView1.Sorting = SortOrder.Descending; break; case 6: sortColumn = 4; listView1.Sorting = SortOrder.Ascending; break; case 7: sortColumn = 4; listView1.Sorting = SortOrder.Descending; break; case 8: sortColumn = 5; listView1.Sorting = SortOrder.Ascending; break; case 9: sortColumn = 5; listView1.Sorting = SortOrder.Descending; break; } listView1.Sort(); listView1.ListViewItemSorter = new MyListViewComparer(sortColumn, listView1.Sorting); listView1.Sorting = SortOrder.None; } }