Example #1
0
 private void HookManager_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     try
     {
         APPNAME   = DBase.ActiveApplicationName();
         this.Text = "DBC - " + APPNAME;
         DataTable dtf = DBase.FilterTable(DBase.DTAPP, "APPNAME = '" + APPNAME + "'");
         if (dtf.Rows.Count > 0)
         {
             ENABLE = DBase.BoolReturn(dtf, 0, "ENABLE");
             if (ENABLE)
             {
                 DOUBLECLICK        = DBase.BoolReturn(dtf, 0, "DOUBLECLICK");
                 HOLDCLICK          = DBase.BoolReturn(dtf, 0, "HOLDCLICK");
                 SHORTKEY           = DBase.StringReturn(dtf, 0, "SHORTKEY");
                 SKIP_OLD_CLIPBOARD = DBase.BoolReturn(dtf, 0, "SKIP_OLD_CLIPBOARD");
                 if (DOUBLECLICK)
                 {
                     if (APPNAME.ToLower() == "firefox" || APPNAME.ToLower() == "chrome" || APPNAME.ToLower() == "steam" || APPNAME.ToLower() == "opera")
                     {
                         if ((Cursor.Position.Y - DBase.HandleLocation_Top) > 150)
                         {
                             TRANSLATE(true);
                         }
                     }
                     else
                     {
                         TRANSLATE(true);
                     }
                 }
                 else
                 {
                     this.Text = "DBC - " + APPNAME + " - DISABLED - " + SHORTKEY;
                 }
             }
             else
             {
             }
         }
     }
     catch (Exception ex)
     {
         if (DBase.ShowException == 1)
         {
             MessageBox.Show(ex.ToString());
         }
     }
 }
