コード例 #1
0
ファイル: Form_BOCU.cs プロジェクト: nekosaur/Haytham
        private void textBox2_TextChanged(object sender, EventArgs e)
        {
            //update objects dic
            TextBox tb   = (TextBox)sender;
            Device  temp = Objects[tb.Tag.ToString()];

            temp.name = tb.Text;
            Objects[tb.Tag.ToString()] = temp;


            ClientStatus.userData[tb.Tag.ToString()] = tb.Text;

            ClientStatus.sendUserData(tb.Tag.ToString());
        }
コード例 #2
0
        public Form_TV(Form1 frm)
        {
            form1 = frm;
            InitializeComponent();


            Icon ico = new Icon(Properties.Resources.Untitled_2, 64, 64);

            this.Icon                    = ico;
            ClientStatus.Gaze            = true;
            ClientStatus.Commands        = true;
            ClientStatus.ScreenHeight    = Screen.FromHandle(this.Handle).Bounds.Height;
            ClientStatus.ScreenWidth     = Screen.FromHandle(this.Handle).Bounds.Width;
            ClientStatus.ScreenTopLeft.X = 0;
            ClientStatus.ScreenTopLeft.Y = 0;
            ClientStatus.UpdateServer();
            PortLG.DataReceived += new System.IO.Ports.SerialDataReceivedEventHandler(PortLG_DataReceived);
        }
コード例 #3
0
        public Form_monitor(Form1 frm)
        {
            frm1 = frm;
            InitializeComponent();

            Icon ico = new Icon(Properties.Resources.Untitled_2, 64, 64);

            this.Icon = ico;



            ClientStatus.Gaze            = true;
            ClientStatus.Commands        = true;
            ClientStatus.ScreenHeight    = Screen.FromHandle(this.Handle).Bounds.Height;
            ClientStatus.ScreenWidth     = Screen.FromHandle(this.Handle).Bounds.Width;
            ClientStatus.ScreenTopLeft.X = Screen.FromHandle(this.Handle).Bounds.Left;
            ClientStatus.ScreenTopLeft.Y = Screen.FromHandle(this.Handle).Bounds.Top;
            ClientStatus.UpdateServer();
        }
コード例 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            ClientStatus.client   = new TcpClient();
            ClientStatus.serverip = IPAddress.Parse(textBox1.Text);;



            try
            {
                ClientStatus.client.Connect(ClientStatus.serverip, 50000);
            }
            catch (Exception ee)
            {
                MessageBox.Show("Server not found\r\n" + "Check the server IP again!");
                return;
            }



            Form_BOCU form_BOCU;


            try
            {
                ClientStatus.Connect();

                form_BOCU = new Form_BOCU(this);
                form_BOCU.Show();
                this.Hide();
            }
            catch (Exception ee)
            {
                MessageBox.Show("Another <" + ClientStatus.type + " > is already connected to the server.");
                return;
            }
        }
