Пример #1
0
        //SEND/RECEIVE
        private void SEND(object sender, EventArgs e)
        {
            DataTable dt = DHuy.SELECT_SQL("SELECT * FROM FILE_TRANSFER WHERE ID = " + SESSION_TRANS_ID);

            if (DBase.IsFolder(HerePath) == 1)
            {
                return;
            }

            if (dt.Rows.Count > 0)
            {
                FileTransfer_Process P = new FileTransfer_Process();
                P.isSend           = 1;
                P.dt               = dt;
                P.Here_File        = HerePath;
                P.Remote_File      = RemotePath;
                P.SESSION_TRANS_ID = SESSION_TRANS_ID;
                P.F        = this;
                P.Location = new Point(Location.X + (Width - P.Width) / 2, Location.Y + (Height - P.Height) / 2);
                P.Show();
            }
            else
            {
                Confirm C = new Confirm();
                C.SetColor(Color.LightCoral);
                C.edtText.Text  = "Session is expired ! ... Close ? ";
                C.StartPosition = FormStartPosition.Manual;
                C.Location      = new Point(Location.X + (Width - C.Width) / 2, Location.Y + (Height - C.Height) / 2);
                C.ShowDialog(this);
                if (C.Res == 1)
                {
                    this.Close();
                }
            }
        }
Пример #2
0
 private void PCSList_Load(object sender, EventArgs e)
 {
     dt                      = DHuy.SELECT_SQL("SELECT TOP 2000 * FROM PCS ORDER BY ID DESC ");
     dgv.DataSource          = dt;
     dgv.AutoGenerateColumns = false;
     dgv.AutoResizeColumns();
 }
Пример #3
0
        public void Translate()
        {
            int Pic = Ran.Next(1, 6);

            if (Pic == 1)
            {
                edtPic.Image = Properties.Resources.Loading;
            }
            else if (Pic == 2)
            {
                edtPic.Image = Properties.Resources.Loading;
            }
            else if (Pic == 3)
            {
                edtPic.Image = Properties.Resources.Loading2;
            }
            else if (Pic == 4)
            {
                edtPic.Image = Properties.Resources.Loading2;
            }
            else if (Pic == 5)
            {
                edtPic.Image = Properties.Resources.Loading4;
            }

            edtAutoText.Text   = "";
            edtResultText.Text = "";
            KEYWORD            = edtKey.Text.Replace("(", "").Replace(")", "").Replace(",", "");
            if (DBase.TargetLanguage1 == "vi")
            {
                DT = DHuy.SELECT_SQL("SELECT * FROM ENVN WHERE EN = '" + KEYWORD + "'");
            }
            else
            {
                DT.Clear();
            }
            if (DT.Rows.Count == 1)
            {
                edtWordFound.Text = KEYWORD;
                string R = DBase.StringReturn(DT, 0, "VN").Replace("<br />", Environment.NewLine);
                DisplayResult(R, true);
            }
            else
            {
                edtWordFound.Text = "Google Translate ... ";
                //edtRESULTLABEL.Text = "";
                //edtResultText.Text = "Not found";
                //google API
                if (isbusy == 0)
                {
                    isbusy         = 1;
                    edtPic.Visible = true;
                    edtPic.BringToFront();
                    W1.RunWorkerAsync();
                }
            }
        }
Пример #4
0
        private void BundleConfig_Load(object sender, EventArgs e)
        {
            DataTable dtcheck      = DHuy.SELECT_SQL("SELECT * FROM USER_PCS WHERE ID = " + ID + "");
            String    bundleString = DBase.StringReturn(dtcheck.Rows[0]["BUNDLESTRING"]);

            PCS_ID             = DBase.IntReturn(dtcheck.Rows[0]["PCS_ID"]);
            edtPCS_ID.Text     = PCS_ID.ToString();
            edtBundleList.Text = bundleString;
        }
        private void Save_Click(object sender, EventArgs e)
        {
            foreach (Control C in this.Controls)
            {
                if (C.GetType() == typeof(PictureBox))
                {
                    try
                    {
                        try
                        {
                            dt.Rows[0][C.Name.Replace("edt", "")] = new byte[3];
                            dt.Rows[0][C.Name.Replace("edt", "")] = DBase.ImageToByte(((PictureBox)C).Image);
                        }
                        catch (Exception ex)
                        {
                            dt.Rows[0][C.Name.Replace("edt", "")] = DBase.ImageToByte(Properties.Resources.GoogleTrans24);
                        }
                    }
                    catch (Exception ex) { }
                }
            }

            int kq = 0;

            if (type == 0 || Clone == 1)
            {
                kq = (int)DHuy.INSERT_IDENTITY_RETURNID(TableName, dt);
                if (kq > 0)
                {
                    DBase.DTAPP = DHuy.SELECT_SQL("SELECT APPNAME,ENABLE,SHORTKEY,DOUBLECLICK,HOLDCLICK FROM APPTRANSLATE WHERE USERCODE ='ADMIN'");
                    //MessageBox.Show("Insert Succesful!");
                    if (Parent != null)
                    {
                        Parent.RefreshInsert(kq.ToString());
                    }
                    this.Close();
                }
            }
            else if (type == 1)
            {
                kq = DHuy.UPDATE(TableName, dt, KEYCOL);
                if (kq > 0)
                {
                    DBase.DTAPP = DHuy.SELECT_SQL("SELECT APPNAME,ENABLE,SHORTKEY,DOUBLECLICK,HOLDCLICK FROM APPTRANSLATE WHERE USERCODE ='ADMIN'");
                    //MessageBox.Show("Saved!");
                    if (Parent != null)
                    {
                        Parent.RefreshSelect();
                    }
                    this.Close();
                }
            }
        }
