Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Form1 frm1 = new Form1();

            if (type == "Premium")
            {
                Form1.WriteLine("Trwa laczenie z serwerami mojang");
                var     response = Minecraft.getResponse(this.nick_txt.Text, this.pass_txt.Text);
                dynamic decoded  = SimpleJson.DeserializeObject(response);
                if (response == "403")
                {
                    MessageBox.Show("Podałeś błędny login lub/i hasło", "Logowanie", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    Form1.WriteLine("Bledny login lub/i haslo");
                }
                else if (decoded["availableProfiles"].Count == 0)
                {
                    MessageBox.Show("Jestes graczem No-Premium, przełączam w tryb dla No-Premium", "No-Premium", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Form1.WriteLine("Jestes graczem No-Premium");
                    type_account.Text = "No-Premium";
                    type = "No-Premium";
                    nick_name.Visible     = false;
                    nick_txt.Visible      = false;
                    pass.Text             = "Nick:";
                    pass_txt.PasswordChar = '\0';
                    pass_txt.Text         = Form1.readXml(Form1.appdata + "\\skymin\\config\\user.xml", "Nick");
                    remember.Visible      = false;
                    changeLoc();
                }
                else
                {
                    Form1.WriteLine("Poprawnie zalogowano na serwerze mojang");
                    Form1.editXml(Form1.appdata + "\\skymin\\config\\user.xml", "User", "Nick", Convert.ToString(decoded["selectedProfile"]["name"]));
                    if (remember.Checked)
                    {
                        Form1.editXml(Form1.appdata + "\\skymin\\config\\user.xml", "User", "Email", nick_txt.Text);
                        Form1.editXml(Form1.appdata + "\\skymin\\config\\user.xml", "User", "Haslo", pass_txt.Text);
                    }
                    Form1.editXml(Form1.appdata + "\\skymin\\config\\user.xml", "User", "Remember", Convert.ToString(remember.Checked));
                    Form1.editXml(Form1.appdata + "\\skymin\\config\\user.xml", "User", "uuid", Convert.ToString(decoded["selectedProfile"]["id"]));
                    Form1.editXml(Form1.appdata + "\\skymin\\config\\user.xml", "User", "accessToken", Convert.ToString(decoded["accessToken"]));
                    Form1.editXml(Form1.appdata + "\\skymin\\config\\user.xml", "User", "account_type", "Premium");
                    frm1.Activate();
                    this.Hide();
                }
            }
            else if (type == "No-Premium")
            {
                Form1.editXml(Form1.appdata + "\\skymin\\config\\user.xml", "User", "Nick", pass_txt.Text);
                Form1.editXml(Form1.appdata + "\\skymin\\config\\user.xml", "User", "uuid", "null");
                Form1.editXml(Form1.appdata + "\\skymin\\config\\user.xml", "User", "accessToken", "null");
                Form1.editXml(Form1.appdata + "\\skymin\\config\\user.xml", "User", "account_type", "No-Premium");
                frm1.Activate();
                this.Hide();
            }
            else if (type == "SkyMin")
            {
                Form1.editXml(Form1.appdata + "\\skymin\\config\\user.xml", "User", "account_type", "SkyMin");
            }
        }
Example #2
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Form1 form = new Form1();

            Thread ct = new Thread(

            new ThreadStart(   // console thread
            delegate()
            {
                while (true)
                {

                }
            }));

            ct.Start();  // Start console tråden

            form.Show();

            form.Activate();
            Application.Run(form);
            Environment.Exit(0);
        }