コード例 #5
0
ファイル: Form_BOCU.cs プロジェクト: nekosaur/Haytham
        public void Form_BOCU_Load(object sender, EventArgs e)
        {
            // groupBox1.Enabled = false;

            ClientStatus.Commands     = true;
            ClientStatus.VisualMarker = true;

            lbls[0] = lbl_1;
            lbls[1] = lbl_2;
            lbls[2] = lbl_3;
            lbls[3] = lbl_4;
            lbls[4] = lbl_5;
            lbls[5] = lbl_6;
            lbls[6] = lbl_7;
            lbls[7] = lbl_8;
            lbls[8] = lbl_9;
            lbls[9] = lbl_10;

            txts[0] = txt1;
            txts[1] = txt2;
            txts[2] = txt3;
            txts[3] = txt4;
            txts[4] = txt5;
            txts[5] = txt6;
            txts[6] = txt7;
            txts[7] = txt8;
            txts[8] = txt9;
            txts[9] = txt10;

            pnls[0] = pnl_1;
            pnls[1] = pnl_2;
            pnls[2] = pnl_3;
            pnls[3] = pnl_4;
            pnls[4] = pnl_5;
            pnls[5] = pnl_6;
            pnls[6] = pnl_7;
            pnls[7] = pnl_8;
            pnls[8] = pnl_9;
            pnls[9] = pnl_10;

            cmbs[0]  = Marker_6_1_ON;
            cmbs[1]  = Marker_6_1_OFF;
            cmbs[2]  = Marker_6_2_ON;
            cmbs[3]  = Marker_6_2_OFF;
            cmbs[4]  = Marker_6_3_ON;
            cmbs[5]  = Marker_6_3_OFF;
            cmbs[6]  = Marker_6_4_ON;
            cmbs[7]  = Marker_6_4_OFF;
            cmbs[8]  = Marker_6_5_ON;
            cmbs[9]  = Marker_6_5_OFF;
            cmbs[10] = Marker_6_6_ON;
            cmbs[11] = Marker_6_6_OFF;
            cmbs[12] = Marker_6_7_ON;
            cmbs[13] = Marker_6_7_OFF;
            cmbs[14] = Marker_6_8_ON;
            cmbs[15] = Marker_6_8_OFF;
            cmbs[16] = Marker_6_9_ON;
            cmbs[17] = Marker_6_9_OFF;
            cmbs[18] = Marker_6_10_ON;
            cmbs[19] = Marker_6_10_OFF;

            foreach (ComboBox cmb in cmbs)
            {
                cmb.Text = "Select a command";
                cmb.Items.Add("Select a command");
                cmb.Items.Add("Blink");
                cmb.Items.Add("DbBlink");
                cmb.Items.Add("TR");
                cmb.Items.Add("TL");
                cmb.Items.Add("U_D");
                cmb.Items.Add("U_U");
                cmb.Items.Add("R_L");
                cmb.Items.Add("R_R");
                cmb.Items.Add("D_U");
                cmb.Items.Add("D_D");
                cmb.Items.Add("L_R");
                cmb.Items.Add("L_L");
                cmb.Items.Add("Custom1");
                cmb.Items.Add("Custom2");
                cmb.Items.Add("Custom3");
                cmb.Items.Add("Custom4");
            }


            Device temp = new Device();

            temp.name       = "";
            temp.OffCommand = "";
            temp.OnCommand  = "";
            temp.OnOff      = false;
            ClientStatus.userData.Clear();

            for (int i = 0; i < txts.Count(); i++)
            {
                ClientStatus.userData.Add(txts[i].Tag.ToString(), txts[i].Text);
                Objects.Add(txts[i].Tag.ToString(), temp);
            }
            ClientStatus.UpdateServer();



            this.Text += "_" + ClientStatus.clientName;
            ChangeForm("Connection successful\r\n", "textBox1");

            ChangeForm("Your name is " + ClientStatus.clientName + "\r\n", "textBox1");

            // start a new thread for sending and receiving messages
            ClientStatus.inputoutputThread = new Thread(new ThreadStart(Run));
            ClientStatus.inputoutputThread.Start();

            //serial port
            string[] theSerialPortNames = System.IO.Ports.SerialPort.GetPortNames();
            foreach (string port in theSerialPortNames)
            {
                cboPorts.Items.Add(port);
            }
            try
            {
                PortBOCU.PortName = cboPorts.Text;
                // PortBOCU.Open();
            }
            catch (Exception)
            { }
        }
コード例 #6
0
        public void Form_BOCU_Load(object sender, EventArgs e)
        {
            // groupBox1.Enabled = false;
            followGestures            = true;
            ClientStatus.Commands     = true;
            ClientStatus.VisualMarker = true;

            cmbs[0] = cmb_fwd;
            cmbs[1] = cmb_back;
            cmbs[2] = cmb_stop;
            cmbs[3] = cmb_left;
            cmbs[4] = cmb_right;
            cmbs[5] = cmb_clean;



            ClientStatus.userData.Clear();
            ClientStatus.userData.Add("Marker_6_11", "Roomba");
            ClientStatus.UpdateServer();



            this.Text += "_" + ClientStatus.clientName;
            ChangeForm("Connection successful\r\n", "textBox1");
            ChangeForm("Your name is " + ClientStatus.clientName + "\r\n", "textBox1");

            // start a new thread for sending and receiving messages
            ClientStatus.inputoutputThread = new Thread(new ThreadStart(Run));
            ClientStatus.inputoutputThread.Start();

            //serial port
            string[] theSerialPortNames = System.IO.Ports.SerialPort.GetPortNames();

            foreach (string port in theSerialPortNames)
            {
                cboPorts.Items.Add(port);
            }
            try
            {
                PortRoomba.PortName = cboPorts.Text;
                // PortBOCU.Open();
            }
            catch (Exception)
            { }
            foreach (ComboBox cmb in cmbs)
            {
                cmb.Text = "Select a command";
                cmb.Items.Add("Select a command");
                cmb.Items.Add("Blink");
                cmb.Items.Add("DbBlink");
                cmb.Items.Add("TR");
                cmb.Items.Add("TL");
                cmb.Items.Add("U_D");
                cmb.Items.Add("U_U");
                cmb.Items.Add("R_L");
                cmb.Items.Add("R_R");
                cmb.Items.Add("D_U");
                cmb.Items.Add("D_D");
                cmb.Items.Add("L_R");
                cmb.Items.Add("L_L");
                cmb.Items.Add("Custom1");
                cmb.Items.Add("Custom2");
                cmb.Items.Add("Custom3");
                cmb.Items.Add("Custom4");
            }
        }
