예제 #1
0
        public JObject Paste()
        {
            // Paste
            JObject response = PasteTube.MakeRequest("/Paste?userid=" + userid);

            return(response);
        }
예제 #2
0
        private static void MyThread(string userid)
        {
            Console.WriteLine(userid);
            PasteTube client = new PasteTube(userid);

            string old = string.Empty;

            while (true)
            {
                JObject response    = client.Paste();
                string  new_online  = response["data"].ToString();
                var     new_offline = Clipboard.GetText();


                if (new_offline != old)
                {
                    old = new_offline;
                    Console.WriteLine(old);
                    client.Copy(old);
                }
                else if (new_online != old)
                {
                    old = new_online;
                    Console.WriteLine(old);
                    Clipboard.SetText(old);
                }

                Thread.Sleep(100);
            }
        }
예제 #3
0
        public JObject Copy(string data)
        {
            // Copy
            JObject response = PasteTube.MakeRequest("/Copy?userid=" + userid + "&data=" + data);

            return(response);
        }
예제 #4
0
        public JObject GetConnectedDevices()
        {
            // GetConnectedDevices
            JObject response = PasteTube.MakeRequest("/GetConnectedDevices?userid=" + userid);

            return(response);
        }
예제 #5
0
        public static string CreateUser()
        {
            // Create User first
            JObject response    = PasteTube.MakeRequest("/CreateUser");
            string  userid_temp = response["userid"].ToString();

            return(userid_temp);
        }
예제 #6
0
        public PasteTube(string p_userid)
        {
            userid = p_userid;

            // Connect
            JObject response = PasteTube.MakeRequest("/Connect?mac=xyz&userid=" + userid);

            // MessageBox.Show(userid, "test", MessageBoxButtons.YesNo);
        }
예제 #7
0
        private void metroButton1_Click(object sender, EventArgs e)
        {
            this.metroButton1.Hide();
            this.metroButton2.Hide();

            string userid = PasteTube.CreateUser();

            // Create QR Code
            QRCodeGenerator qrGenerator = new QRCodeGenerator();
            QRCodeData      qrCodeData  = qrGenerator.CreateQrCode(userid, QRCodeGenerator.ECCLevel.Q);
            QRCode          qrCode      = new QRCode(qrCodeData);
            Bitmap          qrCodeImage = qrCode.GetGraphic(20);

            this.pictureBox1.Image    = qrCodeImage;
            this.pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
            this.pictureBox1.Show();

            //var t = new Thread(() => MyThread(userid));
            //t.Start();

            MyThread(userid);

            this.Text = "PasteTube : Running!";
        }