Example #3
0
        private void dataGridView1_Click(object sender, EventArgs e)
        {
            double mon = 0;

            try
            {
                mon = double.Parse(dataGridView1.CurrentRow.Cells[1].Value.ToString());
                using (var mysql = new Mysql())
                {
                    mysql.conexion();
                    mysql.cadenasql = "delete from notascredito where Cliente='" + dataGridView1.CurrentRow.Cells[0].Value.ToString() + "' and Monto='" + dataGridView1.CurrentRow.Cells[1].Value.ToString() + "'";
                    mysql.comando   = new MySqlCommand(mysql.cadenasql, mysql.con);
                    mysql.comando.ExecuteNonQuery();
                    mysql.Dispose();
                }
                this.Visible = false;
                f1.Activate();

                f1.textBox5.ReadOnly = false;
                f1.textBox5.Focus();
                f1.textBox5.Text = (double.Parse(f1.textBox5.Text) - mon).ToString();
                MessageBox.Show("Se aplicó la nota de crédito correctamente", "Solicitud procesada", MessageBoxButtons.OK, MessageBoxIcon.Information);
                f1.textBox5.ReadOnly = true;
                f1.textBox1.Focus();
            }
            catch (Exception ette)
            {
                MessageBox.Show(ette.ToString());
            }
        }
Example #4
0
        //private static void ToggleCapsLock()
        //{
        //    const int KEYEVENTF_EXTENDEDKEY = 0x1;
        //    const int KEYEVENTF_KEYUP = 0x2;

        //    UnhookWindowsHookEx(_hookID);
        //    keybd_event(0x14, 0x45, KEYEVENTF_EXTENDEDKEY, (UIntPtr)0);
        //    keybd_event(0x14, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, (UIntPtr)0);
        //    _hookID = SetHook(_proc);
        //}

        private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
        {
            if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN)
            {
                Keys key = (Keys)Marshal.ReadInt32(lParam);
                if (key == Keys.Space)
                {
                }

                //var sc = Shortcut.CtrlShiftF1;
                var txt = new KeysConverter().ConvertToString((Keys)key);
                Console.WriteLine(txt);

                _keyBuffer.Enqueue(key);
                if (_keyBuffer.Count > 3)
                {
                    _keyBuffer.Dequeue();
                }
                var keyCombo = _keyBuffer.ToArray();
                if (keyCombo[0] == Keys.ControlKey && keyCombo[1] == Keys.Shift && keyCombo[2] == Keys.O)
                {
                    if (_mainForm.WindowState == FormWindowState.Minimized)
                    {
                        _mainForm.WindowState = FormWindowState.Normal;
                    }

                    _mainForm.Activate();
                }
            }
            return(CallNextHookEx(_hookID, nCode, wParam, lParam));
        }
Example #5
0
 private void NotifyIcon_Click(object sender, EventArgs e)
 {
     // special case for the first click
     if (form == null)
     {
         form = new Form1();
         form.ShowDialog();
     }
     else
     {
         // test if the form has been recently closed. Here i consider 1/10
         // of a second as "recently" closed. So we want only to handle the click
         // if the time is greater than that.
         if ((DateTime.Now - form.LastDeactivate).TotalMilliseconds >= 100)
         {
             // specially control the show hide as visibility on/off
             // does not trigger the activate event that screw up the
             // later hiding of the form
             if (form.Visible)
             {
                 form.Hide();
             }
             else
             {
                 form.Show();
                 form.Activate();
             }
         }
     }
 }
    protected override void OnStartupNextInstance(StartupNextInstanceEventArgs eventArgs)
    {
        Form1 form = MainForm as Form1;

        form.Text = "I will run only once!";
        form.Activate();
        base.OnStartupNextInstance(eventArgs);
    }
Example #7
0
File: mainMenu.cs Project: ocept/g3
 //play game
 private void playButton_Click(object sender, EventArgs e)
 {
     Form1 levelForm = new Form1();
     levelForm.Visible = true;
     levelForm.Activate();
     levelForm.FormClosing += new FormClosingEventHandler(levelForm_FormClosing);
     this.Visible = false;
     levelForm.Level.playerDead += new level.playerDeadHandler(Level_playerDead);
 }
        private void dataGridView1_Click(object sender, EventArgs e)
        {
            try
            {
                if (dataGridView1.Rows.Count > 0)
                {
                    this.Visible = false;

                    m_frm.textBox1.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString();
                    m_frm.Activate();
                    m_frm.textBox1.Focus();
                    SendKeys.Send("{ENTER}");
                }
            }
            catch (Exception vf)
            {
                Mensaje.Error(vf, "118");
            }
        }