コード例 #7
0
        public Form_Recipe(Form1 frm)
        {






            form1 = frm;
            InitializeComponent();

            Icon ico = new Icon(Properties.Resources.Untitled_2, 64, 64);
            this.Icon = ico;


            ClientStatus.Gaze = true;
            ClientStatus.Commands = true;

            ClientStatus.ScreenHeight = Screen.FromHandle(this.Handle).Bounds.Height;
            ClientStatus.ScreenWidth = Screen.FromHandle(this.Handle).Bounds.Width;
            ClientStatus.ScreenTopLeft.X = Screen.FromHandle(this.Handle).Bounds.Left;
            ClientStatus.ScreenTopLeft.Y = Screen.FromHandle(this.Handle).Bounds.Top;
            ClientStatus.UpdateServer();



            this.WindowState = FormWindowState.Maximized;
            int W = ClientStatus.ScreenWidth;
            int H = ClientStatus.ScreenHeight;

            panel_Image.Location = new Point(35, 35);
            panel_Image.Width = 2 * W / 3;
            panel_Image.Height = H - 60;

            label3.Location = new Point(panel_Image.Width / 2 - label3.Width / 2, panel_Image.Height / 2 + 300);
            webBrowser1.Location = new Point(25, 25);
            webBrowser1.Width = panel_Image.Width - 50;
            webBrowser1.Height = panel_Image.Height - 50;

 
            Uri myUri = new Uri(Application.StartupPath + "/Resources/Recipe.swf");
            webBrowser1.Navigate(myUri);

            panel_Volume.Width = W / 3 - 100;
            panel_Volume.Height = H / 2 - 100;
            panel_Volume.Left = (panel_Image.Left + panel_Image.Width) + 25;
            panel_Volume.Top = H / 2 + 50;
            pictureBox1.Location = new Point(panel_Volume.Width / 2 - pictureBox1.Width / 2, panel_Volume.Height / 2 - pictureBox1.Height / 2);
            label1.Location = new Point(panel_Volume.Width / 2 - label1.Width / 2, panel_Volume.Height / 2 - label1.Height / 2 + 50);
            progressBar1.Height = panel_Volume.Height;
            progressBar1.Top = 0;

            panel_Music.Width = W / 3 - 100;
            panel_Music.Height = H / 2 - 100;
            panel_Music.Left = (panel_Image.Left + panel_Image.Width) + 25;
            panel_Music.Top = 50;


            wplayer = new WMPLib.WindowsMediaPlayer();

            wplayer.URL = string.Format("Resources\\Music ({0}).mp3", musicFile);
            wplayer.controls.play();


            btn_Next.BackColor = radioButton_Play.BackColor;// System.Drawing.Color.Aqua;
            btn_Previous.BackColor = radioButton_Play.BackColor;// System.Drawing.Color.Aqua;


            //volume
            progressBar1.Value = wplayer.settings.volume;



            System.Reflection.Assembly assembly = this.GetType().Assembly;


            Bitmap bmp = new Bitmap(assembly.GetManifestResourceStream("Haytham_Client.Resources.VolumeOff.png"));
            pictureBox1.Image = bmp;

           // Cursor.Hide();


        }