Beispiel #1
0
        private void ThresSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
        {
            int val = (int)ThresSlider.Value;

            this.SliderValue.Header = string.Format("Threshold: {0}", val);
            CWrapper.SetOverlayer(4, val);
        }
Beispiel #2
0
 public void TestKill()
 {
     using CWrapper wrapper = new CWrapper(Constants.ECHO_CONSOLE_LOCATION);
     wrapper.Execute();
     wrapper.Kill();
     Assert.False(wrapper.Executing);
 }
Beispiel #3
0
        public static void Main()
        {
            CWrapper wrapper = new CWrapper("cmd");

            wrapper.OutputDataReceived += (s, e) => Console.WriteLine(e.Data);
            wrapper.Execute("/C ping www.google.co.nz");
            wrapper.ExitedMRE.Wait();
        }
Beispiel #4
0
 public void TestExecute()
 {
     using CWrapper wrapper = new CWrapper(Constants.ECHO_CONSOLE_LOCATION);
     wrapper.Execute();
     Assert.True(wrapper.Executing);
     Assert.Throws <InvalidOperationException>(() => wrapper.Execute());
     wrapper.Kill();
 }
Beispiel #5
0
 public void SetInvertThreshold(bool inv)
 {
     try {
         CWrapper.SetOverlayer(3, inv == true ? 1 : 0);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Service Error:\n{0}", ex.Message);
     }
 }
Beispiel #6
0
        public void TestExitEvent()
        {
            using CWrapper wrapper = new CWrapper(Constants.ECHO_CONSOLE_LOCATION);
            DateTime exitTime = DateTime.MinValue;

            wrapper.Exited += (_, e) => exitTime = e;
            wrapper.Execute(EchoConsole.Program.EXIT_KEY);
            wrapper.ExitedMRE.Wait();
            Assert.True(exitTime.AddMilliseconds(10) > DateTime.Now);
        }
Beispiel #7
0
 public void SetProcessing(bool doprocessing)
 {
     try {
         CWrapper.SetDoProcess(doprocessing == true ? 1 : 0);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Service Error:\n{0}", ex.Message);
     }
 }
Beispiel #8
0
        public void TestKillEventFired()
        {
            using CWrapper wrapper = new CWrapper(Constants.ECHO_CONSOLE_LOCATION);
            bool eventFired = false;

            wrapper.Killed += (_, __) => eventFired = true;
            wrapper.Execute();
            wrapper.Kill();
            wrapper.KilledMRE.Wait();
            Assert.True(eventFired);
        }
Beispiel #9
0
 public void SetDisplayingImageType(int type)
 {
     try
     {
         CWrapper.SetDispImage(type);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Service Error:\n{0}", ex.Message);
     }
 }
Beispiel #10
0
 public double GetYPercent()
 {
     try
     {
         return(CWrapper.Y_CenterDistancePercet());
     }
     catch (Exception ex)
     {
         Console.WriteLine("Service Error:\n{0}", ex.Message);
     }
     return(0);
 }
Beispiel #11
0
 public void SetOverlay(bool threshold, bool fixedCross, bool detectedCross)
 {
     try
     {
         CWrapper.SetOverlayer(0, threshold == true ? 1 : 0);
         CWrapper.SetOverlayer(1, fixedCross == true ? 1 : 0);
         CWrapper.SetOverlayer(2, detectedCross == true ? 1 : 0);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Service Error:\n{0}", ex.Message);
     }
 }
Beispiel #12
0
 private void trackBar1_ValueChanged(object sender, EventArgs e)
 {
     try
     {
         double d = trackBar1.Value * 0.01;
         this.textBox1.Text = string.Format("{0:0.00}", d);
         CWrapper.SetBWThreshold(d);
     }
     catch
     {
         // nix zu tun
     }
 }
Beispiel #13
0
        public void TestOutput()
        {
            using CWrapper wrapper = GetWrapper();

            string returnData = null;

            wrapper.OutputDataReceived += (_, e) => returnData = e.Data;

            wrapper.Execute(EchoConsole.Program.FLOOD_KEY);
            wrapper.OutputDataMRE.Wait();
            wrapper.Kill();

            Assert.Equal(EchoConsole.Program.FLOOD_OUTPUT, returnData);
        }
Beispiel #14
0
        public void TestInput()
        {
            const string ECHO_DATA  = "This data shall be echoed";
            string       returnData = null;

            using CWrapper wrapper      = GetWrapper();
            wrapper.OutputDataReceived += (_, e) => returnData = e.Data;

            wrapper.Execute();
            wrapper.WriteToConsole(ECHO_DATA);
            wrapper.OutputDataMRE.Wait();
            wrapper.Kill();

            Assert.Equal(ECHO_DATA, returnData);
        }
Beispiel #15
0
        public void SetThreshold(int newThreshold)
        {
            try
            {
                if (newThreshold < 0)
                {
                    newThreshold = 0;
                }
                if (newThreshold > 255)
                {
                    newThreshold = 255;
                }

                CWrapper.SetOverlayer(4, newThreshold);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Service Error:\n{0}", ex.Message);
            }
        }
Beispiel #16
0
        TestDelegate J2C(JDdd i)
        {
            CWrapper w = new CWrapper(i);

            return(w.DddFwd);
        }
Beispiel #17
0
 private void imagetype_f_Checked(object sender, RoutedEventArgs e)
 {
     UncheckAll();
     CWrapper.SetDispImage(5);
     imagetype_f.IsChecked = true;
 }
Beispiel #18
0
 private void pt_camera_Click(object sender, RoutedEventArgs e)
 {
     pt_camera.IsChecked    = true;
     pt_processed.IsChecked = false;
     CWrapper.SetDoProcess(0);
 }
Beispiel #19
0
 TestDelegate J2C(JDdd i)
 {
     CWrapper w=new CWrapper(i);
     return w.DddFwd;
 }
Beispiel #20
0
 private void InvThreshold_Click(object sender, RoutedEventArgs e)
 {
     CWrapper.SetOverlayer(3, this.InvThreshold.IsChecked == true ? 1 : 0);
 }
Beispiel #21
0
 private void CB_2_Click(object sender, RoutedEventArgs e)
 {
     CWrapper.SetOverlayer(2, CB_2.IsChecked == true ? 1 : 0);
 }