Пример #6
0
        private void edtPic_Click(object sender, EventArgs e)
        {
            DataTable dtd      = DHuy.SELECT_SQL("SELECT FILEDATA,FILENAME FROM Chat WHERE ID = " + ID);
            string    filename = DBase.StringReturn(dtd.Rows[0]["FILENAME"]);

            byte[] Data     = (byte[])dtd.Rows[0]["FILEDATA"];
            String SaveFile = Application.StartupPath + "\\" + filename;

            File.WriteAllBytes(SaveFile, Data);
            try
            {
                System.Diagnostics.Process.Start(SaveFile);
            }
            catch (Exception ex) { }
        }
Пример #7
0
 private void BGLoading(object sender, System.ComponentModel.DoWorkEventArgs e)
 {
     try
     {
         dt = DHuy.SELECT_SQL("SELECT * FROM LANGUAGE");
         DBase.AddColumn(dt, "ICON", typeof(Image));
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             DBase.SetValue(dt, i, "ICON", Properties.Resources.Trans16);
         }
     }
     catch (Exception) { }
     finally
     {
     }
 } //Action
Пример #8
0
 //TIMER
 private void FILE_TRANSFER_LIST_Tick(object sender, EventArgs e)
 {
     try
     {
         DataTable da = DHuy.SELECT_SQL("SELECT MD5 FROM FILE_TRANSFER WHERE ID = " + SESSION_TRANS_ID + " ORDER BY CDATETIME ASC ");
         if (da.Rows.Count > 0)
         {
             string md5 = DBase.StringReturn(da.Rows[0]["MD5"]);
             if (md5 != Remote_File_MD5)
             {
                 Remote_File_MD5 = md5;
                 DHuy.DownloadFile("FILE_TRANSFER", "DATA", "ID", SESSION_TRANS_ID, DBase.XmlRemote_File);
                 REFRESH2();
             }
         }
     }
     catch (Exception ex) { }
 }
Пример #9
0
 private void bgw_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
 {
     isbusy = 1;
     try
     {
         if (LoadAll == true)
         {
             dt = DHuy.SELECT_SQL("SELECT  * FROM " + TableName);
         }
         else
         {
             dt = DHuy.SELECT_SQL("SELECT Top 300 *  FROM " + TableName);
         }
     }
     catch (Exception ex)
     {
         //    MessageBox.Show(ex.ToString());
     }
 }
Пример #10
0
        private void LOGIN_Click(object sender, EventArgs e)
        {
            UserName       = edtName.Text;
            lbWelcome.Text = " Love you! ";
            DataTable dt = DHuy.SELECT_SQL("SELECT * FROM USERS WHERE USERCODE = '" + edtName.Text + "' AND PASSWORD = '******'");

            if (dt.Rows.Count > 0)
            {
                Res = 1;
                DBase.LastUserLogin     = edtName.Text;
                DBase.LastUserLogin2    = DBase.LastUserLogin;
                DBase.LastPasswordLogin = edtPass.Text;
                DBase.SaveSetting();
                this.Close();
            }
            else
            {
                lbWelcome.Text = " Name/Password is incorrect!";
            }
        }
