private void addToArrayB_Click(object sender, EventArgs e)
        {
            var x     = (double)xArrayPosNUD.Value;
            var timez = (int)arrayTimerNUD.Value;

            xes.Add(new mvmt(x, timez));
            ResponseBox.AppendText("Value: " + x + " Time: " + timez + "\r\n");
        }
Exemple #2
0
 public void EventHandler(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         MainWindow.AppWindow.Inputfield.Text = ResponseBox.SelectedItem();
         MainWindow.AppWindow.Inputfield.Focus();
         MainWindow.AppWindow.Inputfield.CaretIndex = MainWindow.AppWindow.Inputfield.Text.Length;
     }
 }
Exemple #3
0
 public override void Execute()
 {
     if (clearhist)
     {
         HistoryManager.ClearHistory();
     }
     ResponseBox.KeyDown(EventHandler);
     ResponseBox.SetItems(HistoryManager.GetHistory());
 }
Exemple #4
0
 public void WriteResponse(string text) // Thread-safe writing to the Response TextBox
 {
     if (ResponseBox.InvokeRequired)
     {
         ResponseBox.Invoke((MethodInvoker)(() =>
                                            ResponseBox.Text = text
                                            ));
     }
     else
     {
         ResponseBox.Text = text;
     }
 }
 public override void Execute()
 {
     if (term.Length < 1)
     {
         return;
     }
     videos = Youtube.SearchVideos(term, 10);
     foreach (string[] s in videos)
     {
         videoids.Add(s[0]);
         videonames.Add(s[1]);
     }
     ResponseBox.KeyDown(EventHandler);
     ResponseBox.SetItems(videonames);
 }
Exemple #6
0
 public override void Execute()
 {
     if (term.Length < 1)
     {
         return;
     }
     playlists = Youtube.SearchPlaylists(term, 10);
     foreach (string[] s in playlists)
     {
         playlistids.Add(s[0]);
         playlistnames.Add(s[1]);
     }
     ResponseBox.KeyDown(EventHandler);
     ResponseBox.SetItems(playlistnames);
 }
 public void EventHandler(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Enter)
     {
         string url = Youtube.GetVideoUrlfromID(videoids[ResponseBox.SelectedIndex()]);
         try
         {
             Process.Start("chrome.exe", url);
         }
         catch (Exception)
         {
             Process.Start(url);
         }
         MainWindow.AppWindow.Done();
     }
 }
Exemple #8
0
        public override void Execute()
        {
            ResponseBox.KeyDown(EventHandler);
            List <List <string> > commands       = CommandDefinitionManager.GetAllCommands().Keys.ToList();
            List <string>         commandstrings = new List <string>();

            commands.ForEach(calls =>
            {
                string callstring = "";
                calls.ForEach(call =>
                {
                    callstring += call + " ";
                });
                commandstrings.Add(callstring);
            });
            ResponseBox.SetItems(commandstrings);
        }
        private void buildSineB_Click(object sender, EventArgs e)
        {
            Graphics g   = this.CreateGraphics();
            Pen      pen = new Pen(Brushes.Black, 1.0F);

            float x1 = 0;
            float y1 = 0;

            float y2 = 0;

            float yEx       = 450;
            float eF        = 100;
            var   amplitude = (double)amplitudeNUD.Value;
            var   period    = (double)periodNUD.Value;
            var   phase     = (double)phaseNUD.Value;
            var   shift     = (double)shiftNUD.Value;

            var largest = 0f;

            for (float x = 0; x < period; x += 0.01F)
            {
                y2 = Siner(amplitude, x, period, Math.PI, 0);
                if (y2 > largest)
                {
                    largest = y2;
                }
            }
            sineVals2.Clear();
            for (float x = 0; x < Width; x += 0.01F)
            {
                y2 = Siner(amplitude, x, period, Math.PI, shift);
                if (x < period)
                {
                    sineVals2.Add(y2);
                }
                y2 = y2 - (float)shift;

                y2 /= largest;

                g.DrawLine(pen, x1 * eF, y1 * eF + yEx, x * eF, y2 * eF + yEx);
                x1 = x;
                y1 = y2;
            }

            largest = 0;
            for (int i = 1; i < (sineVals2.Count); i++)
            {
                var temp = Math.Abs(sineVals2[i] - sineVals2[i - 1]);
                if (temp > largest)
                {
                    largest = temp;
                }
            }

            if (largest > 1)
            {
                sineStatusTB.Text      = "BAD: " + largest.ToString();
                sineStatusTB.BackColor = System.Drawing.Color.Red;
            }
            else
            {
                sineStatusTB.Text      = "GOOD: " + largest.ToString();
                sineStatusTB.BackColor = System.Drawing.Color.Green;
            }
            foreach (float val in sineVals2)
            {
                ResponseBox.AppendText(val.ToString() + ", ");
            }
            //ResponseBox.Text = sineVals2.Count.ToString();

            maxLBL.Text = "MAX: " + (amplitude + shift).ToString();
            minLBL.Text = "MIN: " + ((amplitude + shift) * -1).ToString();
            g.DrawLine(pen, 0, yEx, Width, yEx);
            g.DrawLine(pen, 0, yEx - eF, Width, yEx - eF);
            g.DrawLine(pen, 0, yEx + eF, Width, yEx + eF);
        }
 private void clearArrayB_Click(object sender, EventArgs e)
 {
     xes.Clear();
     ResponseBox.Clear();
 }
        private async void SendButton_Click(object sender, EventArgs e)
        {
            delayStart = TimeSpan.FromMilliseconds(1300);
            period     = TimeSpan.FromMilliseconds(10);

            Func <CancellationToken, Task> func;

            string response;

            if (x13Button.Checked)
            {
                hexapod.udpHex.functionCode = 0x1301;
            }
            else
            {
                hexapod.udpHex.functionCode = 0x1401;
            }

            if (tabControl1.SelectedTab == tabPage1)
            {
                if (mvmtCB.Checked)
                {
                    for (int i = 0; i < xes.Count; i++)
                    {
                        var x = xes[i].xPos;
                        var t = xes[i].timer;
                        response = await hexapod.asyncMove(x, x, x, x, x, x, t);
                    }
                }
                else
                {
                    if (useSineCB.Checked)
                    {
                        var x = sineVals2[0];
                        response = await hexapod.asyncMove(x, x, x, x, x, x, 1300);

                        func = t => Doer2();
                    }
                    else
                    {
                        var x = sineVals[0];
                        response = await hexapod.asyncMove(x, x, x, x, x, x, 1300);

                        func = t => Doer();
                    }
                    ctr++;
                    tAsync = new TimerAsync(func, delayStart, period, false);
                    tAsync.Start();
                    //for (int i = 0; i < 30; i++)
                    //{
                    //    var x = sineVals[i];
                    //    if (i == 0)
                    //    {
                    //        response = await hexapod.asyncMove(x, x, x, x, x, x, 1000);
                    //        Thread.Sleep(2000);
                    //    }
                    //    else
                    //    {
                    //        response = await hexapod.asyncMove(x, x, x, x, x, x, 1000);
                    //    }
                    //}
                }
            }
            else
            {
                response = await hexapod.ReadSetting("FN", 28, 1);

                ResponseBox.AppendText(response + "\r\n");
            }
        }