Example #2
0
        private void HookManager_KeyDown(object sender, KeyEventArgs e)
        {
            if (DBase.ActiveTranslation == 0)
            {
                return;
            }
            try
            {
                APPNAME = DBase.ActiveApplicationName();
                dtf     = DBase.FilterTable(DBase.DTAPP, "APPNAME = '" + APPNAME + "'");
                if (dtf.Rows.Count > 0)
                {
                    ENABLE             = DBase.BoolReturn(dtf, 0, "ENABLE");
                    SKIP_OLD_CLIPBOARD = DBase.BoolReturn(dtf, 0, "SKIP_OLD_CLIPBOARD");
                    if (ENABLE)
                    {
                        SHORTKEY = DBase.StringReturn(dtf, 0, "SHORTKEY");
                        Enum.TryParse(SHORTKEY, out key);
                        if (e.KeyCode == key)
                        {
                            TRANSLATE(false);
                        }
                        else
                        {
                            this.Text = "KD - " + APPNAME + " - " + SHORTKEY;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                if (DBase.ShowException == 1)
                {
                    MessageBox.Show(ex.ToString());
                }
            }

            //Enable/Disable
            if (DWindow.IsControlKeyDown() && DWindow.IsAltKeyDown() && DWindow.IsShiftKeyDown())
            {
                if ((DateTime.Now - LastKeyPress).TotalMilliseconds > 1000)
                {
                    LastKeyPress            = DateTime.Now;
                    DBase.ActiveTranslation = DBase.ActiveTranslation == 1 ? 0 : 1;
                    RefreshButton();
                }
            }
        }
Example #3
0
        void HookManager_MouseUp(object sender, MouseEventArgs e)
        {
            if (DBase.ActiveTranslation == 0)
            {
                return;
            }

            try
            {
                if ((DateTime.Now - MDown).TotalMilliseconds >= 2000)
                {
                    APPNAME  = DBase.ActiveApplicationName();
                    SHORTKEY = DBase.StringReturn(dtf, 0, "SHORTKEY");
                    P2       = new Point(Cursor.Position.X, Cursor.Position.Y);

                    this.Text = APPNAME + " - " + DBase.HandleLocation_Top + " - " + (Cursor.Position.Y - DBase.HandleLocation_Top);
                    dtf       = DBase.FilterTable(DBase.DTAPP, "APPNAME = '" + APPNAME + "'");
                    if (dtf.Rows.Count > 0)
                    {
                        ENABLE = DBase.BoolReturn(dtf, 0, "ENABLE");
                        if (ENABLE)
                        {
                            DOUBLECLICK        = DBase.BoolReturn(dtf, 0, "DOUBLECLICK");
                            HOLDCLICK          = DBase.BoolReturn(dtf, 0, "HOLDCLICK");
                            SHORTKEY           = DBase.StringReturn(dtf, 0, "SHORTKEY");
                            SKIP_OLD_CLIPBOARD = DBase.BoolReturn(dtf, 0, "SKIP_OLD_CLIPBOARD");
                            if (HOLDCLICK)
                            {
                                if (Cursor.Position.X < X)
                                {
                                    X = Cursor.Position.X;
                                }
                                if (Cursor.Position.Y < Y)
                                {
                                    Y = Cursor.Position.Y;
                                }

                                if (APPNAME.ToLower() == "firefox" || APPNAME.ToLower() == "chrome" || APPNAME.ToLower() == "steam" || APPNAME.ToLower() == "opera")
                                {
                                    if (Cursor.Position.Y > 150)
                                    {
                                        TRANSLATE(true);
                                    }
                                    else
                                    {
                                        //this.Text = DateTime.Now.ToString("hh:ss");
                                    }
                                }
                                else
                                {
                                    TRANSLATE(true);
                                }
                            }
                            else
                            {
                                this.Text = "HC - " + APPNAME + " - DISABLED - " + SHORTKEY + "  ";
                            }
                        }
                    }
                }
                else
                {
                    //this.Text = "JustClickSee";
                }
            }
            catch (Exception ex) {
                if (DBase.ShowException == 1)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
Example #4
0
        private void CODER_DETAIL_Load(object sender, EventArgs e)
        {
            if (ID != "") // Update
            {
                type = 1; // 0 - insert ; 1 - update
                dt   = DHuy.SELECT(TableName, KEYCOL, ID);
            }
            else
            {
                dt = DHuy.SELECT_NEWROW(TableName);
                foreach (DataColumn dc in dt.Columns)
                {
                    if (dc.ColumnName == "CUSERCODE" || dc.ColumnName == "UUSERCODE")
                    {
                        dt.Rows[0][dc.ColumnName] = DBase.UserCodeLogin;
                    }

                    if (dc.ColumnName == "CREATEDBYAGY" || dc.ColumnName == "UPDATEDBYAGY")
                    {
                        // dt.Rows[0][dc.ColumnName] = DBase.AgencyCodeLogin;
                    }


                    string sqlType = dc.DataType.ToString();
                    if (sqlType == "System.DateTime")
                    {
                        dt.Rows[0][dc.ColumnName] = DBase.DatetimeReturn_NowIfNull(dt.Columns[dc.ColumnName]);
                    }
                }
            }

            foreach (Control C in this.Controls)
            {
                if (!C.Name.Contains("edt"))
                {
                    continue;
                }
                String ColName = C.Name.Replace("edt", "");
                string sqlType = dt.Rows[0][ColName].GetType().ToString();

                if (sqlType == "System.DateTime")
                {
                    DateTimePicker D = (DateTimePicker)C;
                    D.Value = DBase.DatetimeReturn(dt.Rows[0][C.Name.Replace("edt", "")]);
                }
                else
                {
//                        if (C.GetType() == typeof(TextPopup))
//                        {
//                            TextPopup T = (TextPopup)C;
//                            T.StopEvent();
//                            T.Text = DBase.StringReturn(dt.Rows[0][C.Name.Replace("edt", "")]);
//                            T.StartEvent();
//                        }
                    if (C.GetType() == typeof(ComboBox))
                    {
                        ComboBox T = (ComboBox)C;
                        T.Text = DBase.StringReturn(dt.Rows[0][C.Name.Replace("edt", "")]);
                    }

                    else if (C.GetType() == typeof(CheckBox))
                    {
                        CheckBox T = (CheckBox)C;
                        T.Checked = DBase.BoolReturn(dt.Rows[0][C.Name.Replace("edt", "")]);
                    }


                    else if (C.GetType() == typeof(PictureBox))
                    {
                        PictureBox T = (PictureBox)C;
                        T.Click += new System.EventHandler(this.edtIMAGE_Click);
                        try
                        {
                            System.IO.MemoryStream ms = new System.IO.MemoryStream((Byte[])(dt.Rows[0][C.Name.Replace("edt", "")]));
                            T.Image = Image.FromStream(ms);
                            //  ms.Dispose();
                        }
                        catch (Exception ex) { }
                    }

                    else
                    {
                        C.Text = DBase.StringReturn(dt.Rows[0][C.Name.Replace("edt", "")]);
                    }
                }
            }
            //Asign Value Change Event
            foreach (Control C in this.Controls)
            {
                C.TextChanged += new System.EventHandler(this.TextChange);
            }

            //Asign Checkchange Event
            foreach (Control C in this.Controls)
            {
                if (C.GetType() == typeof(CheckBox))
                {
                    ((CheckBox)C).CheckedChanged += new System.EventHandler(this.CheckedChanged);
                }
            }

            //Remove Readonly
            foreach (DataColumn col in dt.Columns)
            {
                col.ReadOnly = false;
            }
        }