Пример #11
0
        private void TIMER_STATUS_Tick(object sender, EventArgs e)
        {
            if (isClose == 1)
            {
                this.Close();
            }
            try
            {
                if (isSend == 1) //send
                {
                    DataTable da = DHuy.SELECT_SQL("SELECT SEND_STATUS FROM FILE_TRANSFER WHERE ID = " + SESSION_TRANS_ID + " ORDER BY CDATETIME ASC ");
                    if (da.Rows.Count > 0)
                    {
                        int status = DBase.IntReturn(da.Rows[0]["SEND_STATUS"]);
                        if (status == 2)
                        {
                            DHuy.RUN_SQL("UPDATE FILE_TRANSFER SET SEND_STATUS = 0 , RECEIVE_STATUS=0 WHERE ID = " + SESSION_TRANS_ID);
                            isClose = 1;
                            this.Close();
                            F.TopMost = true;
                        }
                    }
                }

                else if (isSend == 0) //receive
                {
                    DataTable da = DHuy.SELECT_SQL("SELECT RECEIVE_STATUS FROM FILE_TRANSFER WHERE ID = " + SESSION_TRANS_ID + " ORDER BY CDATETIME ASC ");
                    if (da.Rows.Count > 0)
                    {
                        int status = DBase.IntReturn(da.Rows[0]["RECEIVE_STATUS"]);
                        if (status == 1)
                        {
                            timer1.Stop();
                            W1.RunWorkerAsync();
                        }
                    }
                }
            }
            catch (Exception ex) { }
        }
Пример #12
0
        public FileTransfer(int CID, int RID, string FilePath)
        {
            InitializeComponent();
            try
            {
                DataTable dti = DHuy.SELECT_NEWROW("FILE_TRANSFER");
                String    key = DBase.biDateTimeSave(DateTime.Now);
                dti.Rows[0]["ID"]         = 0;
                dti.Rows[0]["DATA"]       = new byte[3];
                dti.Rows[0]["FILE_DATA"]  = new byte[3];
                dti.Rows[0]["CONTROL_ID"] = CID;
                dti.Rows[0]["REMOTE_ID"]  = RID;
                dti.Rows[0]["MD5"]        = key;
                kq = DHuy.INSERT_IDENTITY_UID("FILE_TRANSFER", dti);
                DataTable temp = DHuy.SELECT_SQL("SELECT * FROM FILE_TRANSFER WHERE MD5 = '" + key + "'");
                SESSION_TRANS_ID = DBase.IntReturn(temp.Rows[0]["ID"]);


                REMOTE_ID  = RID;
                CONTROL_ID = CID;


                FileTransfer_Process P = new FileTransfer_Process();
                P.isSend           = 1;
                P.dt               = temp;
                P.Here_File        = FilePath;
                P.Remote_File      = "Home";
                P.SESSION_TRANS_ID = SESSION_TRANS_ID;
                P.F             = this;
                P.StartPosition = FormStartPosition.CenterParent;
                P.Show(this);
                //this.Close();
            }
            catch (Exception ex)
            {
            }
        }
