From bc9fd5fa3b1d23c9bb3d2a0c471c99c8719eac53 Mon Sep 17 00:00:00 2001 From: Caitlin Hennessy Date: Mon, 16 Oct 2017 18:35:45 -0700 Subject: [PATCH] 'Connect your device' notification (#553) * 'Connect your device' notification for UWP app --- editor/extension.ts | 20 ++++++++++++-------- package.json | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/editor/extension.ts b/editor/extension.ts index 266d86d4..d878f9fe 100644 --- a/editor/extension.ts +++ b/editor/extension.ts @@ -222,13 +222,9 @@ namespace pxt.editor { }) } - export function deployCoreAsync(resp: pxtc.CompileResult, isCli = false): Promise { + export function deployCoreAsync(resp: pxtc.CompileResult, d: pxt.commands.DeployOptions = {}): Promise { let saveHexAsync = () => { - if (isCli) { - return Promise.resolve() - } else { - return pxt.commands.saveOnlyAsync(resp) - } + return pxt.commands.saveOnlyAsync(resp) } startTime = 0 @@ -331,8 +327,16 @@ namespace pxt.editor { return wrap.cortexM.reset(false) }) }) - .catch(e => { - return saveHexAsync(); + .catch(e => { + if (e.type === "devicenotfound" && d.reportError) { + if (d.reportError) { + d.reportError(Util.lf("Please connect your device.")) + } else { + console.error(e) + } + } else { + saveHexAsync() + } }) } diff --git a/package.json b/package.json index b2d9f7b3..83022cb9 100644 --- a/package.json +++ b/package.json @@ -38,6 +38,6 @@ "semantic-ui-less": "^2.2.4" }, "dependencies": { - "pxt-core": "0.14.5" + "pxt-core": "0.14.7" } }