Example #9
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new Form1());
            Form1 tf = new Form1();

            Thread ct = new Thread(
                           new ThreadStart(
                           delegate ()
                           {
                               while (true)
                               {
                                   string command = Console.ReadLine();
                                   switch (command)
                                   {
                                       case "close":
                                           tf.Invoke(new MethodInvoker(
                                               delegate ()
                                               {
                                                   tf.Close();
                                               }));
                                           break;
                                       case "max":
                                           tf.Invoke(new MethodInvoker(
                                               delegate ()
                                               {
                                                   tf.WindowState = FormWindowState.Maximized;
                                               }));
                                           break;
                                       case "min":
                                           tf.Invoke(new MethodInvoker(
                                               delegate ()
                                               {
                                                   tf.WindowState = FormWindowState.Minimized;
                                               }));
                                           break;
                                       case "res":
                                           tf.Invoke(new MethodInvoker(
                                               delegate ()
                                               {
                                                   tf.WindowState = FormWindowState.Normal;
                                               }));
                                           break;
                                   }

                               }
                           }));
            ct.Start();
            tf.Show();
            tf.Activate();
            Application.Run(tf);
            Environment.Exit(0);
        }
Example #10
0
        static void Main(string[] args)
        {
            Console.Write("Loading supervirus...");
            for (int x = 0; x < 500; x++)
            {
                Console.Write(".");
                System.Threading.Thread.Sleep(10);
            }
            Console.WriteLine();
            Console.WriteLine("Press g, a, c, q, m, l, or q");
            Console.ReadLine();

            Form1 f = new Form1();
            f.Show();
            f.Activate();
        }
 void ShowConfig(object sender, EventArgs e)
 {
     if (_mainWindow.IsDisposed)
     {
         _mainWindow = new Form1();
     }
     // If we are already showing the window, merely focus it.
     if (_mainWindow.Visible)
     {
         _mainWindow.Activate();
     }
     else
     {
         _mainWindow.ShowDialog();
     }
 }
Example #12
0
 private void button29_Click(object sender, EventArgs e)
 {
     Form1 f1 = new Form1();
     f1.Show();
     for (int i = 0; i <= 100; i++)
         {
         f1.Opacity = i / 100.0;
         System.Threading.Thread.Sleep(1);//чем меньше число, тем быстрее появится
         }
     f1.Activate();
 }
Example #13
0
        private void deleteDatabaseToolStripMenuItem_Click(object sender, EventArgs e)
        {
            String db_name = "NEWDB.accdb";
            String connectionString =
                  @"Provider=Microsoft.ACE.OLEDB.12.0;Data"
                + @" Source=C:\PBloodTestManager\" + db_name;

            //Delete Table
            String tableName = "NEW_TABLE";
            String dropTableSQL = "DROP TABLE " + tableName;
            OleDbConnection conn =
                    new OleDbConnection(connectionString);
            OleDbCommand dbCmd = new OleDbCommand();

            try
            {
                DialogResult dr = MessageBox.Show("Are you sure you want to delete the existing table from the database ?","Delete Table", MessageBoxButtons.YesNo);
                switch (dr)
                {
                    case DialogResult.Yes:
                        conn.Open();
                        //MessageBox.Show(dropTableSQL);
                        dbCmd.Connection = conn;
                        dbCmd.CommandText = dropTableSQL;
                        dbCmd.ExecuteNonQuery();
                        dbCmd.Connection.Close();

                        MessageBox.Show("Table NEW_TABLE Deleted");
                        break;

                    case DialogResult.No:
                        Form1 frm = new Form1();
                        frm.Activate();
                        break;
                }

            }
            catch (OleDbException exp)
            {
                MessageBox.Show("Database Error:"
                              + exp.Message.ToString());
            }
            finally
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                DataTable DT = (DataTable)dataGridView1.DataSource;
                if (DT != null)
                    DT.Clear();
                dataGridView1.Columns.Clear();

                DialogResult dr1 = MessageBox.Show("Do you want to delete the database file - NEWDB ?", "Delete Database", MessageBoxButtons.YesNo);
                switch (dr1)
                {
                    case DialogResult.Yes:
                        string destinationFile = @"C:\PBloodTestManager\NEWDB.accdb";
                        try
                        {
                            File.Delete(destinationFile);
                        }
                        catch (IOException iox)
                        {
                            MessageBox.Show(iox.Message);
                        }
                        finally
                        {
                            MessageBox.Show("Database NEWDB deleted");
                        }
                        break;
                    case DialogResult.No:
                        Form1 frm = new Form1();
                        frm.Activate();
                        break;
                }
            }
        }
