Example #1
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     DialogResult _dlgResult;
     Form2 _frm = new Form2();
     _dlgResult = _frm.ShowDialog();
     if (_dlgResult == DialogResult.OK)
         Application.Run(new Form1());
 }
Example #2
0
 private void button3_Click(object sender, EventArgs e)
 {
     Form2 f2 = new Form2();
     f2.ShowDialog();
     if (DialogResult.OK == f2.DialogResult)
     {
         Show_game(g, 0);
     }
     else Close();
 }
Example #3
0
        private void Insert(object sender, EventArgs e)
        {
            string passWord;
            string userName;
            string userID;
            string key;
            double currency;

            Form2 AddUser = new Form2();
            DialogResult dr = AddUser.ShowDialog();

            userName = AddUser.userName;
            passWord = AddUser.passWord;
            currency = AddUser.accountBalance;

            if(currency >0 && dr == DialogResult.OK)
            {
            ///Reference Encrypt Later On
                MD5 md = new MD5CryptoServiceProvider();
                string toHash;
                byte[] hash;

                toHash = userName + "+" + passWord;
                hash = md.ComputeHash(Encoding.ASCII.GetBytes(toHash));

                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < hash.Length; i++)
                {
                    sb.Append(hash[i].ToString("x2"));
                }

                key = sb.ToString();
                //End Encrypt

                Guid guid = Guid.NewGuid();
                userID = guid.ToString("N");

                this.userDetailsTableAdapter.InsertQuery(userID, userName, key, Convert.ToDecimal(currency));
            }
            else
            {
                ErrorLabel.Text = "Failed Insert";
            }

            this.userDetailsTableAdapter.Fill(this.blackJackDBDataSet.UserDetails);
        }
Example #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            string inputfile = openFileDialog1.FileName;
            DateTime created = dateTimePicker1.Value;
            DateTime createdtime = dateTimePicker2.Value;
            string titel = textBox1.Text;
            Mp3File mp3 = listBox1.SelectedItem as Mp3File;
            CategoryObj c = comboBox1.SelectedItem as CategoryObj;

            if (!string.IsNullOrEmpty(openFileDialog1.FileName) && System.IO.File.Exists(openFileDialog1.FileName))
            {
                Thread t = new Thread(new ThreadStart(delegate()
                    {
                        try
                        {
                            SetProgress(0);
                            mp3 = _proxy.UploadNewFile(inputfile, created, titel, c);
                            SetProgress(50);
                            _proxy.NewPost(titel, c.ToString(), mp3.url, mp3.size, new DateTime(created.Year, created.Month, created.Day, createdtime.Hour, createdtime.Minute, createdtime.Second));
                        }
                        catch (Exception exc)
                        {
                            CloseBezig(exc);
                        }
                        SetProgress(100);
                        CloseBezig();
                    }));
                t.Start();
            }
            else if (mp3 != null && c != null)
            {
                Thread t = new Thread(new ThreadStart(delegate()
                {
                    try
                    {
                        _proxy.NewPost(titel, c.ToString(), mp3.url, mp3.size, new DateTime(created.Year, created.Month, created.Day, createdtime.Hour, createdtime.Minute, createdtime.Second));
                    }
                    catch (Exception exc)
                    {
                        CloseBezig(exc);
                    }
                    CloseBezig();
                }));
                t.Start();
            }

            _bezigForm = new Form2();
            _bezigForm.ShowDialog(this);
        }
Example #5
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            label1.Text = "验证版本...";
            timer1.Enabled = false;
            bool b1 = HttpClass.DownloadFile(VersionFileUrl, VersionFileLocal, progressBar1);
            if (b1)
            {

                Text = string.Format("{0}/{1}", MainAppBuildVersion, UpdateAppBuildVersion);
                if (UpdateAppBuildVersion > MainAppBuildVersion)
                {
                    Form2 f2 = new Form2();
                    f2.edit1.Text = WhatsNew;
                    if (f2.ShowDialog() == DialogResult.OK)
                    {
                        label1.Text = "下载文件...";
                        progressBar1.Value = 1;
                        Task downloadtask1 = new Task(new Action(DownloadFileProc));
                        downloadtask1.Start();
                    }
                    else
                    {
                        label1.Text = "用户取消了操作";
                        progressBar1.Value = 0;
                    }
                }
                else
                {
                    label1.Text = "服务器上没有最新的版本";
                }
            }
            else
            {
                label1.Text = ("版本验证失败");
                label1.ForeColor = Color.Red;
                progressBar1.Value = 0;
            }
        }
