Example #1
0
        public static bool Get(GrblViewModel model)
        {
            bool?res = null;
            CancellationToken cancellationToken = new CancellationToken();

            Comms.com.PurgeQueue();
            SystemInfo.Clear();

            model.Silent = true;

            new Thread(() =>
            {
                res = WaitFor.AckResponse <string>(
                    cancellationToken,
                    response => Process(response),
                    a => model.OnResponseReceived += a,
                    a => model.OnResponseReceived -= a,
                    400, () => Comms.com.WriteCommand(GrblConstants.CMD_GETINFO));
            }).Start();

            while (res == null)
            {
                EventUtils.DoEvents();
            }

            model.Silent = false;

            model.AxisEnabledFlags = AxisFlags;
            model.LatheModeEnabled = LatheModeEnabled;

            return(res == true);
        }