Beispiel #1
0
        public async Task VisualizeMonitoredTypeAsync(bool forceEval, bool showError)
        {
            //
            // Refresh the monitored type
            //
            if (string.IsNullOrWhiteSpace(MonitorTypeName))
            {
                return;
            }

            var monitorTC = TypeCode.Get(MonitorTypeName);

            var code = await Task.Run(() => monitorTC.GetLinkedCode());

            OnLinkedMonitoredCode(code);

            if (!forceEval && lastLinkedCode != null && lastLinkedCode.CacheKey == code.CacheKey)
            {
                return;
            }

            //
            // Send the code to the device
            //
            try {
                //
                // Declare and Show it
                //
                Log(code.ValueExpression);
                var resp = await EvalForResponseAsync(code.Declarations, code.ValueExpression, showError);

                if (resp.HasErrors)
                {
                    return;
                }

                //
                // If we made it this far, remember so we don't re-send the same
                // thing immediately
                //
                lastLinkedCode = code;

                //
                // Update the editor
                //
                await UpdateEditorAsync(code, resp);
            }
            catch (Exception ex) {
                if (showError)
                {
                    Fail("Could not communicate with the app.\n\n{0}: {1}", ex.GetType(), ex.Message);
                }
            }
        }
Beispiel #2
0
		protected void OnLinkedMonitoredCode (LinkedCode code)
		{
			LinkedMonitoredCode (code);
		}
Beispiel #3
0
 async Task UpdateEditorAsync (LinkedCode code, EvalResponse resp)
 {
     await UpdateEditorWatchesAsync (code.Types.SelectMany (x => x.Watches), resp.WatchValues);
 }
Beispiel #4
0
        public async Task VisualizeMonitoredTypeAsync (bool forceEval, bool showError)
        {
            //
            // Refresh the monitored type
            //
            if (string.IsNullOrWhiteSpace (MonitorTypeName))
                return;

            var monitorTC = TypeCode.Get (MonitorTypeName);

            var code = await Task.Run (() => monitorTC.GetLinkedCode ());

            OnLinkedMonitoredCode (code);

            if (!forceEval && lastLinkedCode != null && lastLinkedCode.CacheKey == code.CacheKey) {
                return;
            }

            //
            // Send the code to the device
            //
            try {
                //
                // Declare it
                //
                Log (code.Declarations);
                if (!await EvalAsync (code.Declarations, showError)) return;

                //
                // Show it
                //
                Log (code.ValueExpression);
                var resp = await EvalForResponseAsync (code.ValueExpression, showError);
                if (resp.HasErrors)
                    return;

                //
                // If we made it this far, remember so we don't re-send the same
                // thing immediately
                //
                lastLinkedCode = code;

                //
                // Update the editor
                //
                await UpdateEditorAsync (code, resp);

            }
            catch (Exception ex) {
                if (showError) {
                    Alert ("Could not communicate with the app.\n\n{0}: {1}", ex.GetType (), ex.Message);
                }
            }
        }
Beispiel #5
0
 protected void OnLinkedMonitoredCode(LinkedCode code)
 {
     LinkedMonitoredCode(code);
 }
Beispiel #6
0
 async Task UpdateEditorAsync(LinkedCode code, EvalResponse resp)
 {
     await UpdateEditorWatchesAsync(code.Types.SelectMany(x => x.Watches), resp.WatchValues);
 }