Example #6
0
 private void renameToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (listView3.SelectedItems.Count == 1)
     {
         Form2 Fm = new Form2();
         Fm.NName = (listView3.SelectedItems[0].Tag as TFunc).FName;
         if (Fm.ShowDialog() == DialogResult.OK)
             MyGNIDA.RenameFunction((listView3.SelectedItems[0].Tag as TFunc), Fm.NName);
     };
 }
Example #7
0
 private void renameToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     TFunc f = GetSelectedFunction();
     if (f != null)
     {
         Form2 Fm = new Form2();
         Fm.NName = f.FName;
         if (Fm.ShowDialog() == DialogResult.OK)
             MyGNIDA.RenameFunction(f, Fm.NName);
     }
 }
Example #8
0
        public Form1()
        {
            //System.Collections.Generic.List<int> f = new List<int>(3);

            f2 = new Form2(this);
            InitializeComponent();
            dbw = new DBWork(this);
            dbw.SetPenaltyAll();
            dbw.DeleteExceededOrders();
            //ReaderRecord = new DBWork.dbReader("9643907728022200024 " + "07020077");
            //sc = new _BarcScan(this);
            //this.Left = (Screen.PrimaryScreen.Bounds.Width - this.Width) / 2;
            //this.Top = (Screen.PrimaryScreen.Bounds.Height - this.Height) / 2;
            this.StartPosition = FormStartPosition.CenterScreen;
            this.label16 = new System.Windows.Forms.Label();
            //this.Controls.Add(RndPrg);
            //
            // label16
            //
            this.Controls.Add(this.label16);
            f2.ShowDialog();

            /*if (EmpID == null)
            {
                MessageBox.Show("�� �� ������������! ��������� ��������� ���� ������.", "������!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }*/
            Form1.Scanned += new ScannedEventHandler(Form1_Scanned);
            Form1.AbonChanged += new AbonChangedEventHandler(Form1_AbonChanged);
            //dataGridView1.Rows.RemoveAt(0);// .Remove(dataGridView1.Rows[0].);
            //ReaderRecord = new DBWork.dbReader();
            //BookRecord = new DBWork.dbBook();
            this.button2.Enabled = false;
            this.button4.Enabled = false;
            label4.Text = "������ ������� " + DateTime.Now.ToShortDateString() + ":";
            //this.Controls.Add(this.panel1);
            //this.tabPage3.Controls.Remove(this.panel1);
            //MessageBox.Show(tabControl1.SelectedTab.ToString());// = tabControl1.TabPages[1];
            this.label16.AutoSize = true;
            this.label16.BringToFront();
            this.label16.Font = new System.Drawing.Font("Microsoft Sans Serif", 26.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
            this.label16.Location = new System.Drawing.Point(328, 458);
            this.label16.Name = "label16";
            this.label16.Size = new System.Drawing.Size(355, 39);
            this.label16.TabIndex = 0;
            this.label16.Text = "�������� ��������";
            this.label16.Visible = false;
            this.label16.ForeColor = Color.Green;
            Formular.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            Formular.Columns.Clear();

            port = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);
            port.DataReceived += new SerialDataReceivedEventHandler(port_DataReceived);
            port.Handshake = Handshake.RequestToSend;
            port.NewLine = Convert.ToChar(13).ToString();

            try
            {
                port.Open();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #9
0
        // заполнение массива и отображение крестиков, ноликов
        private void panel1_MouseClick(object sender, MouseEventArgs e)
        {
            int row = (int)(e.Y / H);
            int col = (int)(e.X / W);

            if (Pole[row,col] == 0)
            {
                this.field(g, row, col, what);

                if (what == 1)
                {
                    Pole[row, col] = 2;
                    what = 2;
                    if (if_win())
                    {
                        label1.Text = "Вы победили";
                        Form2 f2 = new Form2();
                        f2.ShowDialog();
                        if (DialogResult.OK == f2.DialogResult)
                        {
                            Show_game(g, 0);
                        }
                        else Close();
                    }
                    else label1.Text = "Ход соперника";
                }
                else
                {
                    Pole[row, col] = 5;
                    what = 1;
                    if (if_win())
                    {
                        label1.Text = "Соперник победил";
                        Form2 f2 = new Form2();
                        f2.ShowDialog();
                        if (DialogResult.OK == f2.DialogResult)
                        {
                            Show_game(g, 0);
                        }
                        else Close();

                    }
                    else label1.Text = "Ваш ход";
                }
            }
        }