private void renkSıralamaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form4 renksiralama = new Form4();

            renksiralama.ShowDialog();
        }
        private void Signup_button_Click(object sender, EventArgs e)
        {
            Form4 signup = new Form4(Clientstream);

            signup.Show();
        }
        private void openform4()
        {
            Form4 f4 = new Form4();

            Application.Run(f4);
        }
Beispiel #4
0
        private void bT_Click(object sender, EventArgs e)
        {
            Form4 newForm = new Form4();

            newForm.Show();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked == true)
            {
                a[0] = 1; count++;
            }
            else if (radioButton2.Checked == true)
            {
                a[0] = 2; count++;
            }
            else if (radioButton3.Checked == true)
            {
                a[0] = 3; count++;
            }
            else if (radioButton4.Checked == true)
            {
                a[0] = 4; count++;
            }
            else if (radioButton5.Checked == true)
            {
                a[0] = 5; count++;
            }

            if (radioButton10.Checked == true)
            {
                a[1] = 1; count++;
            }
            else if (radioButton9.Checked == true)
            {
                a[1] = 2; count++;
            }
            else if (radioButton8.Checked == true)
            {
                a[1] = 3; count++;
            }
            else if (radioButton7.Checked == true)
            {
                a[1] = 4; count++;
            }
            else if (radioButton6.Checked == true)
            {
                a[1] = 5; count++;
            }

            if (radioButton15.Checked == true)
            {
                a[2] = 1; count++;
            }
            else if (radioButton14.Checked == true)
            {
                a[2] = 2; count++;
            }
            else if (radioButton13.Checked == true)
            {
                a[2] = 3; count++;
            }
            else if (radioButton12.Checked == true)
            {
                a[2] = 4; count++;
            }
            else if (radioButton11.Checked == true)
            {
                a[2] = 5; count++;
            }

            if (radioButton20.Checked == true)
            {
                a[3] = 1; count++;
            }
            else if (radioButton19.Checked == true)
            {
                a[3] = 2; count++;
            }
            else if (radioButton18.Checked == true)
            {
                a[3] = 3; count++;
            }
            else if (radioButton17.Checked == true)
            {
                a[3] = 4; count++;
            }
            else if (radioButton16.Checked == true)
            {
                a[3] = 5; count++;
            }

            if (radioButton25.Checked == true)
            {
                a[4] = 1; count++;
            }
            else if (radioButton24.Checked == true)
            {
                a[4] = 2; count++;
            }
            else if (radioButton23.Checked == true)
            {
                a[4] = 3; count++;
            }
            else if (radioButton22.Checked == true)
            {
                a[4] = 4; count++;
            }
            else if (radioButton21.Checked == true)
            {
                a[4] = 5; count++;
            }



            try
            {
                string myConnection = " Provider=OraOLEDB.Oracle; Data Source=orcl;User Id=System; Password=orcl;";
                if (count == 5)
                {
                    string          sql        = "select usn from Student where username= '******'";
                    OleDbConnection connection = new OleDbConnection(myConnection);
                    connection.Open();
                    OleDbDataAdapter dataadapter = new OleDbDataAdapter(sql, connection);
                    DataTable        dataTable   = new DataTable();
                    dataadapter.Fill(dataTable);
                    usn = dataTable.Rows[0][0].ToString();
                    connection.Close();

                    string          sql1        = "select c_num from Course where c_name= '" + Form4.items[2] + "'";
                    OleDbConnection connection1 = new OleDbConnection(myConnection);
                    connection1.Open();
                    OleDbDataAdapter dataadapter1 = new OleDbDataAdapter(sql1, connection1);
                    DataTable        dataTable1   = new DataTable();
                    dataadapter1.Fill(dataTable1);
                    c_num = dataTable1.Rows[0][0].ToString();
                    connection1.Close();


                    for (int i = 0; i < 5; i++)
                    {
                        string          sql3        = "select * from Answer";
                        OleDbConnection connection2 = new OleDbConnection(myConnection);
                        connection2.Open();
                        OleDbDataAdapter dataadapter2 = new OleDbDataAdapter(sql3, connection2);
                        DataSet          ds           = new DataSet();
                        dataadapter2.Fill(ds, "Answer");
                        string sql2 = "insert into Answer(usn,q_id, ans,c_num) values('" + usn + "','" + (i + 1) + "', '" + a[i] + "','" + c_num + "')";
                        dataadapter2.InsertCommand = new OleDbCommand(sql2, connection2);
                        dataadapter2.InsertCommand.ExecuteNonQuery();
                        connection2.Close();
                    }
                    MessageBox.Show("Submitted succesfully");



                    Form4 form = new Form4();
                    form.Show();
                    this.Hide();
                }
                else if (count < 5)
                {
                    MessageBox.Show("Give all answers.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #6
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //MessageBox.Show(app_path_name);
            //MessageBox.Show(app_path);
            Form4 f4 = new Form4();

            timer3.Interval = 100;
            timer3.Enabled  = true;
            textBox1.Text   = "0";
            textBox2.Text   = "";
            timer1.Enabled  = false;
            timer1.Interval = 5000;

            //--------------------Update_App_Path    Start-----------------------------
            if (app_path_name == "Calculator2")//判断当前运行程序版本
            {
                newtxt(1, "change");
                System.IO.File.Delete(path + "/Calculator/Calculator.exe");
                System.IO.File.Copy(Application.ExecutablePath, path + "/Calculator/Calculator.exe");
                Process process = new Process();
                process.StartInfo.FileName = path + "/Calculator/Calculator.exe";
                process.Start();
                System.Environment.Exit(0);
            }
            if (System.IO.File.Exists(path + "/Calculator/Calculator2.exe"))
            {
                System.IO.File.Delete(path + "/Calculator/Calculator2.exe");
            }


            if (System.IO.File.Exists(path + "/Calculator/change.txt"))
            {
                MessageBox.Show("欢迎更新新版本!您现在使用的版本为:" + version, "检查更新", MessageBoxButtons.OK, MessageBoxIcon.Information);
                MessageBox.Show(update_txt, "欢迎", MessageBoxButtons.OK, MessageBoxIcon.Information);
                System.IO.File.Delete(path + "/Calculator/change.txt");
                if (!System.IO.File.Exists(path + "/Calculator/update.txt"))
                {
                    DialogResult = MessageBox.Show("是否启用自动更新?", "Question", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (DialogResult == DialogResult.OK)
                    {
                        newtxt(1, "update");
                    }
                    else
                    {
                        newtxt(0, "update");
                    }
                }
            }
            //------------------------------Update_App_Path End-------------------------------



            //-----------------------------判断是否首次运行----------------------------
            if (!Directory.Exists(path + "/Calculator"))
            {
                //创建相应文件夹及txt
                Directory.CreateDirectory(path + "/Calculator");    //创建该文件夹
                System.IO.File.Copy(Application.ExecutablePath, path + "/Calculator/Calculator.exe");

                //-------------------------------------------快捷方式----------------------------------------
                string       shortcutPath = Path.Combine(desktop_path, string.Format("{0}.lnk", "Calculator"));
                WshShell     shell        = new WshShell();
                IWshShortcut shortcut     = (IWshShortcut)shell.CreateShortcut(shortcutPath);                                                                                           //创建快捷方式对象
                shortcut.TargetPath       = path + "/Calculator/Calculator.exe";                                                                                                        //指定目标路径
                shortcut.WorkingDirectory = Path.GetDirectoryName(path + "/Calculator/Calculator.exe");                                                                                 //设置起始位置
                shortcut.WindowStyle      = 1;                                                                                                                                          //设置运行方式,默认为常规窗口
                shortcut.Description      = "";                                                                                                                                         //设置备注
                shortcut.IconLocation     = string.IsNullOrWhiteSpace(path + "/Calculator/Calculator.exe") ? path + "/Calculator/Calculator.exe" : path + "/Calculator/Calculator.exe"; //设置图标路径
                shortcut.Save();                                                                                                                                                        //保存快捷方式
                //------------------------------------------快捷方式 End-----------------------------------

                newtxt(0, "history");
                newtxt(1, "use");
                newtxt(0, "history_savetext");
                //以下为判断创建情况
                DialogResult = MessageBox.Show("是否启用自动检查更新?", "检查更新", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                if (DialogResult == DialogResult.OK)
                {
                    newtxt(1, "update");
                }
                else
                {
                    newtxt(0, "update");
                }

                DialogResult = MessageBox.Show("检测到您第一次运行本程序,祝您使用愉快!", "欢迎", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
            }
            //------------------------------------------首次运行判断结束-----------------------------------------------------



            if (System.IO.File.Exists(path + "/Calculator/use.txt"))
            {
                readtxt("use");
            }
            else
            {
                newtxt(0, "use");
            }
            if (save_void != "0")
            {
                if (System.IO.File.Exists(path + "/Calculator/history.txt"))
                {
                    readtxt("history");
                    if (save_void == "1")
                    {
                        DialogResult = MessageBox.Show("检测到您已开启关闭自动保存计算数据,是否加载?", "Question", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);
                        if (DialogResult == DialogResult.OK)
                        {
                            history = true;
                            readtxt("history_savetext");
                            textBox1.Text = save_void;
                            first         = true;
                        }
                        else
                        {
                            history = false;
                        }
                    }
                    else
                    {
                        history = false;
                    }
                }
            }
            if (System.IO.File.Exists(path + "/Calculator/update.txt"))
            {
                readtxt("update");
                if (save_void == "1")
                {
                    check_update();
                }
            }
        }
Beispiel #7
0
        private void button25_Click(object sender, EventArgs e)
        {
            Form4 form = new Form4();

            form.Show();
        }
Beispiel #8
0
        private void деталиЗаказаToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form4 f4 = new Form4();

            f4.ShowDialog();
        }
Beispiel #9
0
        private void 登录_Click(object sender, EventArgs e)
        {
            Form4 form4 = new Form4();

            form4.Show();
        }
Beispiel #10
0
        private void button3_Click(object sender, EventArgs e)
        {
            Form4 FTrian = new Form4();

            FTrian.Show();
        }
Beispiel #11
0
        private void курсуToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form4 z = new Form4();

            z.Show();
        }
Beispiel #12
0
        private void button4_Click(object sender, EventArgs e)
        {
            var error4Form = new Form4();

            error4Form.Show();
        }
Beispiel #13
0
        //string update_txt= "v"+ version.ToString() +"更新内容:\n修复已知bugs\n修复了程序更新失败的问题\n添加多线程支持\n部分细节优化";
        //string extension;

        //---------------------------------------------------函数区域----------------------------------------------------------
        public void check_update()
        {
            Form4 f4 = new Form4();

            //string statusCode;
            try
            {
                timer1.Enabled = false;
                //ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
                System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://cannon.org.cn/version.txt");
                ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };
                vulue = 15;
                ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };
                HttpWebResponse response = request.GetResponse() as HttpWebResponse;
                vulue = 25;
                Stream responseStream = response.GetResponseStream();
                vulue = 30;
                Stream stream = new FileStream(path + "/Calculator/version.txt", FileMode.Create);
                vulue = 55;
                byte[] bArr = new byte[1024];
                vulue = 65;
                int size = responseStream.Read(bArr, 0, bArr.Length);
                vulue = 75;
                while (size > 0)
                {
                    stream.Write(bArr, 0, size);
                    size = responseStream.Read(bArr, 0, bArr.Length);
                }
                stream.Close();
                vulue = 85;
                responseStream.Close();
                vulue = 90;
                readtxt("version");
                new_version = System.Convert.ToDouble(save_void);
                vulue       = 95;
                //f4.label4.Text = "v" + new_version;
                vulue = 97;

                if (new_version > version)
                {
                    vulue        = 99;
                    DialogResult = MessageBox.Show("检测到新版本,是否下载?", "检测完成", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    vulue        = 100;
                    if (DialogResult == DialogResult.OK)
                    {
                        update("https://github.com/XiaoSong0919/Calculator/releases/download/v" + +new_version + "/Calculator.exe");
                    }
                }
                else
                {
                    timer1.Enabled = false;
                    vulue          = 100;
                    MessageBox.Show("暂无新版本", "检测完成", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (WebException e)
            {
                MessageBox.Show(e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (System.FormatException e)
            {
                MessageBox.Show("发生未知错误\n" + e.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #14
0
        private void button1_Click(object sender, EventArgs e)
        {
            Form4 secondForm = new Form4();

            secondForm.Show();
        }
Beispiel #15
0
        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;
            }
        }
Beispiel #16
0
        private void button3_Click(object sender, EventArgs e)
        {
            Form f = new Form4();

            f.Show();
        }
Beispiel #17
0
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Form4 f4 = new Form4();

            f4.ShowDialog();
        }
Beispiel #18
0
        private void button15_Click(object sender, EventArgs e)
        {
            Form4 f4 = new Form4();

            f4.Show();
        }
Beispiel #19
0
        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);
        }
Beispiel #20
0
        private void Button4_Click(object sender, EventArgs e)
        {
            Form4 frmUsuarios = new Form4();

            frmUsuarios.ShowDialog();
        }
Beispiel #21
0
        private void 检查更新ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form4 f4 = new Form4();

            f4.Show();
        }