Пример #13
0
        public void RefreshChat()
        {
            dtnew  = new DataTable();
            LastID = 0;
            try
            {
                string lastUser = "";
                panChat.Controls.Clear();
                //ChatItem None = new ChatItem();
                //None.BackColor = None.edtText.BackColor = Color.Snow;
                //panChat.Controls.Add(None);
                dt = DHuy.SELECT_SQL("SELECT * FROM CHAT WHERE USERCODE = '" + Control_Remote + "' ORDER BY ID ASC ");

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    String type = DBase.StringReturn(dt.Rows[i]["TYPE"]);

                    if (type == "")
                    {
                        ChatItem C = new ChatItem();
                        C.Width = panChat.Width;
                        C.M     = this;
                        C.ID    = DBase.IntReturn(dt.Rows[i]["ID"]);
                        String   DataNick    = DBase.StringReturn(dt.Rows[i]["NICKNAME"]) + " ";
                        String   ColorString = "";
                        String   Text        = DBase.StringReturn(dt.Rows[i]["TEXT"]);
                        DateTime cdatetime   = DBase.DatetimeReturn(dt.Rows[i]["CDATETIME"]);

                        if (curNick == DataNick)
                        {
                            //  C.edtUserCode.ForeColor = C.edtUserCode.BackColor;
                            //  C.edtIcon.Visible = false;
                            ////  else C.edtUserCode.ForeColor = Color.Blue;
                            colorIndex++;
                            //  C.edtIcon.Visible = true;
                            if (colorIndex == C.L.Count)
                            {
                                colorIndex = 0;
                            }
                            //   C.edtUserCode.ForeColor = Color.Blue;
                        }
                        else
                        {
                            colorIndex++;
                            //  C.edtIcon.Visible = true;
                            if (colorIndex == C.L.Count)
                            {
                                colorIndex = 0;
                            }
                            //   C.edtUserCode.ForeColor = Color.Blue;
                        }

                        curNick = DataNick;

                        C.BackColor = C.edtText.BackColor = C.L[colorIndex];

                        //   C.edtUserCode.Text = DataNick + ":";
                        C.edtText.Text = DataNick + ": " + Text + "  ( " + cdatetime.ToString("dd/MM HH:mm") + " )";
                        if (ColorString == "RED")
                        {
                            // C.BackColor = Color.Pink;
                            C.edtText.BackColor = Color.Pink;
                        }
                        else if (ColorString == "GREEN")
                        {
                            C.BackColor         = Color.Honeydew;
                            C.edtText.BackColor = Color.Honeydew;
                        }

                        panChat.Controls.Add(C);
                    }

                    else if (type.ToUpper() == ".JPG" || type.ToUpper() == ".BMP" || type.ToUpper() == ".PNG" || type.ToUpper() == ".GIF")
                    {
                        try
                        {
                            String         FileName = DBase.StringReturn(dt.Rows[i]["FILENAME"]);
                            Image          I        = DBase.ByteToImage((byte[])dt.Rows[i]["THUMBNAIL"]);
                            ChatItem_Image C        = new ChatItem_Image(I, FileName);

                            C.M  = this;
                            C.ID = DBase.IntReturn(dt.Rows[i]["ID"]);
                            DateTime cdatetime = DBase.DatetimeReturn(dt.Rows[i]["CDATETIME"]);

                            panChat.Controls.Add(C);
                        }
                        catch (Exception ex) { }
                    }

                    else if (type != "")
                    {
                        try
                        {
                            String FileName = DBase.StringReturn(dt.Rows[i]["FILENAME"]);
                            Image  I        = null;
                            try
                            {
                                I = DBase.ByteToImage((byte[])dt.Rows[i]["THUMBNAIL"]);
                            }
                            catch (Exception ex) { }
                            ChatItem_Files C = new ChatItem_Files(type, FileName, I);

                            C.M  = this;
                            C.ID = DBase.IntReturn(dt.Rows[i]["ID"]);
                            DateTime cdatetime = DBase.DatetimeReturn(dt.Rows[i]["CDATETIME"]);

                            panChat.Controls.Add(C);
                        }
                        catch (Exception ex) { }
                    }
                }

                //ChatItem C2 = new ChatItem();

                //panChat.Controls.Add(C2);

                panChat.VerticalScroll.Value = panChat.VerticalScroll.Maximum;
            }
            catch (Exception ex) { }
        }