Example #14
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            String db_name = "NEWDB.accdb";
            String connectionString =
                  @"Provider=Microsoft.ACE.OLEDB.12.0;Data"
                + @" Source=C:\PBloodTestManager\" + db_name;

            //Delete Table
            //String tableName = "NEW_TABLE";
            String dropColSQL = "DELETE FROM NEW_TABLE WHERE SNo= " + textSNo.Text + "";
            OleDbConnection conn =
                    new OleDbConnection(connectionString);
            OleDbCommand dbCmd = new OleDbCommand();
            String LoadTableSQL = "SELECT * FROM NEW_TABLE ORDER BY SNo ASC";

            try
            {
                DialogResult dr = MessageBox.Show("Are you sure you want to delete the column from the table ?"+"\n"+"Rollback of the particular action is not possible afterwards !!","Delete Column", MessageBoxButtons.YesNo);
                switch (dr)
                {
                case DialogResult.Yes:
                conn.Open();

                //MessageBox.Show(dropColSQL);
                dbCmd.Connection = conn;
                dbCmd.CommandText = dropColSQL;
                dbCmd.ExecuteNonQuery();
                //dbCmd.Connection.Close();

                MessageBox.Show("Column Deleted");

                dbCmd.Connection = conn;
                dbCmd.CommandText = LoadTableSQL;
                dataGridView1.Enabled = true;
                OleDbDataAdapter da = new OleDbDataAdapter(dbCmd);
                DataTable dt = new DataTable();
                da.Fill(dt);
                dataGridView1.DataSource = dt;
                dbCmd.Connection.Close();
                break;

                case DialogResult.No:
                Form1 frm = new Form1();
                frm.Activate();
                break;
            }

            }
            catch (OleDbException exp)
            {
                MessageBox.Show("Database Error: "
                              + exp.Message.ToString());
            }
            finally
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                textSNo.Text = "";
                dateTimePicker1.Text = "";
                textGlucose.Text = "";
                textCholesterol.Text = "";
                textLDL.Text = "";
                textHDL.Text = "";
                textTriglycerides.Text = "";
                textFibrinogen.Text = "";
                textHemoglobinA1C.Text = "";
                textDHEA.Text = "";
                textPSA.Text = "";
                textHomocysteine.Text = "";
                textCRP.Text = "";
                textTSH.Text = "";
                textTestosterone.Text = "";
                textEstradiol.Text = "";
            }
        }
Example #15
0
        private void panel1_SizeChanged(object sender, EventArgs e)
        {
            if (this.WindowState == FormWindowState.Maximized)
            {
                this.Hide();
                Form1 f1 = new Form1();
                f1.WindowState = FormWindowState.Normal;
                f1.Show();
                f1.Activate();
            }

            if (this.WindowState == FormWindowState.Minimized)  //判断是否最小化
            {
                this.ShowInTaskbar = false;  //不显示在系统任务栏
                notifyIcon1.Visible = true;  //托盘图标可见
 
            }


        }