예제 #1
0
        static void Main()
        {
            evth = new eventHandler();
            evth.LogMessage(evth, new LogEventArgs(LogLevel.DEBUG, "Program start."));
            MainForm mainForm   = new MainForm();
            Thread   mainThread = new Thread(new ThreadStart(mainForm.Main));

            mainThread.Start();
            while (!mainThread.IsAlive)
            {
                ;
            }
            evth.LogMessage(evth, new LogEventArgs(LogLevel.DEBUG, "Main thread running."));
            Thread.Sleep(100);

            LJU3Control lju3Control = new LJU3Control(evth);
            Thread      lju3Thread  = new Thread(new ThreadStart(lju3Control.Main));

            lju3Thread.Start();


            while (mainThread.IsAlive)
            {
                Thread.Sleep(10);
            }
            mainThread.Join();
            evth.LogMessage(evth, new LogEventArgs(LogLevel.DEBUG, "Main thread terminated."));
            lju3Thread.Abort();
            while (lju3Thread.IsAlive)
            {
                ;
            }
            lju3Thread.Join();
            evth.LogMessage(evth, new LogEventArgs(LogLevel.DEBUG, "Program exit normally."));
        }
예제 #2
0
 private void Evth_onDigitalIOChange(object sender, DigitalIOChangedArgs args)
 {
     if (onChange == null || args.Channel != Channel)
     {
         return;
     }
     args.Ctl = Ctl;
     onChange(this, args);
     evth.LogMessage(this, new LogEventArgs(LogLevel.INFO, "Digital IO channel " + args.Channel.ToString() + " (" + args.Ctl.Name.ToString() + ") value: " + args.Value.ToString()));
 }
예제 #3
0
 public void ShowErrorMessage(LabJackUDException e)
 {
     //Called when an error occurred. When the error is a group error (communication/fatal), abort.
     evth.LogMessage(this, new LogEventArgs(LogLevel.ERROR, e.ToString()));
     if (e.LJUDError > U3.LJUDERROR.MIN_GROUP_ERROR)
     {
         Environment.Exit(-1);                                   //TODO: Test this! or just abort the thread.
     }
 }