Пример #14
0
        public void RefreshChat_Append()
        {
            try
            {
                if (dt.Rows.Count > 0)
                {
                    LastID = DBase.IntReturn(dt.Rows[dt.Rows.Count - 1]["ID"]);
                }
                else
                {
                    LastID = 0;
                }
                if (dtnew.Rows.Count > 0)
                {
                    LastID = DBase.IntReturn(dtnew.Rows[dtnew.Rows.Count - 1]["ID"]);
                }
                dtnew = DHuy.SELECT_SQL("SELECT * FROM CHAT WHERE ID > @DATE1 AND USERCODE = '" + Control_Remote + "' ORDER BY ID ASC ", LastID.ToString());
                for (int i = 0; i < dtnew.Rows.Count; i++)
                {
                    String type = DBase.StringReturn(dtnew.Rows[i]["TYPE"]);
                    if (type == "")
                    {
                        ChatItem C = new ChatItem();
                        C.Width = panChat.Width;
                        C.M     = this;
                        C.ID    = DBase.IntReturn(dtnew.Rows[i]["ID"]);
                        String DataNick = DBase.StringReturn(dtnew.Rows[i]["NICKNAME"]) + " ";

                        String   Text      = DBase.StringReturn(dtnew.Rows[i]["TEXT"]);
                        DateTime cdatetime = DBase.DatetimeReturn(dtnew.Rows[i]["CDATETIME"]);

                        if (curNick == DataNick)
                        {
                            //C.edtUserCode.ForeColor = C.edtUserCode.BackColor;
                            //C.edtIcon.Visible = false;
                            ////  else C.edtUserCode.ForeColor = Color.Blue;

                            colorIndex++;
                            //  C.edtIcon.Visible = true;
                            if (colorIndex == C.L.Count)
                            {
                                colorIndex = 0;
                            }
                            // C.edtUserCode.ForeColor = Color.Blue;
                        }
                        else
                        {
                            colorIndex++;
                            //  C.edtIcon.Visible = true;
                            if (colorIndex == C.L.Count)
                            {
                                colorIndex = 0;
                            }
                            //  C.edtUserCode.ForeColor = Color.Blue;
                        }

                        curNick = DataNick;

                        C.BackColor = C.edtText.BackColor = C.L[colorIndex];

                        //   C.edtUserCode.Text = DataNick + ":";
                        C.edtText.Text = DataNick + ": " + Text + "  ( " + cdatetime.ToString("dd/MM HH:mm") + " )";

                        panChat.Controls.Add(C);
                    }

                    else if (type.ToUpper() == ".JPG" || type.ToUpper() == ".BMP" || type.ToUpper() == ".PNG" || type.ToUpper() == ".GIF")
                    {
                        try
                        {
                            String         FileName = DBase.StringReturn(dtnew.Rows[i]["FILENAME"]);
                            Image          I        = DBase.ByteToImage((byte[])dtnew.Rows[i]["THUMBNAIL"]);
                            ChatItem_Image C        = new ChatItem_Image(I, FileName);

                            C.M  = this;
                            C.ID = DBase.IntReturn(dt.Rows[i]["ID"]);
                            DateTime cdatetime = DBase.DatetimeReturn(dtnew.Rows[i]["CDATETIME"]);

                            panChat.Controls.Add(C);
                        }
                        catch (Exception ex) { }
                    }

                    else if (type != "")
                    {
                        try
                        {
                            String FileName = DBase.StringReturn(dtnew.Rows[i]["FILENAME"]);
                            Image  I        = null;
                            try
                            {
                                I = DBase.ByteToImage((byte[])dtnew.Rows[i]["THUMBNAIL"]);
                            }
                            catch (Exception ex) { }
                            ChatItem_Files C = new ChatItem_Files(type, FileName, I);

                            C.M  = this;
                            C.ID = DBase.IntReturn(dtnew.Rows[i]["ID"]);
                            DateTime cdatetime = DBase.DatetimeReturn(dtnew.Rows[i]["CDATETIME"]);

                            panChat.Controls.Add(C);
                        }
                        catch (Exception ex) { }
                    }
                }

                if (dtnew.Rows.Count > 0)
                {
                    dt.Merge(dtnew);
                    panChat.VerticalScroll.Value = panChat.VerticalScroll.Maximum;
                }
            }
            catch (Exception ex) { }
        }
Пример #15
0
        public ZMain()
        {
            HookSetup();



            InitializeComponent();
            try
            {
                RegistryKey rk = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
                if (rk.GetValue("JCS") == null)
                {
                    this.cmsStartWithWindow.Image = null;
                }
                else
                {
                    this.cmsStartWithWindow.Image = global::GB.Properties.Resources._011_yes_16;
                }
            }
            catch (Exception ex) { }

            //  MessageBox.Show("JustClickSee will restart explorer to enable API\nOK to continue");

            this.W1.DoWork             += new System.ComponentModel.DoWorkEventHandler(this.BGLoading);
            this.W1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.BGLoading_Complete);


            DBase.UserCodeLogin = "******";

            if (DBase.StartMinimize == 1)
            {
                this.ShowInTaskbar = false;
                this.WindowState   = FormWindowState.Minimized;
            }

            try
            {
                DBase.GTC         = TranslationClient.Create();
                DBase.API_Working = true;
                DBase.DTAPP       = DHuy.SELECT_SQL("SELECT APPNAME,ENABLE,SHORTKEY,DOUBLECLICK,HOLDCLICK,SKIP_OLD_CLIPBOARD FROM APPTRANSLATE WHERE USERCODE ='ADMIN'");
            }
            catch (Exception ex3)
            {
                if (ex3.ToString().ToUpper().Contains("GOOGLE_APPLICATION_CREDENTIALS"))
                {
                    MessageBox.Show("JustClickSee will restart explorer to enable API\nOK to continue", "Enable API", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    DBase.SetEnvirmoment();
                    try
                    {
                        DBase.GTC         = TranslationClient.Create();
                        DBase.API_Working = true;
                        MessageBox.Show("Google Translate installed successful ! ");
                    }
                    catch (Exception ex4)
                    {
                        this.Text = "Restart to enable API !";
                        isClose   = 1;
                        this.Close();
                        //MessageBox.Show("API not registed ! ");
                        //MessageBox.Show(ex4.ToString());
                    }
                }
            }
            //W1.RunWorkerAsync();
        }