Esempio n. 1
0
 public void ReadMain()
 {
     while (running)
     {
         if (gc.RequestsToDo.Count < 10)
         {
             gc.Add("g0 x10 y10 z10 f600");
             gc.Add("g1 x0 y0 z0 f600");
         }
         else
         {
             gc.Add("?");
             Thread.Sleep(1000);
         }
         Thread.Sleep(100);
         //gc.Add(Console.ReadLine());
     }
 }
Esempio n. 2
0
        async void DoExecuteFileCommand()
        {
            if (!ExecutingFile)
            {
                ExecutingFile        = true;
                _cancelFileExecution = new CancellationTokenSource();
                await Task.Run(() =>
                {
                    TcpGrblClient tcpGrblClient = ViewModelLocator.TcpGrblClient;
                    if (tcpGrblClient.IsConnected)
                    {
                        string[] lines = FileContent.Split('\n');
                        foreach (string line in lines)
                        {
                            UserRequest request = new UserRequest();
                            request.SetContent(line);
                            if (tcpGrblClient.Add(request))
                            {
                                while (!request.IsFinished && !_cancelFileExecution.IsCancellationRequested)
                                {
                                    Task.Delay(10);
                                }
                            }
                            if (_cancelFileExecution.IsCancellationRequested)
                            {
                                break;
                            }
                        }
                    }
                });

                ExecutingFile = false;
            }
            else
            {
                _cancelFileExecution.Cancel();
            }
        }
Esempio n. 3
0
 public void DoInputCommand()
 {
     _tcpGrblClient.Add(_consoleInput);
     ConsoleInput = "";
 }