Merge branch 'develop' of https://github.com/nanoframework/nf-Visual-Studio-extension into generics-wip
This commit is contained in:
Коммит
deb51b8199
|
@ -27,7 +27,7 @@
|
|||
</WizardExtension>
|
||||
<WizardData>
|
||||
<packages repository="extension" repositoryId="455f2be5-bb07-451e-b351-a9faf3018dc9">
|
||||
<package id="nanoFramework.CoreLibrary" version="1.14.2"/>
|
||||
<package id="nanoFramework.CoreLibrary" version="1.15.5"/>
|
||||
</packages>
|
||||
</WizardData>
|
||||
</VSTemplate>
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
</WizardExtension>
|
||||
<WizardData>
|
||||
<packages repository="extension" repositoryId="bf694e17-fa5f-4877-9317-6d3664b2689a">
|
||||
<package id="nanoFramework.CoreLibrary" version="1.14.2"/>
|
||||
<package id="nanoFramework.CoreLibrary" version="1.15.5"/>
|
||||
</packages>
|
||||
</WizardData>
|
||||
</VSTemplate>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
</WizardExtension>
|
||||
<WizardData>
|
||||
<packages repository="extension" repositoryId="455f2be5-bb07-451e-b351-a9faf3018dc9">
|
||||
<package id="nanoFramework.CoreLibrary" version="1.14.2" />
|
||||
<package id="nanoFramework.CoreLibrary" version="1.15.5" />
|
||||
</packages>
|
||||
</WizardData>
|
||||
</VSTemplate>
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
</WizardExtension>
|
||||
<WizardData>
|
||||
<packages repository="extension" repositoryId="bf694e17-fa5f-4877-9317-6d3664b2689a">
|
||||
<package id="nanoFramework.CoreLibrary" version="1.14.2" />
|
||||
<package id="nanoFramework.CoreLibrary" version="1.15.5" />
|
||||
</packages>
|
||||
</WizardData>
|
||||
</VSTemplate>
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
</WizardExtension>
|
||||
<WizardData>
|
||||
<packages repository="extension" repositoryId="455f2be5-bb07-451e-b351-a9faf3018dc9">
|
||||
<package id="nanoFramework.CoreLibrary" version="1.14.2"/>
|
||||
<package id="nanoFramework.TestFramework" version="2.1.85"/>
|
||||
<package id="nanoFramework.CoreLibrary" version="1.15.5"/>
|
||||
<package id="nanoFramework.TestFramework" version="2.1.113"/>
|
||||
</packages>
|
||||
</WizardData>
|
||||
</VSTemplate>
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
</WizardExtension>
|
||||
<WizardData>
|
||||
<packages repository="extension" repositoryId="bf694e17-fa5f-4877-9317-6d3664b2689a">
|
||||
<package id="nanoFramework.CoreLibrary" version="1.14.2"/>
|
||||
<package id="nanoFramework.TestFramework" version="2.1.85"/>
|
||||
<package id="nanoFramework.CoreLibrary" version="1.15.5"/>
|
||||
<package id="nanoFramework.TestFramework" version="2.1.113"/>
|
||||
</packages>
|
||||
</WizardData>
|
||||
</VSTemplate>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
## Developer Notes
|
||||
|
||||
!! Be extremely careful when updating NuGet packages !!
|
||||
We are pushing the limits of the VS extensibility SDK, and it's very easy to break things. In particular, the most critical symptom to check for with each package update is the ability to start a debug session.
|
||||
On failure, a CompositionException is usually silently thrown, and the debugger refuses to start without any further clue on what is wrong.
|
||||
|
||||
VS2019
|
||||
|
||||
- ICSharpCode cannot be updated beyond v7.2.1.6856 because System.Collections.Immutable cannot go beyond v5.0.0.
|
|
@ -61,6 +61,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="key.snk" />
|
||||
<None Include="packages.lock.json" />
|
||||
<None Include="version.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -81,7 +82,7 @@
|
|||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Nerdbank.GitVersioning">
|
||||
<Version>3.5.104</Version>
|
||||
<Version>3.6.146</Version>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
|
|
|
@ -39,9 +39,9 @@
|
|||
},
|
||||
"Nerdbank.GitVersioning": {
|
||||
"type": "Direct",
|
||||
"requested": "[3.5.104, )",
|
||||
"resolved": "3.5.104",
|
||||
"contentHash": "U2rlnA+5RxROC53NXtcbX+ZZUajdcuBLQ/OgZF9abOZZzCBuqxUThx1rsQ+Lw8MMy8CU2o6Ctz0q3zz0bM5J8g=="
|
||||
"requested": "[3.6.146, )",
|
||||
"resolved": "3.6.146",
|
||||
"contentHash": "W1eQ8hD9Y/cZ2+ilgxECl003xr1hybpN3fMxoTlMqg++BixETBMWzS4y9s08oHJKXgKtudsoxhITNOEf1OR66w=="
|
||||
},
|
||||
"Microsoft.CodeAnalysis.BannedApiAnalyzers": {
|
||||
"type": "Transitive",
|
||||
|
|
|
@ -91,17 +91,18 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="key.snk" />
|
||||
<None Include="packages.lock.json" />
|
||||
<None Include="version.json" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Build.Framework">
|
||||
<Version>17.1.0</Version>
|
||||
<Version>17.12.6</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Build.Utilities.Core">
|
||||
<Version>17.1.0</Version>
|
||||
<Version>17.11.4</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Nerdbank.GitVersioning">
|
||||
<Version>3.5.104</Version>
|
||||
<Version>3.6.146</Version>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
|
|
|
@ -4,33 +4,33 @@
|
|||
".NETFramework,Version=v4.7.2": {
|
||||
"Microsoft.Build.Framework": {
|
||||
"type": "Direct",
|
||||
"requested": "[17.1.0, )",
|
||||
"resolved": "17.1.0",
|
||||
"contentHash": "7PPEbjuL/lKQ8ftblxwBZKf5alZCA4GDvBTiO3UAVxtRe52a2jL3mc8TpKNiJZzytGz7fKdR5ClDCs7+Uw4hMg==",
|
||||
"requested": "[17.12.6, )",
|
||||
"resolved": "17.12.6",
|
||||
"contentHash": "jleteC0seumLGTmTVwob97lcwPj/dfgzL/V3g/VVcMZgo2Ic7jzdy8AYpByPDh8e3uRq0SjCl6HOFCjhy5GzRQ==",
|
||||
"dependencies": {
|
||||
"Microsoft.VisualStudio.Setup.Configuration.Interop": "3.0.4492",
|
||||
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
|
||||
}
|
||||
},
|
||||
"Microsoft.Build.Utilities.Core": {
|
||||
"type": "Direct",
|
||||
"requested": "[17.1.0, )",
|
||||
"resolved": "17.1.0",
|
||||
"contentHash": "JqhQ4q6L4IyA0Wh3PrDrxHHYMVHyOLIusyC4imAnhcnZiOC4+CwgVRSdo8fLsQmvz0Jab8FFrU1NPZFbDoxRng==",
|
||||
"requested": "[17.11.4, )",
|
||||
"resolved": "17.11.4",
|
||||
"contentHash": "b2CEJMgVuv5fkhaR6TXjgocIa6YQbseowRj15q3/IyH343EPr+CrxXAZs6Xp6uZDE8A3ynsLPlufFUMkjUl37A==",
|
||||
"dependencies": {
|
||||
"Microsoft.Build.Framework": "17.1.0",
|
||||
"Microsoft.Build.Framework": "17.11.4",
|
||||
"Microsoft.IO.Redist": "6.0.0",
|
||||
"Microsoft.NET.StringTools": "1.0.0",
|
||||
"Microsoft.VisualStudio.Setup.Configuration.Interop": "3.0.4492",
|
||||
"System.Collections.Immutable": "5.0.0",
|
||||
"System.Configuration.ConfigurationManager": "4.7.0"
|
||||
"Microsoft.NET.StringTools": "17.11.4",
|
||||
"System.Collections.Immutable": "8.0.0",
|
||||
"System.Configuration.ConfigurationManager": "8.0.0",
|
||||
"System.Memory": "4.5.5",
|
||||
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
|
||||
}
|
||||
},
|
||||
"Nerdbank.GitVersioning": {
|
||||
"type": "Direct",
|
||||
"requested": "[3.5.104, )",
|
||||
"resolved": "3.5.104",
|
||||
"contentHash": "U2rlnA+5RxROC53NXtcbX+ZZUajdcuBLQ/OgZF9abOZZzCBuqxUThx1rsQ+Lw8MMy8CU2o6Ctz0q3zz0bM5J8g=="
|
||||
"requested": "[3.6.146, )",
|
||||
"resolved": "3.6.146",
|
||||
"contentHash": "W1eQ8hD9Y/cZ2+ilgxECl003xr1hybpN3fMxoTlMqg++BixETBMWzS4y9s08oHJKXgKtudsoxhITNOEf1OR66w=="
|
||||
},
|
||||
"Microsoft.IO.Redist": {
|
||||
"type": "Transitive",
|
||||
|
@ -43,18 +43,13 @@
|
|||
},
|
||||
"Microsoft.NET.StringTools": {
|
||||
"type": "Transitive",
|
||||
"resolved": "1.0.0",
|
||||
"contentHash": "ZYVcoDM0LnSyT5nWoRGfShYdOecCw2sOXWwP6j1Z0u48Xq3+BVvZ+EiPCX9/8Gz439giW+O1H1kWF9Eb/w6rVg==",
|
||||
"resolved": "17.11.4",
|
||||
"contentHash": "mudqUHhNpeqIdJoUx2YDWZO/I9uEDYVowan89R6wsomfnUJQk6HteoQTlNjZDixhT2B4IXMkMtgZtoceIjLRmA==",
|
||||
"dependencies": {
|
||||
"System.Memory": "4.5.4",
|
||||
"System.Runtime.CompilerServices.Unsafe": "5.0.0"
|
||||
"System.Memory": "4.5.5",
|
||||
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
|
||||
}
|
||||
},
|
||||
"Microsoft.VisualStudio.Setup.Configuration.Interop": {
|
||||
"type": "Transitive",
|
||||
"resolved": "3.0.4492",
|
||||
"contentHash": "BfkqM96P8+N+cz4T+pxKrIKk2ZD1YMxCXH2ivtBDj5tx6Mc2YQLK1+3h+C6Qebper0RBipuHVn51lb9SZH6bKQ=="
|
||||
},
|
||||
"System.Buffers": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.5.1",
|
||||
|
@ -62,24 +57,22 @@
|
|||
},
|
||||
"System.Collections.Immutable": {
|
||||
"type": "Transitive",
|
||||
"resolved": "5.0.0",
|
||||
"contentHash": "FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==",
|
||||
"resolved": "8.0.0",
|
||||
"contentHash": "AurL6Y5BA1WotzlEvVaIDpqzpIPvYnnldxru8oXJU2yFxFUy3+pNXjXd1ymO+RA0rq0+590Q8gaz2l3Sr7fmqg==",
|
||||
"dependencies": {
|
||||
"System.Memory": "4.5.4"
|
||||
"System.Memory": "4.5.5",
|
||||
"System.Runtime.CompilerServices.Unsafe": "6.0.0"
|
||||
}
|
||||
},
|
||||
"System.Configuration.ConfigurationManager": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.7.0",
|
||||
"contentHash": "/anOTeSZCNNI2zDilogWrZ8pNqCmYbzGNexUnNhjW8k0sHqEZ2nHJBp147jBV3hGYswu5lINpNg1vxR7bnqvVA==",
|
||||
"dependencies": {
|
||||
"System.Security.Permissions": "4.7.0"
|
||||
}
|
||||
"resolved": "8.0.0",
|
||||
"contentHash": "JlYi9XVvIREURRUlGMr1F6vOFLk7YSY4p1vHo4kX3tQ0AGrjqlRWHDi66ImHhy6qwXBG3BJ6Y1QlYQ+Qz6Xgww=="
|
||||
},
|
||||
"System.Memory": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.5.4",
|
||||
"contentHash": "1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==",
|
||||
"resolved": "4.5.5",
|
||||
"contentHash": "XIWiDvKPXaTveaB7HVganDlOCRoj03l+jrwNvcge/t8vhGYKvqV+dMv6G4SAX2NoNmN0wZfVPTAlFwZcZvVOUw==",
|
||||
"dependencies": {
|
||||
"System.Buffers": "4.5.1",
|
||||
"System.Numerics.Vectors": "4.5.0",
|
||||
|
@ -95,88 +88,11 @@
|
|||
"type": "Transitive",
|
||||
"resolved": "6.0.0",
|
||||
"contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
|
||||
},
|
||||
"System.Security.AccessControl": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.7.0",
|
||||
"contentHash": "JECvTt5aFF3WT3gHpfofL2MNNP6v84sxtXxpqhLBCcDRzqsPBmHhQ6shv4DwwN2tRlzsUxtb3G9M3763rbXKDg==",
|
||||
"dependencies": {
|
||||
"System.Security.Principal.Windows": "4.7.0"
|
||||
}
|
||||
},
|
||||
"System.Security.Permissions": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.7.0",
|
||||
"contentHash": "dkOV6YYVBnYRa15/yv004eCGRBVADXw8qRbbNiCn/XpdJSUXkkUeIvdvFHkvnko4CdKMqG8yRHC4ox83LSlMsQ==",
|
||||
"dependencies": {
|
||||
"System.Security.AccessControl": "4.7.0"
|
||||
}
|
||||
},
|
||||
"System.Security.Principal.Windows": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.7.0",
|
||||
"contentHash": "ojD0PX0XhneCsUbAZVKdb7h/70vyYMDYs85lwEI+LngEONe/17A0cFaRFqZU+sOEidcVswYWikYOQ9PPfjlbtQ=="
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.7.2/win": {
|
||||
"System.Security.AccessControl": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.7.0",
|
||||
"contentHash": "JECvTt5aFF3WT3gHpfofL2MNNP6v84sxtXxpqhLBCcDRzqsPBmHhQ6shv4DwwN2tRlzsUxtb3G9M3763rbXKDg==",
|
||||
"dependencies": {
|
||||
"System.Security.Principal.Windows": "4.7.0"
|
||||
}
|
||||
},
|
||||
"System.Security.Principal.Windows": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.7.0",
|
||||
"contentHash": "ojD0PX0XhneCsUbAZVKdb7h/70vyYMDYs85lwEI+LngEONe/17A0cFaRFqZU+sOEidcVswYWikYOQ9PPfjlbtQ=="
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.7.2/win-arm64": {
|
||||
"System.Security.AccessControl": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.7.0",
|
||||
"contentHash": "JECvTt5aFF3WT3gHpfofL2MNNP6v84sxtXxpqhLBCcDRzqsPBmHhQ6shv4DwwN2tRlzsUxtb3G9M3763rbXKDg==",
|
||||
"dependencies": {
|
||||
"System.Security.Principal.Windows": "4.7.0"
|
||||
}
|
||||
},
|
||||
"System.Security.Principal.Windows": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.7.0",
|
||||
"contentHash": "ojD0PX0XhneCsUbAZVKdb7h/70vyYMDYs85lwEI+LngEONe/17A0cFaRFqZU+sOEidcVswYWikYOQ9PPfjlbtQ=="
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.7.2/win-x64": {
|
||||
"System.Security.AccessControl": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.7.0",
|
||||
"contentHash": "JECvTt5aFF3WT3gHpfofL2MNNP6v84sxtXxpqhLBCcDRzqsPBmHhQ6shv4DwwN2tRlzsUxtb3G9M3763rbXKDg==",
|
||||
"dependencies": {
|
||||
"System.Security.Principal.Windows": "4.7.0"
|
||||
}
|
||||
},
|
||||
"System.Security.Principal.Windows": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.7.0",
|
||||
"contentHash": "ojD0PX0XhneCsUbAZVKdb7h/70vyYMDYs85lwEI+LngEONe/17A0cFaRFqZU+sOEidcVswYWikYOQ9PPfjlbtQ=="
|
||||
}
|
||||
},
|
||||
".NETFramework,Version=v4.7.2/win-x86": {
|
||||
"System.Security.AccessControl": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.7.0",
|
||||
"contentHash": "JECvTt5aFF3WT3gHpfofL2MNNP6v84sxtXxpqhLBCcDRzqsPBmHhQ6shv4DwwN2tRlzsUxtb3G9M3763rbXKDg==",
|
||||
"dependencies": {
|
||||
"System.Security.Principal.Windows": "4.7.0"
|
||||
}
|
||||
},
|
||||
"System.Security.Principal.Windows": {
|
||||
"type": "Transitive",
|
||||
"resolved": "4.7.0",
|
||||
"contentHash": "ojD0PX0XhneCsUbAZVKdb7h/70vyYMDYs85lwEI+LngEONe/17A0cFaRFqZU+sOEidcVswYWikYOQ9PPfjlbtQ=="
|
||||
}
|
||||
}
|
||||
".NETFramework,Version=v4.7.2/win": {},
|
||||
".NETFramework,Version=v4.7.2/win-arm64": {},
|
||||
".NETFramework,Version=v4.7.2/win-x64": {},
|
||||
".NETFramework,Version=v4.7.2/win-x86": {}
|
||||
}
|
||||
}
|
|
@ -5,12 +5,14 @@ using System;
|
|||
using System.Collections.Concurrent;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using nanoFramework.Tools.Debugger;
|
||||
using nanoFramework.Tools.Debugger.NFDevice;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.FirmwareUpdate;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel;
|
||||
using static nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel.DeviceExplorerViewModel.Messages;
|
||||
using Task = System.Threading.Tasks.Task;
|
||||
|
||||
namespace nanoFramework.Tools.VisualStudio.Extension.AutomaticUpdates
|
||||
|
@ -19,7 +21,6 @@ namespace nanoFramework.Tools.VisualStudio.Extension.AutomaticUpdates
|
|||
{
|
||||
private const int ExclusiveAccessTimeout = 3000;
|
||||
private static UpdateManager s_instance;
|
||||
private ViewModelLocator ViewModelLocator;
|
||||
private readonly Package _package;
|
||||
|
||||
private readonly ConcurrentDictionary<string, object> devicesUpdatING = new ConcurrentDictionary<string, object>();
|
||||
|
@ -30,17 +31,12 @@ namespace nanoFramework.Tools.VisualStudio.Extension.AutomaticUpdates
|
|||
_package = package ?? throw new ArgumentNullException($"{package} can't be null.");
|
||||
}
|
||||
|
||||
public static void Initialize(
|
||||
AsyncPackage package,
|
||||
ViewModelLocator vmLocator)
|
||||
public static void Initialize(AsyncPackage package)
|
||||
{
|
||||
s_instance = new UpdateManager(package)
|
||||
{
|
||||
ViewModelLocator = vmLocator
|
||||
};
|
||||
s_instance = new UpdateManager(package);
|
||||
|
||||
Messenger.Default.Register<NotificationMessage>(s_instance, DeviceExplorerViewModel.MessagingTokens.LaunchFirmwareUpdateForNanoDevice, (message) => s_instance.LaunchUpdate(message.Notification));
|
||||
Messenger.Default.Register<NotificationMessage>(s_instance, DeviceExplorerViewModel.MessagingTokens.NanoDeviceHasDeparted, (message) => s_instance.ProcessNanoDeviceDeparture(message.Notification));
|
||||
WeakReferenceMessenger.Default.Register<LaunchFirmwareUpdateForNanoDeviceMessage>(s_instance, (r, message) => s_instance.LaunchUpdate(message.Value));
|
||||
WeakReferenceMessenger.Default.Register<NanoDeviceHasDepartedMessage>(s_instance, (r, message) => s_instance.ProcessNanoDeviceDeparture(message.Value));
|
||||
}
|
||||
|
||||
private void ProcessNanoDeviceDeparture(string deviceId)
|
||||
|
@ -69,7 +65,9 @@ namespace nanoFramework.Tools.VisualStudio.Extension.AutomaticUpdates
|
|||
|
||||
var deviceUniqueId = Guid.Parse(deviceId);
|
||||
|
||||
var nanoDevice = ViewModelLocator.DeviceExplorer.AvailableDevices.FirstOrDefault(d => d.DeviceUniqueId == deviceUniqueId);
|
||||
var deviceExplorer = Ioc.Default.GetService<DeviceExplorerViewModel>();
|
||||
|
||||
var nanoDevice = deviceExplorer.AvailableDevices.FirstOrDefault(d => d.DeviceUniqueId == deviceUniqueId);
|
||||
|
||||
// sanity check
|
||||
if (
|
||||
|
@ -219,7 +217,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension.AutomaticUpdates
|
|||
}
|
||||
|
||||
// check if the device is still there
|
||||
if (ViewModelLocator.DeviceExplorer.AvailableDevices.FirstOrDefault(d => d.DeviceUniqueId == deviceUniqueId) == null)
|
||||
if (deviceExplorer.AvailableDevices.FirstOrDefault(d => d.DeviceUniqueId == deviceUniqueId) == null)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine($"[Automatic Updates] {nanoDevice.TargetName} is not available anymore.");
|
||||
|
@ -267,10 +265,10 @@ namespace nanoFramework.Tools.VisualStudio.Extension.AutomaticUpdates
|
|||
}
|
||||
|
||||
// if this is the selected device...
|
||||
if (ViewModelLocator.DeviceExplorer.SelectedDevice?.DeviceUniqueId == deviceUniqueId)
|
||||
if (deviceExplorer.SelectedDevice?.DeviceUniqueId == deviceUniqueId)
|
||||
{
|
||||
// ...reset property to force that device capabilities to be retrieved on next connection
|
||||
ViewModelLocator.DeviceExplorer.LastDeviceConnectedHash = 0;
|
||||
deviceExplorer.LastDeviceConnectedHash = 0;
|
||||
}
|
||||
|
||||
if (attemptToLaunchBooter)
|
||||
|
@ -281,7 +279,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension.AutomaticUpdates
|
|||
devicesUpdatING.TryRemove(deviceId, out var dummy);
|
||||
|
||||
// check if the device is still there
|
||||
if (ViewModelLocator.DeviceExplorer.AvailableDevices.FirstOrDefault(d => d.DeviceUniqueId == Guid.Parse(deviceId)) == null)
|
||||
if (deviceExplorer.AvailableDevices.FirstOrDefault(d => d.DeviceUniqueId == Guid.Parse(deviceId)) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<PropertyChanging />
|
||||
<PropertyChanged />
|
||||
</Weavers>
|
|
@ -3,16 +3,6 @@
|
|||
// See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using GalaSoft.MvvmLight.Ioc;
|
||||
using Microsoft;
|
||||
using Microsoft.VisualStudio.ProjectSystem.VS;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
using Microsoft.VisualStudio.TextTemplating.VSHost;
|
||||
using Microsoft.VisualStudio.Threading;
|
||||
using nanoFramework.Tools.VisualStudio.Extension;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.AutomaticUpdates;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
|
@ -22,7 +12,17 @@ using System.Reflection;
|
|||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using Microsoft;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.VisualStudio.ProjectSystem.VS;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
using Microsoft.VisualStudio.TextTemplating.VSHost;
|
||||
using Microsoft.VisualStudio.Threading;
|
||||
using nanoFramework.Tools.VisualStudio.Extension;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.AutomaticUpdates;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel;
|
||||
using Task = System.Threading.Tasks.Task;
|
||||
|
||||
[assembly: ProjectTypeRegistration(projectTypeGuid: NanoFrameworkPackage.ProjectTypeGuid,
|
||||
|
@ -579,37 +579,32 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
/// <returns>A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method.</returns>
|
||||
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
|
||||
{
|
||||
|
||||
// make sure "our" key exists and it's writable
|
||||
s_instance.UserRegistryRoot.CreateSubKey(EXTENSION_SUBKEY, true);
|
||||
|
||||
AddService(typeof(NanoDeviceCommService), CreateNanoDeviceCommServiceAsync);
|
||||
AddService(typeof(VirtualDeviceService), CreateVirtualDeviceManagerServiceAsync);
|
||||
|
||||
ViewModelLocator viewModelLocator = null;
|
||||
// Configure IoC container
|
||||
Ioc.Default.ConfigureServices(
|
||||
new ServiceCollection()
|
||||
.AddSingleton<DeviceExplorerViewModel>()
|
||||
.BuildServiceProvider());
|
||||
|
||||
// Need to add the View model Locator to the application resource dictionary programmatically
|
||||
// because at the extension level we don't have 'XAML' access to it
|
||||
// try to find if the view model locator is already in the app resources dictionary
|
||||
if (Application.Current.TryFindResource("Locator") == null)
|
||||
{
|
||||
// instantiate the view model locator...
|
||||
viewModelLocator = new ViewModelLocator();
|
||||
|
||||
// ... and add it there
|
||||
Application.Current.Resources.Add("Locator", viewModelLocator);
|
||||
}
|
||||
|
||||
SimpleIoc.Default.GetInstance<DeviceExplorerViewModel>().Package = this;
|
||||
Ioc.Default.GetService<DeviceExplorerViewModel>().Package = this;
|
||||
|
||||
await MessageCentre.InitializeAsync(this, ".NET nanoFramework Extension");
|
||||
|
||||
DeployProvider.Initialize(this, viewModelLocator);
|
||||
UpdateManager.Initialize(this, viewModelLocator);
|
||||
DeployProvider.Initialize(this);
|
||||
UpdateManager.Initialize(this);
|
||||
|
||||
await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
|
||||
|
||||
// Enable debugger UI context
|
||||
UIContext.FromUIContextGuid(CorDebug.EngineGuid).IsActive = true;
|
||||
|
||||
await DeviceExplorerCommand.InitializeAsync(this, viewModelLocator);
|
||||
await DeviceExplorerCommand.InitializeAsync(this);
|
||||
VirtualDeviceService.InitVirtualDeviceAsync().FireAndForget();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,10 +16,6 @@
|
|||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300"
|
||||
x:Name="DeviceExplorer">
|
||||
<UserControl.DataContext>
|
||||
<!--It's OK to use this static resource this way because it has been added programatically in the VS package constructor.-->
|
||||
<Binding Mode="OneWay" Path="DeviceExplorer" Source="{StaticResource Locator}"/>
|
||||
</UserControl.DataContext>
|
||||
|
||||
<AdornerDecorator>
|
||||
<Grid>
|
||||
|
|
|
@ -5,12 +5,14 @@
|
|||
|
||||
namespace nanoFramework.Tools.VisualStudio.Extension
|
||||
{
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using System;
|
||||
using System.Windows.Controls;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using nanoFramework.Tools.Debugger;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel;
|
||||
using System;
|
||||
using System.Windows.Controls;
|
||||
using static nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel.DeviceExplorerViewModel.Messages;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for DeviceExplorerControl.
|
||||
|
@ -27,10 +29,12 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
{
|
||||
InitializeComponent();
|
||||
|
||||
DataContext = Ioc.Default.GetService<DeviceExplorerViewModel>();
|
||||
|
||||
Loaded += DeviceExplorerControl_Loaded;
|
||||
|
||||
deviceTreeView.SelectedItemChanged += DevicesTreeView_SelectedItemChanged;
|
||||
Messenger.Default.Register<NotificationMessage>(this, DeviceExplorerViewModel.MessagingTokens.ForceSelectionOfNanoDevice, (message) => ForceSelectionOfNanoDeviceHandlerAsync().ConfigureAwait(false));
|
||||
WeakReferenceMessenger.Default.Register<ForceSelectionOfNanoDeviceMessage>(this, (r, message) => ForceSelectionOfNanoDeviceHandlerAsync().ConfigureAwait(false));
|
||||
}
|
||||
|
||||
private void DeviceExplorerControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
|
||||
|
@ -103,11 +107,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
// need to disable the event handler otherwise it will mess the selection
|
||||
deviceTreeView.SelectedItemChanged -= DevicesTreeView_SelectedItemChanged;
|
||||
|
||||
|
||||
if (deviceItem != null)
|
||||
{
|
||||
deviceItem.IsSelected = true;
|
||||
}
|
||||
deviceItem.IsSelected = true;
|
||||
|
||||
// enabled it back
|
||||
deviceTreeView.SelectedItemChanged += DevicesTreeView_SelectedItemChanged;
|
||||
|
@ -120,7 +120,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
}
|
||||
while (tryCount-- > 0);
|
||||
|
||||
Messenger.Default.Send(new NotificationMessage(""), DeviceExplorerViewModel.MessagingTokens.SelectedNanoDeviceHasChanged);
|
||||
WeakReferenceMessenger.Default.Send(new SelectedNanoDeviceHasChangedMessage());
|
||||
|
||||
// force redrawing to show selection
|
||||
deviceTreeView.InvalidateVisual();
|
||||
|
|
|
@ -27,10 +27,6 @@
|
|||
<Converters:WirelessAP_OptionsTypeConverter x:Key="WirelessAP_OptionsTypeConverter"/>
|
||||
</vsp:DialogWindow.Resources>
|
||||
|
||||
<vsp:DialogWindow.DataContext>
|
||||
<Binding Path="DeviceExplorer" Source="{StaticResource Locator}" NotifyOnSourceUpdated="True" NotifyOnTargetUpdated="True"/>
|
||||
</vsp:DialogWindow.DataContext>
|
||||
|
||||
<Grid Margin="0,0,0,4">
|
||||
<TabControl x:Name="IPversionOptions" HorizontalAlignment="Left" Height="333" Margin="10,10,0,0" VerticalAlignment="Top" Width="372">
|
||||
<TabItem Header="IPv4">
|
||||
|
|
|
@ -5,15 +5,16 @@
|
|||
|
||||
namespace nanoFramework.Tools.VisualStudio.Extension
|
||||
{
|
||||
using Microsoft.VisualStudio.Package;
|
||||
using Microsoft.VisualStudio.PlatformUI;
|
||||
using nanoFramework.Tools.Debugger;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows.Forms;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using Microsoft.VisualStudio.Package;
|
||||
using Microsoft.VisualStudio.PlatformUI;
|
||||
using nanoFramework.Tools.Debugger;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for DeviceExplorerControl.
|
||||
|
@ -28,6 +29,9 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
public NetworkConfigurationDialog(string helpTopic) : base(helpTopic)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DataContext = Ioc.Default.GetService<DeviceExplorerViewModel>();
|
||||
|
||||
InitControls();
|
||||
}
|
||||
|
||||
|
@ -37,6 +41,9 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
public NetworkConfigurationDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DataContext = Ioc.Default.GetService<DeviceExplorerViewModel>();
|
||||
|
||||
InitControls();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
|
||||
namespace nanoFramework.Tools.VisualStudio.Extension
|
||||
{
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using Microsoft.VisualStudio.PlatformUI;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Forms;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Microsoft.VisualStudio.PlatformUI;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using static nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel.DeviceExplorerViewModel.Messages;
|
||||
using Task = System.Threading.Tasks.Task;
|
||||
|
||||
/// <summary>
|
||||
|
@ -42,7 +42,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
// init controls
|
||||
private void InitControls()
|
||||
{
|
||||
Messenger.Default.Register<NotificationMessage>(this, DeviceExplorerViewModel.MessagingTokens.VirtualDeviceOperationExecuting, (message) => this.UpdateStartStopAvailabilityAsync(message.Notification).ConfigureAwait(false));
|
||||
WeakReferenceMessenger.Default.Register<VirtualDeviceOperationExecutingMessage>(this, (r, message) => this.UpdateStartStopAvailabilityAsync(message.Value).ConfigureAwait(false));
|
||||
|
||||
// set controls according to stored preferences
|
||||
GenerateDeploymentImage.IsChecked = NanoFrameworkPackage.SettingGenerateDeploymentImage;
|
||||
|
@ -104,11 +104,11 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
CloseButton.Focus();
|
||||
}
|
||||
|
||||
private async Task UpdateStartStopAvailabilityAsync(string installCompleted)
|
||||
private async Task UpdateStartStopAvailabilityAsync(bool installCompleted)
|
||||
{
|
||||
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
|
||||
|
||||
StartStopDevice.IsEnabled = !bool.Parse(installCompleted)
|
||||
StartStopDevice.IsEnabled = !installCompleted
|
||||
&& NanoFrameworkPackage.VirtualDeviceService.NanoClrIsInstalled
|
||||
&& NanoFrameworkPackage.VirtualDeviceService.CanStartStopVirtualDevice;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
<DefineConstants>TRACE;DEBUG;DEV16</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<DeployExtension>True</DeployExtension>
|
||||
<DeployExtension>False</DeployExtension>
|
||||
<CreateVsixContainer>True</CreateVsixContainer>
|
||||
<CodeAnalysisRuleSet>
|
||||
</CodeAnalysisRuleSet>
|
||||
|
@ -102,13 +102,13 @@
|
|||
<Compile Include="AutomaticUpdates\UpdateManager.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="$(PkgnanoFramework_CoreLibrary)\nanoFramework.CoreLibrary.1.14.2.nupkg">
|
||||
<Link>Packages\nanoFramework.CoreLibrary.1.14.2.nupkg</Link>
|
||||
<Content Include="$(PkgnanoFramework_CoreLibrary)\nanoFramework.CoreLibrary.1.15.5.nupkg">
|
||||
<Link>Packages\nanoFramework.CoreLibrary.1.15.5.nupkg</Link>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<IncludeInVSIX>true</IncludeInVSIX>
|
||||
</Content>
|
||||
<Content Include="$(PkgnanoFramework_TestFramework)\nanoFramework.TestFramework.2.1.85.nupkg">
|
||||
<Link>Packages\nanoFramework.TestFramework.2.1.85.nupkg</Link>
|
||||
<Content Include="$(PkgnanoFramework_TestFramework)\nanoFramework.TestFramework.2.1.113.nupkg">
|
||||
<Link>Packages\nanoFramework.TestFramework.2.1.113.nupkg</Link>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<IncludeInVSIX>true</IncludeInVSIX>
|
||||
</Content>
|
||||
|
@ -155,7 +155,6 @@
|
|||
</Content>
|
||||
<Resource Include="Resources\DeviceCapabilities.16.16.png" />
|
||||
<Resource Include="Resources\Ping.16.16.png" />
|
||||
<None Include="FodyWeavers.xml" />
|
||||
<Resource Include="Resources\DeviceConnected.16.16.png" />
|
||||
<VSCTCompile Include="NanoFrameworkMoniker.vsct">
|
||||
<SubType>Designer</SubType>
|
||||
|
@ -480,20 +479,17 @@
|
|||
<PackageReference Include="CliWrap">
|
||||
<Version>3.5.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm">
|
||||
<Version>8.2.2</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Extended.Wpf.Toolkit">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Humanizer">
|
||||
<Version>2.14.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="ICSharpCode.Decompiler">
|
||||
<Version>7.2.1.6856</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MessagePack">
|
||||
<Version>2.3.85</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces">
|
||||
<Version>6.0.0</Version>
|
||||
<Version>2.3.112</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Build">
|
||||
<Version>16.11.0</Version>
|
||||
|
@ -512,6 +508,9 @@
|
|||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection">
|
||||
<Version>6.0.2</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Options">
|
||||
<Version>6.0.0</Version>
|
||||
</PackageReference>
|
||||
|
@ -533,41 +532,28 @@
|
|||
<PackageReference Include="Microsoft.VisualStudio.TextTemplating.VSHost.15.0">
|
||||
<Version>16.10.31321.278</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Win32.Primitives">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Win32.Registry">
|
||||
<Version>5.0.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MvvmLightLibsStd10">
|
||||
<Version>5.4.1.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="nanoFramework.CoreLibrary" GeneratePathProperty="true">
|
||||
<Version>1.14.2</Version>
|
||||
<Version>1.15.5</Version>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="nanoFramework.TestFramework" Version="2.1.85" GeneratePathProperty="true">
|
||||
<PackageReference Include="nanoFramework.TestFramework" Version="2.1.113" GeneratePathProperty="true">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="nanoFramework.Tools.Debugger.Net" Version="2.4.33" />
|
||||
<PackageReference Include="nanoFramework.Tools.MetadataProcessor.MsBuildTask" Version="3.0.36" />
|
||||
<PackageReference Include="nanoFramework.Tools.Debugger.Net">
|
||||
<Version>2.5.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="nanoFramework.Tools.MetadataProcessor.MsBuildTask" Version="3.0.56" />
|
||||
<PackageReference Include="Nerdbank.GitVersioning">
|
||||
<Version>3.5.119</Version>
|
||||
<Version>3.6.146</Version>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Newtonsoft.Json">
|
||||
<Version>13.0.1</Version>
|
||||
<Version>13.0.3</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NuGet.VisualStudio">
|
||||
<Version>5.11.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="PropertyChanged.Fody">
|
||||
<Version>2.6.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="PropertyChanging.Fody">
|
||||
<Version>1.29.3</Version>
|
||||
<Version>5.11.6</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="stdole">
|
||||
<Version>16.10.31320.204</Version>
|
||||
|
@ -575,70 +561,16 @@
|
|||
<PackageReference Include="StreamJsonRpc">
|
||||
<Version>2.8.28</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Collections">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Collections.Concurrent">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Composition">
|
||||
<Version>6.0.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Console">
|
||||
<Version>4.3.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Diagnostics.Debug">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Diagnostics.DiagnosticSource">
|
||||
<Version>6.0.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Diagnostics.Tracing">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Dynamic.Runtime">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Globalization.Calendars">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.IO.FileSystem">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Linq">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Net.Sockets">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Resources.ResourceManager">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Runtime.Extensions">
|
||||
<Version>4.3.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Runtime.WindowsRuntime.UI.Xaml">
|
||||
<Version>5.0.0-preview.5.20278.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Security.Cryptography.Algorithms">
|
||||
<Version>4.3.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Threading">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Threading.Tasks">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Xml.ReaderWriter">
|
||||
<Version>4.3.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="16.10.31321.278" ExcludeAssets="runtime">
|
||||
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="16.11.35" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers" />
|
||||
<PackageReference Include="System.Text.Encodings.Web">
|
||||
<Version>4.7.2</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<Import Project="..\vs-extension.shared\vs-extension.shared.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
@ -648,4 +580,4 @@
|
|||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.2.3.0" newVersion="1.2.3.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="5.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.VisualStudio.Validation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
|
@ -16,39 +16,23 @@
|
|||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="13.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Threading.Tasks.Dataflow" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.6.5.0" newVersion="5.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Composition.AttributedModel" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.4.3.0" newVersion="1.4.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Composition.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.4.3.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="StreamJsonRpc" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.8.0.0" newVersion="2.8.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-2.7.0.0" newVersion="2.8.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.VisualStudio.Shell.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-16.0.0.0" newVersion="16.0.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-16.0.0.0" newVersion="16.10.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.VisualStudio.Shell.15.0" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
|
@ -58,25 +42,13 @@
|
|||
<assemblyIdentity name="Microsoft.VisualStudio.ImageCatalog" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-16.0.0.0" newVersion="16.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.WindowsRuntime" publicKeyToken="b77a5c561934e089" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.1" newVersion="4.0.1.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.5.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.7.0.0" newVersion="5.0.1.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -31,7 +31,7 @@
|
|||
<Asset Type="Microsoft.VisualStudio.ItemTemplate" d:Source="Project" d:ProjectName="CSharp.ClassTemplate" d:TargetPath="|CSharp.ClassTemplate;TemplateProjectOutputGroup|" Path="ItemTemplates" d:VsixSubPath="ItemTemplates" />
|
||||
<Asset Type="Microsoft.VisualStudio.ResourceTemplate" d:Source="Project" d:ProjectName="CSharp.ResourceTemplate" d:TargetPath="|CSharp.ResourceTemplate;TemplateProjectOutputGroup|" Path="ItemTemplates" d:VsixSubPath="ItemTemplates" />
|
||||
<Asset Type="Microsoft.VisualStudio.ProjectTemplate" d:Source="Project" d:ProjectName="CSharp.TestApplication-vs2019" d:TargetPath="|CSharp.TestApplication-vs2019;TemplateProjectOutputGroup|" Path="ProjectTemplates" d:VsixSubPath="ProjectTemplates" />
|
||||
<Asset Type="nanoFramework.CoreLibrary.1.14.2.nupkg" d:Source="File" Path="Packages\nanoFramework.CoreLibrary.1.14.2.nupkg" d:VsixSubPath="Packages" />
|
||||
<Asset Type="nanoFramework.TestFramework.2.1.85.nupkg" d:Source="File" Path="Packages\nanoFramework.TestFramework.2.1.85.nupkg" d:VsixSubPath="Packages" />
|
||||
<Asset Type="nanoFramework.CoreLibrary.1.15.5.nupkg" d:Source="File" Path="Packages\nanoFramework.CoreLibrary.1.15.5.nupkg" d:VsixSubPath="Packages" />
|
||||
<Asset Type="nanoFramework.TestFramework.2.1.113.nupkg" d:Source="File" Path="Packages\nanoFramework.TestFramework.2.1.113.nupkg" d:VsixSubPath="Packages" />
|
||||
</Assets>
|
||||
</PackageManifest>
|
||||
|
|
|
@ -5,12 +5,14 @@ using System;
|
|||
using System.Collections.Concurrent;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using nanoFramework.Tools.Debugger;
|
||||
using nanoFramework.Tools.Debugger.NFDevice;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.FirmwareUpdate;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel;
|
||||
using static nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel.DeviceExplorerViewModel.Messages;
|
||||
using Task = System.Threading.Tasks.Task;
|
||||
|
||||
namespace nanoFramework.Tools.VisualStudio.Extension.AutomaticUpdates
|
||||
|
@ -20,7 +22,6 @@ namespace nanoFramework.Tools.VisualStudio.Extension.AutomaticUpdates
|
|||
private const int ExclusiveAccessTimeout = 3000;
|
||||
|
||||
private static UpdateManager s_instance;
|
||||
private ViewModelLocator ViewModelLocator;
|
||||
private readonly Package _package;
|
||||
|
||||
private readonly ConcurrentDictionary<string, object> devicesUpdatING = new ConcurrentDictionary<string, object>();
|
||||
|
@ -31,17 +32,12 @@ namespace nanoFramework.Tools.VisualStudio.Extension.AutomaticUpdates
|
|||
_package = package ?? throw new ArgumentNullException($"{package} can't be null.");
|
||||
}
|
||||
|
||||
public static void Initialize(
|
||||
AsyncPackage package,
|
||||
ViewModelLocator vmLocator)
|
||||
public static void Initialize(AsyncPackage package)
|
||||
{
|
||||
s_instance = new UpdateManager(package)
|
||||
{
|
||||
ViewModelLocator = vmLocator
|
||||
};
|
||||
s_instance = new UpdateManager(package);
|
||||
|
||||
Messenger.Default.Register<NotificationMessage>(s_instance, DeviceExplorerViewModel.MessagingTokens.LaunchFirmwareUpdateForNanoDevice, (message) => s_instance.LaunchUpdate(message.Notification));
|
||||
Messenger.Default.Register<NotificationMessage>(s_instance, DeviceExplorerViewModel.MessagingTokens.NanoDeviceHasDeparted, (message) => s_instance.ProcessNanoDeviceDeparture(message.Notification));
|
||||
WeakReferenceMessenger.Default.Register<LaunchFirmwareUpdateForNanoDeviceMessage>(s_instance, (r, message) => s_instance.LaunchUpdate(message.Value));
|
||||
WeakReferenceMessenger.Default.Register<NanoDeviceHasDepartedMessage>(s_instance, (r, message) => s_instance.ProcessNanoDeviceDeparture(message.Value));
|
||||
}
|
||||
|
||||
private void ProcessNanoDeviceDeparture(string deviceId)
|
||||
|
@ -70,7 +66,9 @@ namespace nanoFramework.Tools.VisualStudio.Extension.AutomaticUpdates
|
|||
|
||||
var deviceUniqueId = Guid.Parse(deviceId);
|
||||
|
||||
var nanoDevice = ViewModelLocator.DeviceExplorer.AvailableDevices.FirstOrDefault(d => d.DeviceUniqueId == deviceUniqueId);
|
||||
var deviceExplorer = Ioc.Default.GetService<DeviceExplorerViewModel>();
|
||||
|
||||
var nanoDevice = deviceExplorer.AvailableDevices.FirstOrDefault(d => d.DeviceUniqueId == deviceUniqueId);
|
||||
|
||||
// sanity check
|
||||
if (
|
||||
|
@ -220,7 +218,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension.AutomaticUpdates
|
|||
}
|
||||
|
||||
// check if the device is still there
|
||||
if (ViewModelLocator.DeviceExplorer.AvailableDevices.FirstOrDefault(d => d.DeviceUniqueId == deviceUniqueId) == null)
|
||||
if (deviceExplorer.AvailableDevices.FirstOrDefault(d => d.DeviceUniqueId == deviceUniqueId) == null)
|
||||
{
|
||||
#if DEBUG
|
||||
Console.WriteLine($"[Automatic Updates] {nanoDevice.TargetName} is not available anymore.");
|
||||
|
@ -268,10 +266,10 @@ namespace nanoFramework.Tools.VisualStudio.Extension.AutomaticUpdates
|
|||
}
|
||||
|
||||
// if this is the selected device...
|
||||
if (ViewModelLocator.DeviceExplorer.SelectedDevice?.DeviceUniqueId == deviceUniqueId)
|
||||
if (deviceExplorer.SelectedDevice?.DeviceUniqueId == deviceUniqueId)
|
||||
{
|
||||
// ...reset property to force that device capabilities to be retrieved on next connection
|
||||
ViewModelLocator.DeviceExplorer.LastDeviceConnectedHash = 0;
|
||||
deviceExplorer.LastDeviceConnectedHash = 0;
|
||||
}
|
||||
|
||||
if (attemptToLaunchBooter)
|
||||
|
@ -282,7 +280,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension.AutomaticUpdates
|
|||
devicesUpdatING.TryRemove(deviceId, out var dummy);
|
||||
|
||||
// check if the device is still there
|
||||
if (ViewModelLocator.DeviceExplorer.AvailableDevices.FirstOrDefault(d => d.DeviceUniqueId == Guid.Parse(deviceId)) == null)
|
||||
if (deviceExplorer.AvailableDevices.FirstOrDefault(d => d.DeviceUniqueId == Guid.Parse(deviceId)) == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<PropertyChanging />
|
||||
<PropertyChanged />
|
||||
</Weavers>
|
|
@ -1,55 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. -->
|
||||
<xs:element name="Weavers">
|
||||
<xs:complexType>
|
||||
<xs:all>
|
||||
<xs:element name="PropertyChanging" minOccurs="0" maxOccurs="1" type="xs:anyType" />
|
||||
<xs:element name="PropertyChanged" minOccurs="0" maxOccurs="1">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="InjectOnPropertyNameChanged" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if the On_PropertyName_Changed feature is enabled.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="EventInvokerNames" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to change the name of the method that fires the notify event. This is a string that accepts multiple values in a comma separated form.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="CheckForEquality" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if equality checks should be inserted. If false, equality checking will be disabled for the project.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="CheckForEqualityUsingBaseEquals" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if equality checks should use the Equals method resolved from the base class.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="UseStaticEqualsFromBase" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Used to control if equality checks should use the static Equals method resolved from the base class.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:all>
|
||||
<xs:attribute name="VerifyAssembly" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="GenerateXsd" type="xs:boolean">
|
||||
<xs:annotation>
|
||||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
|
||||
</xs:annotation>
|
||||
</xs:attribute>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
Двоичный файл не отображается.
|
@ -1,7 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ImageManifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns="http://schemas.microsoft.com/VisualStudio/ImageManifestSchema/2014">
|
||||
<ImageManifest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/VisualStudio/ImageManifestSchema/2014">
|
||||
<Symbols>
|
||||
<String Name="Resources" Value="/nanoFramework.Tools.VS2022.Extension;Component/Resources" />
|
||||
<Guid Name="NanoFrameworkCatalog" Value="{23cf437f-5e0e-4b0c-8aa4-ceec5b5f8679}" />
|
||||
|
@ -21,80 +19,80 @@
|
|||
</Symbols>
|
||||
<Images>
|
||||
<Image Guid="$(NanoFrameworkCatalog)" ID="$(DeviceConnected)">
|
||||
<Source Uri="$(Resources)/DeviceConnected.xaml"/>
|
||||
<Source Uri="$(Resources)/DeviceConnected.16.16.png" >
|
||||
<Source Uri="$(Resources)/DeviceConnected.xaml" />
|
||||
<Source Uri="$(Resources)/DeviceConnected.16.16.png">
|
||||
<Size Value="16" />
|
||||
</Source>
|
||||
</Image>
|
||||
<Image Guid="$(NanoFrameworkCatalog)" ID="$(DeviceDisconnected)">
|
||||
<Source Uri="$(Resources)/DeviceDisconnected.xaml"/>
|
||||
<Source Uri="$(Resources)/DeviceDisconnected.16.16.png" >
|
||||
<Source Uri="$(Resources)/DeviceDisconnected.xaml" />
|
||||
<Source Uri="$(Resources)/DeviceDisconnected.16.16.png">
|
||||
<Size Value="16" />
|
||||
</Source>
|
||||
</Image>
|
||||
<Image Guid="$(NanoFrameworkCatalog)" ID="$(NanoFramework)">
|
||||
<Source Uri="$(Resources)/NanoFramework.xaml"/>
|
||||
<Source Uri="$(Resources)/NanoFramework.16.16.png" >
|
||||
<Source Uri="$(Resources)/NanoFramework.xaml" />
|
||||
<Source Uri="$(Resources)/NanoFramework.16.16.png">
|
||||
<Size Value="16" />
|
||||
</Source>
|
||||
</Image>
|
||||
<Image Guid="$(NanoFrameworkCatalog)" ID="$(Ping)">
|
||||
<Source Uri="$(Resources)/Ping.xaml"/>
|
||||
<Source Uri="$(Resources)/Ping.16.16.png" >
|
||||
<Source Uri="$(Resources)/Ping.xaml" />
|
||||
<Source Uri="$(Resources)/Ping.16.16.png">
|
||||
<Size Value="16" />
|
||||
</Source>
|
||||
</Image>
|
||||
<Image Guid="$(NanoFrameworkCatalog)" ID="$(DeviceCapabilities)">
|
||||
<Source Uri="$(Resources)/DeviceCapabilities.xaml"/>
|
||||
<Source Uri="$(Resources)/DeviceCapabilities.16.16.png" >
|
||||
<Source Uri="$(Resources)/DeviceCapabilities.xaml" />
|
||||
<Source Uri="$(Resources)/DeviceCapabilities.16.16.png">
|
||||
<Size Value="16" />
|
||||
</Source>
|
||||
</Image>
|
||||
<Image Guid="$(NanoFrameworkCatalog)" ID="$(NanoFrameworkProject)">
|
||||
<Source Uri="$(Resources)/NanoFrameworkProject.xaml"/>
|
||||
<Source Uri="$(Resources)/NanoFrameworkProject.16.16.png" >
|
||||
<Source Uri="$(Resources)/NanoFrameworkProject.xaml" />
|
||||
<Source Uri="$(Resources)/NanoFrameworkProject.16.16.png">
|
||||
<Size Value="16" />
|
||||
</Source>
|
||||
</Image>
|
||||
<Image Guid="$(NanoFrameworkCatalog)" ID="$(ShowInternalErrors)">
|
||||
<Source Uri="$(Resources)/ShowInternalErrors.xaml"/>
|
||||
<Source Uri="$(Resources)/ShowInternalErrors.16.16.png" >
|
||||
<Source Uri="$(Resources)/ShowInternalErrors.xaml" />
|
||||
<Source Uri="$(Resources)/ShowInternalErrors.16.16.png">
|
||||
<Size Value="16" />
|
||||
</Source>
|
||||
</Image>
|
||||
<Image Guid="$(NanoFrameworkCatalog)" ID="$(DeviceErase)">
|
||||
<Source Uri="$(Resources)/DeviceErase.xaml"/>
|
||||
<Source Uri="$(Resources)/DeviceErase.16.16.png" >
|
||||
<Source Uri="$(Resources)/DeviceErase.xaml" />
|
||||
<Source Uri="$(Resources)/DeviceErase.16.16.png">
|
||||
<Size Value="16" />
|
||||
</Source>
|
||||
</Image>
|
||||
<Image Guid="$(NanoFrameworkCatalog)" ID="$(NetworkConfig)">
|
||||
<Source Uri="$(Resources)/NetworkConfig.xaml"/>
|
||||
<Source Uri="$(Resources)/NetworkConfig.16.16.png" >
|
||||
<Source Uri="$(Resources)/NetworkConfig.xaml" />
|
||||
<Source Uri="$(Resources)/NetworkConfig.16.16.png">
|
||||
<Size Value="16" />
|
||||
</Source>
|
||||
</Image>
|
||||
<Image Guid="$(NanoFrameworkCatalog)" ID="$(Reboot)">
|
||||
<Source Uri="$(Resources)/Reboot.xaml"/>
|
||||
<Source Uri="$(Resources)/Reboot.16.16.png" >
|
||||
<Source Uri="$(Resources)/Reboot.xaml" />
|
||||
<Source Uri="$(Resources)/Reboot.16.16.png">
|
||||
<Size Value="16" />
|
||||
</Source>
|
||||
</Image>
|
||||
<Image Guid="$(NanoFrameworkCatalog)" ID="$(DisableDeviceWatchers)">
|
||||
<Source Uri="$(Resources)/DisableDeviceWatchers.xaml"/>
|
||||
<Source Uri="$(Resources)/DisableDeviceWatchers.16.16.png" >
|
||||
<Source Uri="$(Resources)/DisableDeviceWatchers.xaml" />
|
||||
<Source Uri="$(Resources)/DisableDeviceWatchers.16.16.png">
|
||||
<Size Value="16" />
|
||||
</Source>
|
||||
</Image>
|
||||
<Image Guid="$(NanoFrameworkCatalog)" ID="$(RescanDevices)">
|
||||
<Source Uri="$(Resources)/RescanDevices.xaml"/>
|
||||
<Source Uri="$(Resources)/RescanDevices.16.16.png" >
|
||||
<Source Uri="$(Resources)/RescanDevices.xaml" />
|
||||
<Source Uri="$(Resources)/RescanDevices.16.16.png">
|
||||
<Size Value="16" />
|
||||
</Source>
|
||||
</Image>
|
||||
<Image Guid="$(NanoFrameworkCatalog)" ID="$(SettingsID)">
|
||||
<Source Uri="$(Resources)/Settings.xaml"/>
|
||||
<Source Uri="$(Resources)/Settings.16.16.png" >
|
||||
<Source Uri="$(Resources)/Settings.xaml" />
|
||||
<Source Uri="$(Resources)/Settings.16.16.png">
|
||||
<Size Value="16" />
|
||||
</Source>
|
||||
</Image>
|
||||
|
|
|
@ -3,16 +3,6 @@
|
|||
// See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using GalaSoft.MvvmLight.Ioc;
|
||||
using Microsoft;
|
||||
using Microsoft.VisualStudio.ProjectSystem.VS;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
using Microsoft.VisualStudio.TextTemplating.VSHost;
|
||||
using Microsoft.VisualStudio.Threading;
|
||||
using nanoFramework.Tools.VisualStudio.Extension;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.AutomaticUpdates;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
|
@ -21,7 +11,17 @@ using System.Reflection;
|
|||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using Microsoft;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.VisualStudio.ProjectSystem.VS;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
using Microsoft.VisualStudio.TextTemplating.VSHost;
|
||||
using Microsoft.VisualStudio.Threading;
|
||||
using nanoFramework.Tools.VisualStudio.Extension;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.AutomaticUpdates;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel;
|
||||
using Task = System.Threading.Tasks.Task;
|
||||
|
||||
[assembly: ProjectTypeRegistration(projectTypeGuid: NanoFrameworkPackage.ProjectTypeGuid,
|
||||
|
@ -60,8 +60,6 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
[ProvideMenuResource("Menus.ctmenu", 1)]
|
||||
// declaration of Device Explorer ToolWindow that (as default) will show tabbed in Solution Explorer Windows (GUID below)
|
||||
[ProvideToolWindow(typeof(DeviceExplorer), Style = VsDockStyle.Tabbed, Window = "3ae79031-e1bc-11d0-8f78-00a0c9110057")]
|
||||
// register nanoDevice communication service
|
||||
[ProvideService((typeof(NanoDeviceCommService)), IsAsyncQueryable = true)]
|
||||
[Guid(PackageGuidString)]
|
||||
[ProvideObject(typeof(CorDebug))]
|
||||
[ProvideDebugEngine("Managed", typeof(CorDebug), CorDebug.EngineId, setNextStatement: true, hitCountBp: true)]
|
||||
|
@ -98,7 +96,6 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
/// </summary>
|
||||
public static Version NanoFrameworkExtensionVersion { get; private set; }
|
||||
|
||||
|
||||
#region user options related stuff
|
||||
|
||||
private const string EXTENSION_SUBKEY = "nanoFrameworkExtension";
|
||||
|
@ -580,37 +577,33 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
/// <returns>A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method.</returns>
|
||||
protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
|
||||
{
|
||||
await base.InitializeAsync(cancellationToken, progress);
|
||||
|
||||
// make sure "our" key exists and it's writable
|
||||
s_instance.UserRegistryRoot.CreateSubKey(EXTENSION_SUBKEY, true);
|
||||
|
||||
|
||||
// Configure IoC container
|
||||
Ioc.Default.ConfigureServices(
|
||||
new ServiceCollection()
|
||||
.AddSingleton<DeviceExplorerViewModel>()
|
||||
.BuildServiceProvider());
|
||||
|
||||
AddService(typeof(NanoDeviceCommService), CreateNanoDeviceCommServiceAsync);
|
||||
AddService(typeof(VirtualDeviceService), CreateVirtualDeviceManagerServiceAsync);
|
||||
|
||||
ViewModelLocator viewModelLocator = null;
|
||||
|
||||
// Need to add the View model Locator to the application resource dictionary programmatically
|
||||
// because at the extension level we don't have 'XAML' access to it
|
||||
// try to find if the view model locator is already in the app resources dictionary
|
||||
if (Application.Current.TryFindResource("Locator") == null)
|
||||
{
|
||||
// instantiate the view model locator...
|
||||
viewModelLocator = new ViewModelLocator();
|
||||
|
||||
// ... and add it there
|
||||
Application.Current.Resources.Add("Locator", viewModelLocator);
|
||||
}
|
||||
|
||||
SimpleIoc.Default.GetInstance<DeviceExplorerViewModel>().Package = this;
|
||||
Ioc.Default.GetService<DeviceExplorerViewModel>().Package = this;
|
||||
|
||||
await MessageCentre.InitializeAsync(this, ".NET nanoFramework Extension");
|
||||
|
||||
DeployProvider.Initialize(this, viewModelLocator);
|
||||
UpdateManager.Initialize(this, viewModelLocator);
|
||||
DeployProvider.Initialize(this);
|
||||
UpdateManager.Initialize(this);
|
||||
|
||||
await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
|
||||
|
||||
// Enable debugger UI context
|
||||
UIContext.FromUIContextGuid(CorDebug.EngineGuid).IsActive = true;
|
||||
|
||||
await DeviceExplorerCommand.InitializeAsync(this, viewModelLocator);
|
||||
await DeviceExplorerCommand.InitializeAsync(this);
|
||||
VirtualDeviceService.InitVirtualDeviceAsync().FireAndForget(); ;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,10 +16,6 @@
|
|||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300"
|
||||
x:Name="DeviceExplorer">
|
||||
<UserControl.DataContext>
|
||||
<!--It's OK to use this static resource this way because it has been added programatically in the VS package constructor.-->
|
||||
<Binding Mode="OneWay" Path="DeviceExplorer" Source="{StaticResource Locator}"/>
|
||||
</UserControl.DataContext>
|
||||
|
||||
<AdornerDecorator>
|
||||
<Grid>
|
||||
|
|
|
@ -5,21 +5,20 @@
|
|||
|
||||
namespace nanoFramework.Tools.VisualStudio.Extension
|
||||
{
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using System;
|
||||
using System.Windows.Controls;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using nanoFramework.Tools.Debugger;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel;
|
||||
using System;
|
||||
using System.Windows.Controls;
|
||||
using static nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel.DeviceExplorerViewModel.Messages;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for DeviceExplorerControl.
|
||||
/// </summary>
|
||||
public partial class DeviceExplorerControl : UserControl
|
||||
{
|
||||
// strongly-typed view models enable x:bind
|
||||
public DeviceExplorerViewModel ViewModel => DataContext as DeviceExplorerViewModel;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="DeviceExplorerControl"/> class.
|
||||
/// </summary>
|
||||
|
@ -27,10 +26,12 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
{
|
||||
InitializeComponent();
|
||||
|
||||
DataContext = Ioc.Default.GetService<DeviceExplorerViewModel>();
|
||||
|
||||
Loaded += DeviceExplorerControl_Loaded;
|
||||
|
||||
deviceTreeView.SelectedItemChanged += DevicesTreeView_SelectedItemChanged;
|
||||
Messenger.Default.Register<NotificationMessage>(this, DeviceExplorerViewModel.MessagingTokens.ForceSelectionOfNanoDevice, (message) => ForceSelectionOfNanoDeviceHandlerAsync().ConfigureAwait(false));
|
||||
WeakReferenceMessenger.Default.Register<ForceSelectionOfNanoDeviceMessage>(this, (r, message) => ForceSelectionOfNanoDeviceHandlerAsync().ConfigureAwait(false));
|
||||
}
|
||||
|
||||
private void DeviceExplorerControl_Loaded(object sender, System.Windows.RoutedEventArgs e)
|
||||
|
@ -56,7 +57,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
|
||||
private void DevicesTreeView_SelectedItemChanged(object sender, System.Windows.RoutedPropertyChangedEventArgs<object> e)
|
||||
{
|
||||
// if user has selected the 'devices' TreeViewItem (collapsing the tree view...)
|
||||
// if user has selected the 'devices' TreeViewItem(collapsing the tree view...)
|
||||
if (e.NewValue.GetType().Equals(typeof(TreeViewItem)))
|
||||
{
|
||||
// clear selected device
|
||||
|
@ -103,10 +104,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
// need to disable the event handler otherwise it will mess the selection
|
||||
deviceTreeView.SelectedItemChanged -= DevicesTreeView_SelectedItemChanged;
|
||||
|
||||
if (deviceItem != null)
|
||||
{
|
||||
deviceItem.IsSelected = true;
|
||||
}
|
||||
deviceItem.IsSelected = true;
|
||||
|
||||
// enabled it back
|
||||
deviceTreeView.SelectedItemChanged += DevicesTreeView_SelectedItemChanged;
|
||||
|
@ -119,7 +117,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
}
|
||||
while (tryCount-- > 0);
|
||||
|
||||
Messenger.Default.Send(new NotificationMessage(""), DeviceExplorerViewModel.MessagingTokens.SelectedNanoDeviceHasChanged);
|
||||
WeakReferenceMessenger.Default.Send(new SelectedNanoDeviceHasChangedMessage());
|
||||
|
||||
// force redrawing to show selection
|
||||
deviceTreeView.InvalidateVisual();
|
||||
|
|
|
@ -27,10 +27,6 @@
|
|||
<Converters:WirelessAP_OptionsTypeConverter x:Key="WirelessAP_OptionsTypeConverter"/>
|
||||
</vsp:DialogWindow.Resources>
|
||||
|
||||
<vsp:DialogWindow.DataContext>
|
||||
<Binding Path="DeviceExplorer" Source="{StaticResource Locator}" NotifyOnSourceUpdated="True" NotifyOnTargetUpdated="True"/>
|
||||
</vsp:DialogWindow.DataContext>
|
||||
|
||||
<Grid Margin="0,0,0,4">
|
||||
<TabControl x:Name="IPversionOptions" HorizontalAlignment="Left" Height="333" Margin="10,10,0,0" VerticalAlignment="Top" Width="372">
|
||||
<TabItem Header="IPv4">
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
|
||||
namespace nanoFramework.Tools.VisualStudio.Extension
|
||||
{
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Windows.Forms;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using Microsoft.VisualStudio.Package;
|
||||
using Microsoft.VisualStudio.PlatformUI;
|
||||
using nanoFramework.Tools.Debugger;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Windows.Forms;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for DeviceExplorerControl.
|
||||
|
@ -23,11 +23,12 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
private static readonly IPAddress EmptyIPAddress = new IPAddress(0x0);
|
||||
private static readonly IPAddress DefaultMaskIPv4 = new IPAddress(new byte[] { 255, 255, 255, 0 });
|
||||
|
||||
private DeviceExplorerViewModel DeviceExplorerViewModel => DataContext as DeviceExplorerViewModel;
|
||||
|
||||
public NetworkConfigurationDialog(string helpTopic) : base(helpTopic)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DataContext = Ioc.Default.GetService<DeviceExplorerViewModel>();
|
||||
|
||||
InitControls();
|
||||
}
|
||||
|
||||
|
@ -37,13 +38,16 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
public NetworkConfigurationDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
DataContext = Ioc.Default.GetService<DeviceExplorerViewModel>();
|
||||
|
||||
InitControls();
|
||||
}
|
||||
|
||||
// init controls
|
||||
private void InitControls()
|
||||
{
|
||||
var networkConfiguration = DeviceExplorerViewModel.DeviceNetworkConfiguration;
|
||||
//var networkConfiguration = DeviceExplorerViewModel.DeviceNetworkConfiguration;
|
||||
|
||||
// developer note
|
||||
// because our IPMaskedTextBox is missing the required properties and events to support
|
||||
|
@ -52,58 +56,58 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
// network config
|
||||
// set IPv4 addresses
|
||||
// DHCP ?
|
||||
if ((networkConfiguration.StartupAddressMode == AddressMode.DHCP) ||
|
||||
(networkConfiguration.StartupAddressMode == AddressMode.Invalid))
|
||||
{
|
||||
IPv4Automatic.IsChecked = true;
|
||||
//if ((networkConfiguration.StartupAddressMode == AddressMode.DHCP) ||
|
||||
// (networkConfiguration.StartupAddressMode == AddressMode.Invalid))
|
||||
//{
|
||||
// IPv4Automatic.IsChecked = true;
|
||||
|
||||
IPv4Address.SetAddress(EmptyIPAddress);
|
||||
IPv4NetMask.SetAddress(DefaultMaskIPv4);
|
||||
IPv4GatewayAddress.SetAddress(EmptyIPAddress);
|
||||
}
|
||||
else
|
||||
{
|
||||
IPv4Manual.IsChecked = true;
|
||||
// IPv4Address.SetAddress(EmptyIPAddress);
|
||||
// IPv4NetMask.SetAddress(DefaultMaskIPv4);
|
||||
// IPv4GatewayAddress.SetAddress(EmptyIPAddress);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// IPv4Manual.IsChecked = true;
|
||||
|
||||
IPv4Address.SetAddress(networkConfiguration.IPv4Address ?? EmptyIPAddress);
|
||||
IPv4NetMask.SetAddress(networkConfiguration.IPv4NetMask ?? DefaultMaskIPv4);
|
||||
IPv4GatewayAddress.SetAddress(networkConfiguration.IPv4GatewayAddress ?? EmptyIPAddress);
|
||||
}
|
||||
// IPv4Address.SetAddress(networkConfiguration.IPv4Address ?? EmptyIPAddress);
|
||||
// IPv4NetMask.SetAddress(networkConfiguration.IPv4NetMask ?? DefaultMaskIPv4);
|
||||
// IPv4GatewayAddress.SetAddress(networkConfiguration.IPv4GatewayAddress ?? EmptyIPAddress);
|
||||
//}
|
||||
|
||||
// DNS is automatic?
|
||||
if (networkConfiguration.AutomaticDNS || networkConfiguration.IsUnknown)
|
||||
{
|
||||
IPv4DnsAutomatic.IsChecked = true;
|
||||
//// DNS is automatic?
|
||||
//if (networkConfiguration.AutomaticDNS || networkConfiguration.IsUnknown)
|
||||
//{
|
||||
// IPv4DnsAutomatic.IsChecked = true;
|
||||
|
||||
IPv4Dns1Address.SetAddress(EmptyIPAddress);
|
||||
IPv4Dns2Address.SetAddress(EmptyIPAddress);
|
||||
}
|
||||
else
|
||||
{
|
||||
IPv4DnsManual.IsChecked = true;
|
||||
// IPv4Dns1Address.SetAddress(EmptyIPAddress);
|
||||
// IPv4Dns2Address.SetAddress(EmptyIPAddress);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// IPv4DnsManual.IsChecked = true;
|
||||
|
||||
IPv4Dns1Address.SetAddress(networkConfiguration.IPv4DNSAddress1 ?? EmptyIPAddress);
|
||||
IPv4Dns2Address.SetAddress(networkConfiguration.IPv4DNSAddress2 ?? EmptyIPAddress);
|
||||
}
|
||||
// IPv4Dns1Address.SetAddress(networkConfiguration.IPv4DNSAddress1 ?? EmptyIPAddress);
|
||||
// IPv4Dns2Address.SetAddress(networkConfiguration.IPv4DNSAddress2 ?? EmptyIPAddress);
|
||||
//}
|
||||
|
||||
// wireless configuration/properties
|
||||
// get view model property
|
||||
var wifiProfile = DeviceExplorerViewModel.DeviceWireless80211Configuration;
|
||||
//// wireless configuration/properties
|
||||
//// get view model property
|
||||
//var wifiProfile = DeviceExplorerViewModel.DeviceWireless80211Configuration;
|
||||
|
||||
// set pass field if it's available from the model
|
||||
WiFiPassword.Password = wifiProfile?.Password;
|
||||
//// set pass field if it's available from the model
|
||||
//WiFiPassword.Password = wifiProfile?.Password;
|
||||
|
||||
// if there is no valid network interface in the device: enable control for interface type selection
|
||||
if (DeviceExplorerViewModel.DeviceNetworkConfiguration.IsUnknown)
|
||||
{
|
||||
InterfaceType.IsEnabled = true;
|
||||
}
|
||||
//// if there is no valid network interface in the device: enable control for interface type selection
|
||||
//if (DeviceExplorerViewModel.DeviceNetworkConfiguration.IsUnknown)
|
||||
//{
|
||||
// InterfaceType.IsEnabled = true;
|
||||
//}
|
||||
|
||||
// clear CA root certificate
|
||||
DeviceExplorerViewModel.CaCertificateBundle = null;
|
||||
//// clear CA root certificate
|
||||
//DeviceExplorerViewModel.CaCertificateBundle = null;
|
||||
|
||||
// clear device certificate
|
||||
DeviceExplorerViewModel.DeviceCertificate = null;
|
||||
//// clear device certificate
|
||||
//DeviceExplorerViewModel.DeviceCertificate = null;
|
||||
|
||||
// set focus on cancel button
|
||||
CancelButton.Focus();
|
||||
|
@ -117,146 +121,146 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
private void SaveButton_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
// setup device network configuration block to save
|
||||
var networkConfigurationToSave = DeviceExplorerViewModel.DeviceNetworkConfiguration;
|
||||
//var networkConfigurationToSave = DeviceExplorerViewModel.DeviceNetworkConfiguration;
|
||||
|
||||
// IPv4 address options
|
||||
if (IPv4Automatic.IsChecked.GetValueOrDefault())
|
||||
{
|
||||
// IPv4 from DHCP
|
||||
networkConfigurationToSave.StartupAddressMode = AddressMode.DHCP;
|
||||
//// IPv4 address options
|
||||
//if (IPv4Automatic.IsChecked.GetValueOrDefault())
|
||||
//{
|
||||
// // IPv4 from DHCP
|
||||
// networkConfigurationToSave.StartupAddressMode = AddressMode.DHCP;
|
||||
|
||||
// clear remaining options
|
||||
networkConfigurationToSave.IPv4Address = EmptyIPAddress;
|
||||
networkConfigurationToSave.IPv4NetMask = DefaultMaskIPv4;
|
||||
networkConfigurationToSave.IPv4GatewayAddress = EmptyIPAddress;
|
||||
}
|
||||
else
|
||||
{
|
||||
// IPv4 has static configuration
|
||||
networkConfigurationToSave.StartupAddressMode = AddressMode.Static;
|
||||
// // clear remaining options
|
||||
// networkConfigurationToSave.IPv4Address = EmptyIPAddress;
|
||||
// networkConfigurationToSave.IPv4NetMask = DefaultMaskIPv4;
|
||||
// networkConfigurationToSave.IPv4GatewayAddress = EmptyIPAddress;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// // IPv4 has static configuration
|
||||
// networkConfigurationToSave.StartupAddressMode = AddressMode.Static;
|
||||
|
||||
// clear remaining options
|
||||
networkConfigurationToSave.IPv4Address = IPv4Address.GetAddress();
|
||||
networkConfigurationToSave.IPv4NetMask = IPv4NetMask.GetAddress();
|
||||
networkConfigurationToSave.IPv4GatewayAddress = IPv4GatewayAddress.GetAddress();
|
||||
}
|
||||
// // clear remaining options
|
||||
// networkConfigurationToSave.IPv4Address = IPv4Address.GetAddress();
|
||||
// networkConfigurationToSave.IPv4NetMask = IPv4NetMask.GetAddress();
|
||||
// networkConfigurationToSave.IPv4GatewayAddress = IPv4GatewayAddress.GetAddress();
|
||||
//}
|
||||
|
||||
// IPv4 DNS options
|
||||
if (IPv4DnsAutomatic.IsChecked.GetValueOrDefault())
|
||||
{
|
||||
// IPv4 DNS is automatic and provided by DHCP server
|
||||
networkConfigurationToSave.AutomaticDNS = true;
|
||||
//// IPv4 DNS options
|
||||
//if (IPv4DnsAutomatic.IsChecked.GetValueOrDefault())
|
||||
//{
|
||||
// // IPv4 DNS is automatic and provided by DHCP server
|
||||
// networkConfigurationToSave.AutomaticDNS = true;
|
||||
|
||||
// clear DNS addresses
|
||||
networkConfigurationToSave.IPv4DNSAddress1 = EmptyIPAddress;
|
||||
networkConfigurationToSave.IPv4DNSAddress2 = EmptyIPAddress;
|
||||
}
|
||||
else
|
||||
{
|
||||
// IPv4 DNS is static
|
||||
networkConfigurationToSave.AutomaticDNS = false;
|
||||
// // clear DNS addresses
|
||||
// networkConfigurationToSave.IPv4DNSAddress1 = EmptyIPAddress;
|
||||
// networkConfigurationToSave.IPv4DNSAddress2 = EmptyIPAddress;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// // IPv4 DNS is static
|
||||
// networkConfigurationToSave.AutomaticDNS = false;
|
||||
|
||||
networkConfigurationToSave.IPv4DNSAddress1 = IPv4Dns1Address.GetAddress();
|
||||
networkConfigurationToSave.IPv4DNSAddress2 = IPv4Dns2Address.GetAddress();
|
||||
}
|
||||
// networkConfigurationToSave.IPv4DNSAddress1 = IPv4Dns1Address.GetAddress();
|
||||
// networkConfigurationToSave.IPv4DNSAddress2 = IPv4Dns2Address.GetAddress();
|
||||
//}
|
||||
|
||||
// IPv6 options are not being handled for now
|
||||
// FIXME
|
||||
networkConfigurationToSave.IPv6Address = EmptyIPAddress;
|
||||
networkConfigurationToSave.IPv6NetMask = EmptyIPAddress;
|
||||
networkConfigurationToSave.IPv6GatewayAddress = EmptyIPAddress;
|
||||
networkConfigurationToSave.IPv6DNSAddress1 = EmptyIPAddress;
|
||||
networkConfigurationToSave.IPv6DNSAddress2 = EmptyIPAddress;
|
||||
//// IPv6 options are not being handled for now
|
||||
//// FIXME
|
||||
//networkConfigurationToSave.IPv6Address = EmptyIPAddress;
|
||||
//networkConfigurationToSave.IPv6NetMask = EmptyIPAddress;
|
||||
//networkConfigurationToSave.IPv6GatewayAddress = EmptyIPAddress;
|
||||
//networkConfigurationToSave.IPv6DNSAddress1 = EmptyIPAddress;
|
||||
//networkConfigurationToSave.IPv6DNSAddress2 = EmptyIPAddress;
|
||||
|
||||
// process MAC address, if that can be updated
|
||||
if (DeviceExplorerViewModel.CanChangeMacAddress)
|
||||
{
|
||||
try
|
||||
{
|
||||
var newMACAddress = MACAddress.Text;
|
||||
var newMACAddressArray = newMACAddress.Split(':');
|
||||
var dummyMacAddress = newMACAddressArray.Select(a => byte.Parse(a, System.Globalization.NumberStyles.HexNumber)).ToArray();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// error parsing MAC address field
|
||||
throw new Exception("Invalid MAC address format. Check value.");
|
||||
}
|
||||
}
|
||||
//// process MAC address, if that can be updated
|
||||
//if (DeviceExplorerViewModel.CanChangeMacAddress)
|
||||
//{
|
||||
// try
|
||||
// {
|
||||
// var newMACAddress = MACAddress.Text;
|
||||
// var newMACAddressArray = newMACAddress.Split(':');
|
||||
// var dummyMacAddress = newMACAddressArray.Select(a => byte.Parse(a, System.Globalization.NumberStyles.HexNumber)).ToArray();
|
||||
// }
|
||||
// catch (Exception)
|
||||
// {
|
||||
// // error parsing MAC address field
|
||||
// throw new Exception("Invalid MAC address format. Check value.");
|
||||
// }
|
||||
//}
|
||||
|
||||
// Wi-Fi config
|
||||
DeviceExplorerViewModel.DeviceWireless80211Configuration.Password = WiFiPassword.Password;
|
||||
//// Wi-Fi config
|
||||
//DeviceExplorerViewModel.DeviceWireless80211Configuration.Password = WiFiPassword.Password;
|
||||
|
||||
MessageCentre.StartProgressMessage($"Uploading network configuration to {DeviceExplorerViewModel.SelectedDevice.Description}...");
|
||||
//MessageCentre.StartProgressMessage($"Uploading network configuration to {DeviceExplorerViewModel.SelectedDevice.Description}...");
|
||||
|
||||
// check if debugger engine exists
|
||||
if (DeviceExplorerViewModel.SelectedDevice.DebugEngine == null)
|
||||
{
|
||||
DeviceExplorerViewModel.SelectedDevice.CreateDebugEngine();
|
||||
}
|
||||
//// check if debugger engine exists
|
||||
//if (DeviceExplorerViewModel.SelectedDevice.DebugEngine == null)
|
||||
//{
|
||||
// DeviceExplorerViewModel.SelectedDevice.CreateDebugEngine();
|
||||
//}
|
||||
|
||||
// save network configuration to target
|
||||
var updateResult = DeviceExplorerViewModel.SelectedDevice.DebugEngine.UpdateDeviceConfiguration(networkConfigurationToSave, 0);
|
||||
//// save network configuration to target
|
||||
//var updateResult = DeviceExplorerViewModel.SelectedDevice.DebugEngine.UpdateDeviceConfiguration(networkConfigurationToSave, 0);
|
||||
|
||||
if (updateResult == Engine.UpdateDeviceResult.Sucess)
|
||||
{
|
||||
if (DeviceExplorerViewModel.DeviceNetworkConfiguration.InterfaceType == NetworkInterfaceType.Wireless80211)
|
||||
{
|
||||
// save Wi-Fi profile to target
|
||||
updateResult = DeviceExplorerViewModel.SelectedDevice.DebugEngine.UpdateDeviceConfiguration(DeviceExplorerViewModel.DeviceWireless80211Configuration, 0);
|
||||
}
|
||||
}
|
||||
//if (updateResult == Engine.UpdateDeviceResult.Sucess)
|
||||
//{
|
||||
// if (DeviceExplorerViewModel.DeviceNetworkConfiguration.InterfaceType == NetworkInterfaceType.Wireless80211)
|
||||
// {
|
||||
// // save Wi-Fi profile to target
|
||||
// updateResult = DeviceExplorerViewModel.SelectedDevice.DebugEngine.UpdateDeviceConfiguration(DeviceExplorerViewModel.DeviceWireless80211Configuration, 0);
|
||||
// }
|
||||
//}
|
||||
|
||||
if (updateResult != Engine.UpdateDeviceResult.Sucess)
|
||||
{
|
||||
// update failed
|
||||
MessageCentre.OutputMessage($"Error updating {DeviceExplorerViewModel.SelectedDevice.Description} network configuration. Error: {updateResult}.");
|
||||
MessageCentre.StopProgressMessage();
|
||||
//if (updateResult != Engine.UpdateDeviceResult.Sucess)
|
||||
//{
|
||||
// // update failed
|
||||
// MessageCentre.OutputMessage($"Error updating {DeviceExplorerViewModel.SelectedDevice.Description} network configuration. Error: {updateResult}.");
|
||||
// MessageCentre.StopProgressMessage();
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// update of network config successful
|
||||
MessageCentre.OutputMessage($"{DeviceExplorerViewModel.SelectedDevice.Description} network configuration updated.");
|
||||
// return;
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// // update of network config successful
|
||||
// MessageCentre.OutputMessage($"{DeviceExplorerViewModel.SelectedDevice.Description} network configuration updated.");
|
||||
|
||||
// is there a CA certificate bundle to upload?
|
||||
if (DeviceExplorerViewModel.CaCertificateBundle != null)
|
||||
{
|
||||
MessageCentre.StartProgressMessage($"Uploading Root CA file to {(DataContext as DeviceExplorerViewModel).SelectedDevice.Description}...");
|
||||
// // is there a CA certificate bundle to upload?
|
||||
// if (DeviceExplorerViewModel.CaCertificateBundle != null)
|
||||
// {
|
||||
// MessageCentre.StartProgressMessage($"Uploading Root CA file to {(DataContext as DeviceExplorerViewModel).SelectedDevice.Description}...");
|
||||
|
||||
// save Root CA file to target
|
||||
// at position 0
|
||||
updateResult = DeviceExplorerViewModel.SelectedDevice.DebugEngine.UpdateDeviceConfiguration(DeviceExplorerViewModel.CaCertificateBundle, 0);
|
||||
// // save Root CA file to target
|
||||
// // at position 0
|
||||
// updateResult = DeviceExplorerViewModel.SelectedDevice.DebugEngine.UpdateDeviceConfiguration(DeviceExplorerViewModel.CaCertificateBundle, 0);
|
||||
|
||||
if (updateResult != Engine.UpdateDeviceResult.Sucess)
|
||||
{
|
||||
MessageCentre.OutputMessage($"Error uploading Root CA file to {(DataContext as DeviceExplorerViewModel).SelectedDevice.Description}. Error: {updateResult}");
|
||||
MessageCentre.StopProgressMessage();
|
||||
// if (updateResult != Engine.UpdateDeviceResult.Sucess)
|
||||
// {
|
||||
// MessageCentre.OutputMessage($"Error uploading Root CA file to {(DataContext as DeviceExplorerViewModel).SelectedDevice.Description}. Error: {updateResult}");
|
||||
// MessageCentre.StopProgressMessage();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
// is there a device certificate to upload?
|
||||
if (DeviceExplorerViewModel.DeviceCertificate != null)
|
||||
{
|
||||
MessageCentre.StartProgressMessage($"Uploading device certificate file to {(DataContext as DeviceExplorerViewModel).SelectedDevice.Description}...");
|
||||
// // is there a device certificate to upload?
|
||||
// if (DeviceExplorerViewModel.DeviceCertificate != null)
|
||||
// {
|
||||
// MessageCentre.StartProgressMessage($"Uploading device certificate file to {(DataContext as DeviceExplorerViewModel).SelectedDevice.Description}...");
|
||||
|
||||
// save device certificate file to target
|
||||
// at position 0
|
||||
// // save device certificate file to target
|
||||
// // at position 0
|
||||
|
||||
updateResult = DeviceExplorerViewModel.SelectedDevice.DebugEngine.UpdateDeviceConfiguration(DeviceExplorerViewModel.DeviceCertificate, 0);
|
||||
// updateResult = DeviceExplorerViewModel.SelectedDevice.DebugEngine.UpdateDeviceConfiguration(DeviceExplorerViewModel.DeviceCertificate, 0);
|
||||
|
||||
if (updateResult != Engine.UpdateDeviceResult.Sucess)
|
||||
{
|
||||
MessageCentre.OutputMessage($"Error uploading device certificate file to {(DataContext as DeviceExplorerViewModel).SelectedDevice.Description}. Error: {updateResult}");
|
||||
MessageCentre.StopProgressMessage();
|
||||
// if (updateResult != Engine.UpdateDeviceResult.Sucess)
|
||||
// {
|
||||
// MessageCentre.OutputMessage($"Error uploading device certificate file to {(DataContext as DeviceExplorerViewModel).SelectedDevice.Description}. Error: {updateResult}");
|
||||
// MessageCentre.StopProgressMessage();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
// stop progress message
|
||||
MessageCentre.StopProgressMessage();
|
||||
|
@ -296,7 +300,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
}
|
||||
|
||||
// store CA certificate
|
||||
DeviceExplorerViewModel.CaCertificateBundle = rootCaFile;
|
||||
//DeviceExplorerViewModel.CaCertificateBundle = rootCaFile;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -313,12 +317,12 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
|
||||
private void ClearRootCA_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
// store empty CA certificate
|
||||
DeviceExplorerViewModel.CaCertificateBundle = new DeviceConfiguration.X509CaRootBundleProperties()
|
||||
{
|
||||
Certificate = new byte[0],
|
||||
CertificateSize = 0
|
||||
};
|
||||
//// store empty CA certificate
|
||||
//DeviceExplorerViewModel.CaCertificateBundle = new DeviceConfiguration.X509CaRootBundleProperties()
|
||||
//{
|
||||
// Certificate = new byte[0],
|
||||
// CertificateSize = 0
|
||||
//};
|
||||
}
|
||||
|
||||
private void ShowDeviceCertificatePicker_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||
|
@ -370,7 +374,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
}
|
||||
|
||||
// store device certificate
|
||||
DeviceExplorerViewModel.DeviceCertificate = deviceCertificateFile;
|
||||
//DeviceExplorerViewModel.DeviceCertificate = deviceCertificateFile;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -387,12 +391,12 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
|
||||
private void ClearDeviceCertificate_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
// store empty device certificate
|
||||
DeviceExplorerViewModel.DeviceCertificate = new DeviceConfiguration.X509DeviceCertificatesProperties()
|
||||
{
|
||||
Certificate = new byte[0],
|
||||
CertificateSize = 0
|
||||
};
|
||||
//// store empty device certificate
|
||||
//DeviceExplorerViewModel.DeviceCertificate = new DeviceConfiguration.X509DeviceCertificatesProperties()
|
||||
//{
|
||||
// Certificate = new byte[0],
|
||||
// CertificateSize = 0
|
||||
//};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,15 +5,13 @@
|
|||
|
||||
namespace nanoFramework.Tools.VisualStudio.Extension
|
||||
{
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using Microsoft.VisualStudio.PlatformUI;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Forms;
|
||||
using Microsoft.VisualStudio.PlatformUI;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
|
||||
/// <summary>
|
||||
/// Interaction logic for DeviceExplorerControl.
|
||||
|
@ -42,7 +40,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
// init controls
|
||||
private void InitControls()
|
||||
{
|
||||
Messenger.Default.Register<NotificationMessage>(this, DeviceExplorerViewModel.MessagingTokens.VirtualDeviceOperationExecuting, (message) => this.UpdateStartStopAvailabilityAsync(message.Notification).ConfigureAwait(false));
|
||||
//WeakReferenceMessenger.Default.Register<NotificationMessage>(this, DeviceExplorerViewModel.MessagingTokens.VirtualDeviceOperationExecuting, (message) => this.UpdateStartStopAvailabilityAsync(message.Notification).ConfigureAwait(false));
|
||||
|
||||
// set controls according to stored preferences
|
||||
GenerateDeploymentImage.IsChecked = NanoFrameworkPackage.SettingGenerateDeploymentImage;
|
||||
|
|
|
@ -4,6 +4,12 @@
|
|||
<MinimumVisualStudioVersion>17.0</MinimumVisualStudioVersion>
|
||||
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>false</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
|
@ -22,7 +28,7 @@
|
|||
<CreateVsixContainer>True</CreateVsixContainer>
|
||||
<IncludeAssemblyInVSIXContainer>true</IncludeAssemblyInVSIXContainer>
|
||||
<IncludeDebugSymbolsInVSIXContainer>false</IncludeDebugSymbolsInVSIXContainer>
|
||||
<IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
|
||||
<IncludeDebugSymbolsInLocalVSIXDeployment>true</IncludeDebugSymbolsInLocalVSIXDeployment>
|
||||
<CopyBuildOutputToOutputDirectory>true</CopyBuildOutputToOutputDirectory>
|
||||
<CopyOutputSymbolsToOutputDirectory>true</CopyOutputSymbolsToOutputDirectory>
|
||||
<StartAction>Program</StartAction>
|
||||
|
@ -114,13 +120,13 @@
|
|||
<Compile Include="AutomaticUpdates\UpdateManager.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="$(PkgnanoFramework_CoreLibrary)\nanoFramework.CoreLibrary.1.14.2.nupkg">
|
||||
<Link>Packages\nanoFramework.CoreLibrary.1.14.2.nupkg</Link>
|
||||
<Content Include="$(PkgnanoFramework_CoreLibrary)\nanoFramework.CoreLibrary.1.15.5.nupkg">
|
||||
<Link>Packages\nanoFramework.CoreLibrary.1.15.5.nupkg</Link>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<IncludeInVSIX>true</IncludeInVSIX>
|
||||
</Content>
|
||||
<Content Include="$(PkgnanoFramework_TestFramework)\nanoFramework.TestFramework.2.1.85.nupkg">
|
||||
<Link>Packages\nanoFramework.TestFramework.2.1.85.nupkg</Link>
|
||||
<Content Include="$(PkgnanoFramework_TestFramework)\nanoFramework.TestFramework.2.1.113.nupkg">
|
||||
<Link>Packages\nanoFramework.TestFramework.2.1.113.nupkg</Link>
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
<IncludeInVSIX>true</IncludeInVSIX>
|
||||
</Content>
|
||||
|
@ -137,6 +143,7 @@
|
|||
<IncludeInVSIX>true</IncludeInVSIX>
|
||||
</Content>
|
||||
<Resource Include="Resources\Reboot.16.16.png" />
|
||||
<None Include="Key.snk" />
|
||||
<None Include="packages.lock.json" />
|
||||
<None Include="source.extension.vsixmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
|
@ -167,7 +174,6 @@
|
|||
</Content>
|
||||
<Resource Include="Resources\DeviceCapabilities.16.16.png" />
|
||||
<Resource Include="Resources\Ping.16.16.png" />
|
||||
<None Include="FodyWeavers.xml" />
|
||||
<Resource Include="Resources\DeviceConnected.16.16.png" />
|
||||
<VSCTCompile Include="NanoFrameworkMoniker.vsct">
|
||||
<SubType>Designer</SubType>
|
||||
|
@ -488,174 +494,100 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CliWrap">
|
||||
<Version>3.5.0</Version>
|
||||
<Version>3.6.7</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="CommunityToolkit.Mvvm">
|
||||
<Version>8.3.2</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="EnvDTE80">
|
||||
<Version>17.5.33428.366</Version>
|
||||
<Version>17.12.40391</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Extended.Wpf.Toolkit">
|
||||
<Version>4.5.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Humanizer">
|
||||
<Version>2.14.1</Version>
|
||||
<Version>4.6.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="ICSharpCode.Decompiler">
|
||||
<Version>7.2.1.6856</Version>
|
||||
<Version>8.2.0.7535</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MessagePack">
|
||||
<Version>2.5.108</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces">
|
||||
<Version>6.0.0</Version>
|
||||
<Version>2.5.192</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Build">
|
||||
<Version>17.5.0</Version>
|
||||
<Version>17.12.6</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Build.Framework">
|
||||
<Version>17.5.0</Version>
|
||||
<Version>17.12.6</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Build.Tasks.Core">
|
||||
<Version>17.5.0</Version>
|
||||
<Version>17.12.6</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Build.Utilities.Core">
|
||||
<Version>17.5.0</Version>
|
||||
<Version>17.11.4</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers">
|
||||
<Version>3.3.4</Version>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection">
|
||||
<Version>8.0.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Options">
|
||||
<Version>6.0.0</Version>
|
||||
<Version>8.0.2</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Composition">
|
||||
<Version>17.4.16</Version>
|
||||
<Version>17.12.18</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.Debugger.Engine">
|
||||
<Version>17.0.3041101</Version>
|
||||
<Version>17.8.1101801</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.ProjectSystem">
|
||||
<Version>17.2.402-pre</Version>
|
||||
<Version>17.9.380</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.ProjectSystem.Sdk">
|
||||
<Version>17.2.402-pre</Version>
|
||||
<Version>17.9.380</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VisualStudio.SDK">
|
||||
<Version>17.5.33428.388</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Win32.Primitives">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Win32.Registry">
|
||||
<Version>5.0.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="MvvmLightLibsStd10">
|
||||
<Version>5.4.1.1</Version>
|
||||
<Version>17.12.40392</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="nanoFramework.CoreLibrary" GeneratePathProperty="true">
|
||||
<Version>1.14.2</Version>
|
||||
<Version>1.15.5</Version>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="nanoFramework.TestFramework" Version="2.1.85" GeneratePathProperty="true">
|
||||
<PackageReference Include="nanoFramework.TestFramework" Version="2.1.113" GeneratePathProperty="true">
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="nanoFramework.Tools.Debugger.Net" Version="2.4.33" />
|
||||
<PackageReference Include="nanoFramework.Tools.MetadataProcessor.MsBuildTask" Version="3.0.36" />
|
||||
<PackageReference Include="nanoFramework.Tools.Debugger.Net">
|
||||
<Version>2.5.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="nanoFramework.Tools.MetadataProcessor.MsBuildTask" Version="3.0.56" />
|
||||
<PackageReference Include="Nerdbank.GitVersioning">
|
||||
<Version>3.5.119</Version>
|
||||
<Version>3.6.146</Version>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Newtonsoft.Json">
|
||||
<Version>13.0.3</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NuGet.VisualStudio">
|
||||
<Version>17.5.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="PropertyChanged.Fody">
|
||||
<Version>2.6.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="PropertyChanging.Fody">
|
||||
<Version>1.29.3</Version>
|
||||
<Version>17.12.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="stdole">
|
||||
<Version>17.5.33428.366</Version>
|
||||
<Version>17.12.40391</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="StreamJsonRpc">
|
||||
<Version>2.14.24</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Collections">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Collections.Concurrent">
|
||||
<Version>4.3.0</Version>
|
||||
<Version>2.20.17</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Composition">
|
||||
<Version>6.0.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Console">
|
||||
<Version>4.3.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Diagnostics.Debug">
|
||||
<Version>4.3.0</Version>
|
||||
<Version>9.0.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Diagnostics.DiagnosticSource">
|
||||
<Version>7.0.2</Version>
|
||||
<Version>9.0.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Diagnostics.Tracing">
|
||||
<Version>4.3.0</Version>
|
||||
<PackageReference Include="System.Text.Json">
|
||||
<Version>9.0.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Dynamic.Runtime">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Globalization.Calendars">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.IO.FileSystem">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Linq">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Net.Sockets">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Resources.ResourceManager">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe">
|
||||
<Version>6.0.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Runtime.Extensions">
|
||||
<Version>4.3.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Runtime.WindowsRuntime.UI.Xaml">
|
||||
<Version>5.0.0-preview.5.20278.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Security.Cryptography.Algorithms">
|
||||
<Version>4.3.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Threading">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Threading.Tasks">
|
||||
<Version>4.3.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Xml.ReaderWriter">
|
||||
<Version>4.3.1</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.3.2094" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers" />
|
||||
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.12.2069" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="..\vs-extension.shared\vs-extension.shared.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != '' AND Exists('$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -13,7 +13,7 @@
|
|||
<Preview>true</Preview>
|
||||
</Metadata>
|
||||
<Installation AllUsers="true">
|
||||
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.5,18.0)">
|
||||
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.12,18.0)">
|
||||
<ProductArchitecture>amd64</ProductArchitecture>
|
||||
</InstallationTarget>
|
||||
</Installation>
|
||||
|
@ -33,7 +33,7 @@
|
|||
<Asset Type="Microsoft.VisualStudio.ItemTemplate" d:Source="Project" d:ProjectName="CSharp.ClassTemplate" d:TargetPath="|CSharp.ClassTemplate;TemplateProjectOutputGroup|" Path="ItemTemplates" d:VsixSubPath="ItemTemplates" />
|
||||
<Asset Type="Microsoft.VisualStudio.ResourceTemplate" d:Source="Project" d:ProjectName="CSharp.ResourceTemplate" d:TargetPath="|CSharp.ResourceTemplate;TemplateProjectOutputGroup|" Path="ItemTemplates" d:VsixSubPath="ItemTemplates" />
|
||||
<Asset Type="Microsoft.VisualStudio.ProjectTemplate" d:Source="Project" d:ProjectName="CSharp.TestApplication-vs2022" d:TargetPath="|CSharp.TestApplication-vs2022;TemplateProjectOutputGroup|" Path="ProjectTemplates" d:VsixSubPath="ProjectTemplates" />
|
||||
<Asset Type="nanoFramework.CoreLibrary.1.14.2.nupkg" d:Source="File" Path="Packages\nanoFramework.CoreLibrary.1.14.2.nupkg" d:VsixSubPath="Packages" />
|
||||
<Asset Type="nanoFramework.TestFramework.2.1.85.nupkg" d:Source="File" Path="Packages\nanoFramework.TestFramework.2.1.85.nupkg" d:VsixSubPath="Packages" />
|
||||
<Asset Type="nanoFramework.CoreLibrary.1.15.5.nupkg" d:Source="File" Path="Packages\nanoFramework.CoreLibrary.1.15.5.nupkg" d:VsixSubPath="Packages" />
|
||||
<Asset Type="nanoFramework.TestFramework.2.1.113.nupkg" d:Source="File" Path="Packages\nanoFramework.TestFramework.2.1.113.nupkg" d:VsixSubPath="Packages" />
|
||||
</Assets>
|
||||
</PackageManifest>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
|
||||
"version": "2022.3.0",
|
||||
"version": "2022.12.0",
|
||||
"release": {
|
||||
"branchName" : "release-v{version}",
|
||||
"versionIncrement" : "minor",
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit da265d910eba64ad4d37e9c2f5085e7abd3f6242
|
||||
Subproject commit 26464389c58d2df676506286230cd87f66e8de09
|
|
@ -24,8 +24,8 @@ EndProject
|
|||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{60B109AE-E582-4ECB-ABB4-B24E07DB87E1}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
NuGet.Config = NuGet.Config
|
||||
readme.txt = readme.txt
|
||||
VisualStudio.Extension-2022\vs2022-marketplace-overview.md = VisualStudio.Extension-2022\vs2022-marketplace-overview.md
|
||||
REAME-BEFORE-UPDATE-REFS.txt = REAME-BEFORE-UPDATE-REFS.txt
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "metadata-processor", "metadata-processor", "{BF7184F8-4E9A-4264-8C30-294798B36F0D}"
|
||||
|
@ -180,8 +180,8 @@ Global
|
|||
{CE0631F2-731D-4A48-B927-F13F6B2FB055}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{CE0631F2-731D-4A48-B927-F13F6B2FB055}.Release|x86.Build.0 = Release|Any CPU
|
||||
{101D57AD-D22F-4905-A992-DE15E723F164}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{101D57AD-D22F-4905-A992-DE15E723F164}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{101D57AD-D22F-4905-A992-DE15E723F164}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{101D57AD-D22F-4905-A992-DE15E723F164}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{101D57AD-D22F-4905-A992-DE15E723F164}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{101D57AD-D22F-4905-A992-DE15E723F164}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{101D57AD-D22F-4905-A992-DE15E723F164}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
@ -294,7 +294,9 @@ Global
|
|||
EndGlobalSection
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
CSharp.TestApplication\CSharp.TestApplication.Shared.projitems*{0a06b3c4-5813-439e-85ef-6d584a4e03ed}*SharedItemsImports = 13
|
||||
nf-debugger\nanoFramework.Tools.DebugLibrary.Shared\nanoFramework.Tools.DebugLibrary.Net.projitems*{101d57ad-d22f-4905-a992-de15e723f164}*SharedItemsImports = 5
|
||||
CSharp.TestApplication\CSharp.TestApplication.Shared.projitems*{3040ba82-56cc-4189-a26c-cabb4b6b7b87}*SharedItemsImports = 4
|
||||
nf-debugger\nanoFramework.Tools.DebugLibrary.Shared\nanoFramework.Tools.DebugLibrary.Net.projitems*{31472cae-4b1a-4ab9-9b2a-8f28dbe01bcf}*SharedItemsImports = 13
|
||||
CSharp.ClassLibrary\CSharp.ClassLibrary.Shared.projitems*{4aa9a693-ff7c-4f84-b0ce-28a7ee009471}*SharedItemsImports = 4
|
||||
CSharp.BlankApplication\CSharp.BlankApplication.Shared.projitems*{572121bd-e972-4bf7-abf1-78251dde1181}*SharedItemsImports = 4
|
||||
CSharp.ClassLibrary\CSharp.ClassLibrary.Shared.projitems*{5dc66510-7529-477b-98a8-733a792ddd14}*SharedItemsImports = 4
|
||||
|
@ -303,6 +305,7 @@ Global
|
|||
vs-extension.shared\vs-extension.shared.projitems*{b16737e2-4b5d-4048-a740-2bb1df462637}*SharedItemsImports = 13
|
||||
CSharp.BlankApplication\CSharp.BlankApplication.Shared.projitems*{c5a2cf84-5591-4c33-8cf7-6c949531bfb1}*SharedItemsImports = 13
|
||||
CSharp.BlankApplication\CSharp.BlankApplication.Shared.projitems*{cd034c5a-a9eb-4c8e-b163-0ba9619cd122}*SharedItemsImports = 4
|
||||
metadata-processor\MetadataProcessor.Shared\MetadataProcessor.Shared.projitems*{e32f7d15-2499-440c-8026-4d5ee1c5ec3a}*SharedItemsImports = 4
|
||||
vs-extension.shared\vs-extension.shared.projitems*{e3e5b359-8e18-4b7d-8469-f93c6867d712}*SharedItemsImports = 4
|
||||
CSharp.ClassLibrary\CSharp.ClassLibrary.Shared.projitems*{faa194f0-5c3b-46c7-977b-d2a84444bf80}*SharedItemsImports = 13
|
||||
EndGlobalSection
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 2a53448248837f67e7550fb65c9bd3f702dcbdf9
|
||||
Subproject commit fc048feb3223580bb0c6b630d27c82f3e918c140
|
|
@ -1,5 +0,0 @@
|
|||
## Developer notes
|
||||
|
||||
!! Be very careful when upstanding NuGet packages !!
|
||||
We are pushing here the limits on the VS extensibility SDK and it's very easy to break things. In particular the most dreadful symptom that should be checked on each package update is the ability to start a debug session.
|
||||
On failure usually a CompositionException is silently thrown and the debugger refuses to start without any further clue on what is wrong.
|
|
@ -7,7 +7,7 @@ using System.ComponentModel.Composition;
|
|||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using GalaSoft.MvvmLight.Ioc;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using Microsoft.VisualStudio.ProjectSystem;
|
||||
using Microsoft.VisualStudio.ProjectSystem.Debug;
|
||||
using Microsoft.VisualStudio.ProjectSystem.VS.Debug;
|
||||
|
@ -44,12 +44,12 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
// output information about assembly running this to help debugging
|
||||
MessageCentre.InternalErrorWriteLine($"Launching debugger provider from v{_informationalVersionAttribute.InformationalVersion}");
|
||||
|
||||
if (SimpleIoc.Default.GetInstance<DeviceExplorerViewModel>().SelectedDevice != null)
|
||||
if (Ioc.Default.GetService<DeviceExplorerViewModel>().SelectedDevice != null)
|
||||
{
|
||||
var deployDeviceName = SimpleIoc.Default.GetInstance<DeviceExplorerViewModel>().SelectedDevice.Description;
|
||||
var deployDeviceName = Ioc.Default.GetService<DeviceExplorerViewModel>().SelectedDevice.Description;
|
||||
|
||||
// get device
|
||||
var device = SimpleIoc.Default.GetInstance<DeviceExplorerViewModel>().SelectedDevice;
|
||||
var device = Ioc.Default.GetService<DeviceExplorerViewModel>().SelectedDevice;
|
||||
|
||||
var exclusiveAccess = GlobalExclusiveDeviceAccess.TryGet(device, ExclusiveAccessTimeout);
|
||||
if (exclusiveAccess is null)
|
||||
|
|
|
@ -9,6 +9,7 @@ using System.Linq;
|
|||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using ICSharpCode.Decompiler;
|
||||
using ICSharpCode.Decompiler.CSharp;
|
||||
using Microsoft.VisualStudio.ProjectSystem;
|
||||
|
@ -27,8 +28,6 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
{
|
||||
private const int ExclusiveAccessTimeout = 3000;
|
||||
|
||||
private static ViewModelLocator _viewModelLocator;
|
||||
|
||||
private static Package _package;
|
||||
|
||||
private static string _informationalVersionAttributeStore;
|
||||
|
@ -72,10 +71,9 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
[Import]
|
||||
ConfiguredProject ConfiguredProject { get; set; }
|
||||
|
||||
public static void Initialize(AsyncPackage package, ViewModelLocator vmLocator)
|
||||
public static void Initialize(AsyncPackage package)
|
||||
{
|
||||
_package = package;
|
||||
_viewModelLocator = vmLocator;
|
||||
}
|
||||
|
||||
public async Task DeployAsync(CancellationToken cancellationToken, TextWriter outputPaneWriter)
|
||||
|
@ -108,8 +106,10 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
return;
|
||||
}
|
||||
|
||||
var deviceExplorer = Ioc.Default.GetService<DeviceExplorerViewModel>();
|
||||
|
||||
// just in case....
|
||||
if (_viewModelLocator?.DeviceExplorer.SelectedDevice == null)
|
||||
if (deviceExplorer.SelectedDevice == null)
|
||||
{
|
||||
// can't debug
|
||||
// throw exception to signal deployment failure
|
||||
|
@ -183,7 +183,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
MessageCentre.InternalErrorWriteLine("*** ERROR: device reporting no assemblies loaded. This can not happen. Sanity check failed ***");
|
||||
|
||||
// there are no assemblies deployed?!
|
||||
throw new DeploymentException($"Couldn't find any native assemblies deployed in {_viewModelLocator.DeviceExplorer.SelectedDevice.Description}! If the situation persists reboot the device.");
|
||||
throw new DeploymentException($"Couldn't find any native assemblies deployed in {deviceExplorer.SelectedDevice.Description}! If the situation persists reboot the device.");
|
||||
}
|
||||
|
||||
// For a known project output assembly path, this shall contain the corresponding
|
||||
|
@ -376,7 +376,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
await outputPaneWriter.WriteLineAsync("Deployment successful!");
|
||||
|
||||
// reset the hash for the connected device so the deployment information can be refreshed
|
||||
_viewModelLocator.DeviceExplorer.LastDeviceConnectedHash = 0;
|
||||
deviceExplorer.LastDeviceConnectedHash = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -384,7 +384,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
MessageCentre.InternalErrorWriteLine("*** ERROR: failing to connect to device ***");
|
||||
|
||||
// throw exception to signal deployment failure
|
||||
throw new DeploymentException($"{_viewModelLocator.DeviceExplorer.SelectedDevice.Description} is not responding. Please retry the deployment. If the situation persists reboot the device.");
|
||||
throw new DeploymentException($"{deviceExplorer.SelectedDevice.Description} is not responding. Please retry the deployment. If the situation persists reboot the device.");
|
||||
}
|
||||
}
|
||||
catch (DeploymentException)
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Tasks;
|
||||
using nanoFramework.Tools.Debugger;
|
||||
|
||||
namespace nanoFramework.Tools.VisualStudio.Extension
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
// See LICENSE file in the project root for full license information.
|
||||
////
|
||||
|
||||
using GalaSoft.MvvmLight.Ioc;
|
||||
using System.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel;
|
||||
using System.ComponentModel;
|
||||
using Commands = nanoFramework.Tools.Debugger.WireProtocol.Commands;
|
||||
|
||||
namespace nanoFramework.Tools.VisualStudio.Extension
|
||||
|
@ -26,7 +26,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
try
|
||||
{
|
||||
// update execution conditions in nano device if there is a debug session active
|
||||
var device = SimpleIoc.Default.GetInstance<DeviceExplorerViewModel>().SelectedDevice;
|
||||
var device = Ioc.Default.GetService<DeviceExplorerViewModel>().SelectedDevice;
|
||||
|
||||
if (device?.DebugEngine != null
|
||||
&& device.DebugEngine.IsRunning)
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
namespace nanoFramework.Tools.VisualStudio.Extension
|
||||
{
|
||||
using System;
|
||||
using System.ComponentModel.Design;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using System.ComponentModel.Design;
|
||||
using Microsoft.VisualStudio.Shell.Interop;
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -5,14 +5,15 @@ using System;
|
|||
using System.ComponentModel.Design;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using GalaSoft.MvvmLight.Ioc;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using CommunityToolkit.Mvvm.DependencyInjection;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using nanoFramework.Tools.Debugger;
|
||||
using nanoFramework.Tools.Debugger.Extensions;
|
||||
using nanoFramework.Tools.Debugger.NFDevice;
|
||||
using nanoFramework.Tools.Debugger.WireProtocol;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel;
|
||||
using static nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel.DeviceExplorerViewModel.Messages;
|
||||
using Task = System.Threading.Tasks.Task;
|
||||
|
||||
namespace nanoFramework.Tools.VisualStudio.Extension
|
||||
|
@ -41,7 +42,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
#error "Missing dev version constant. Maybe the platform is not correctly set? (x64 for VS2022 and AnyCPU for VS2019)."
|
||||
#endif
|
||||
|
||||
private ViewModelLocator ViewModelLocator;
|
||||
//private ViewModelLocator ViewModelLocator;
|
||||
|
||||
/// <summary>
|
||||
/// VS Package that provides this command, not null.
|
||||
|
@ -129,7 +130,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
/// Initializes the singleton instance of the command.
|
||||
/// </summary>
|
||||
/// <param name="package">Owner package, not null.</param>
|
||||
public static async Task InitializeAsync(AsyncPackage package, ViewModelLocator vmLocator)
|
||||
public static async Task InitializeAsync(AsyncPackage package)
|
||||
{
|
||||
// Switch to the main thread - the call to AddCommand in ToolWindow1Command's constructor requires
|
||||
// the UI thread.
|
||||
|
@ -139,20 +140,18 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
|
||||
Instance = new DeviceExplorerCommand(package, commandService);
|
||||
|
||||
Instance.ViewModelLocator = vmLocator;
|
||||
|
||||
var commService = await package.GetServiceAsync(typeof(NanoDeviceCommService));
|
||||
|
||||
Instance.NanoDeviceCommService = commService as INanoDeviceCommService;
|
||||
|
||||
await Instance.CreateToolbarHandlersAsync();
|
||||
|
||||
SimpleIoc.Default.GetInstance<DeviceExplorerViewModel>().NanoDeviceCommService = Instance.NanoDeviceCommService;
|
||||
Ioc.Default.GetService<DeviceExplorerViewModel>().NanoDeviceCommService = Instance.NanoDeviceCommService;
|
||||
|
||||
// setup message listeners to be notified of events occurring in the View Model
|
||||
Messenger.Default.Register<NotificationMessage>(Instance, DeviceExplorerViewModel.MessagingTokens.SelectedNanoDeviceHasChanged, (message) => Instance.SelectedNanoDeviceHasChangedHandlerAsync().ConfigureAwait(false));
|
||||
Messenger.Default.Register<NotificationMessage>(Instance, DeviceExplorerViewModel.MessagingTokens.NanoDevicesCollectionHasChanged, (message) => Instance.NanoDevicesCollectionChangedHandlerAsync().ConfigureAwait(false));
|
||||
Messenger.Default.Register<NotificationMessage>(Instance, DeviceExplorerViewModel.MessagingTokens.NanoDevicesDeviceEnumerationCompleted, (message) => Instance.NanoDevicesDeviceEnumerationCompletedHandlerAsync().ConfigureAwait(false));
|
||||
WeakReferenceMessenger.Default.Register<SelectedNanoDeviceHasChangedMessage>(Instance, static (r, message) => Instance.SelectedNanoDeviceHasChangedHandlerAsync().ConfigureAwait(false));
|
||||
WeakReferenceMessenger.Default.Register<NanoDevicesCollectionHasChangedMessage>(Instance, static (r, message) => Instance.NanoDevicesCollectionChangedHandlerAsync().ConfigureAwait(false));
|
||||
WeakReferenceMessenger.Default.Register<NanoDeviceEnumerationCompletedMessage>(Instance, static (r, message) => Instance.NanoDevicesDeviceEnumerationCompletedHandlerAsync().ConfigureAwait(false));
|
||||
}
|
||||
|
||||
private async Task CreateToolbarHandlersAsync()
|
||||
|
@ -300,7 +299,9 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
|
||||
await Task.Run(async delegate
|
||||
{
|
||||
var descriptionBackup = ViewModelLocator.DeviceExplorer.SelectedDevice.Description;
|
||||
var deviceExplorer = Ioc.Default.GetService<DeviceExplorerViewModel>();
|
||||
|
||||
var descriptionBackup = deviceExplorer.SelectedDevice.Description;
|
||||
|
||||
MessageCentre.StartProgressMessage($"Pinging {descriptionBackup}...");
|
||||
GlobalExclusiveDeviceAccess exclusiveAccess = null;
|
||||
|
@ -310,7 +311,15 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
await UpdateDeviceDependentToolbarButtonsAsync(false);
|
||||
|
||||
// make sure this device is showing as selected in Device Explorer tree view
|
||||
ViewModelLocator.DeviceExplorer.ForceNanoDeviceSelection();
|
||||
deviceExplorer.ForceNanoDeviceSelection();
|
||||
|
||||
// Get exclusive access to the device, but don't wait forever
|
||||
exclusiveAccess = GlobalExclusiveDeviceAccess.TryGet(deviceExplorer.SelectedDevice, ExclusiveAccessTimeout);
|
||||
if (exclusiveAccess is null)
|
||||
{
|
||||
MessageCentre.OutputMessage($"Cannot access {descriptionBackup}, another application is using the device.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get exclusive access to the device, but don't wait forever
|
||||
exclusiveAccess = GlobalExclusiveDeviceAccess.TryGet(ViewModelLocator.DeviceExplorer.SelectedDevice, ExclusiveAccessTimeout);
|
||||
|
@ -382,7 +391,9 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
// yield to give the UI thread a chance to respond to user input
|
||||
await Task.Yield();
|
||||
|
||||
var descriptionBackup = ViewModelLocator.DeviceExplorer.SelectedDevice.Description;
|
||||
var deviceExplorer = Ioc.Default.GetService<DeviceExplorerViewModel>();
|
||||
|
||||
var descriptionBackup = deviceExplorer.SelectedDevice.Description;
|
||||
|
||||
MessageCentre.StartProgressMessage($"Querying {descriptionBackup} capabilities...");
|
||||
|
||||
|
@ -395,13 +406,13 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
await UpdateDeviceDependentToolbarButtonsAsync(false);
|
||||
|
||||
// make sure this device is showing as selected in Device Explorer tree view
|
||||
ViewModelLocator.DeviceExplorer.ForceNanoDeviceSelection();
|
||||
deviceExplorer.ForceNanoDeviceSelection();
|
||||
|
||||
// only query device if it's different
|
||||
if (descriptionBackup.GetHashCode() != ViewModelLocator.DeviceExplorer.LastDeviceConnectedHash)
|
||||
if (descriptionBackup.GetHashCode() != deviceExplorer.LastDeviceConnectedHash)
|
||||
{
|
||||
// Get exclusive access to the device, but don't wait forever
|
||||
exclusiveAccess = GlobalExclusiveDeviceAccess.TryGet(ViewModelLocator.DeviceExplorer.SelectedDevice, ExclusiveAccessTimeout);
|
||||
exclusiveAccess = GlobalExclusiveDeviceAccess.TryGet(deviceExplorer.SelectedDevice, ExclusiveAccessTimeout);
|
||||
if (exclusiveAccess is null)
|
||||
{
|
||||
MessageCentre.OutputMessage($"Cannot access {descriptionBackup}, another application is using the device.");
|
||||
|
@ -420,9 +431,9 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
true))
|
||||
{
|
||||
// keep device description hash code to avoid get info twice
|
||||
ViewModelLocator.DeviceExplorer.LastDeviceConnectedHash = descriptionBackup.GetHashCode();
|
||||
deviceExplorer.LastDeviceConnectedHash = descriptionBackup.GetHashCode();
|
||||
// also store connection source
|
||||
ViewModelLocator.DeviceExplorer.LastDeviceConnectionSource = NanoDeviceCommService.Device.DebugEngine.ConnectionSource;
|
||||
deviceExplorer.LastDeviceConnectionSource = NanoDeviceCommService.Device.DebugEngine.ConnectionSource;
|
||||
|
||||
// check that we are in CLR
|
||||
if (NanoDeviceCommService.Device.DebugEngine.IsConnectedTonanoCLR)
|
||||
|
@ -439,17 +450,17 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
if (deviceInfo.Valid)
|
||||
{
|
||||
// load view model properties for maps
|
||||
ViewModelLocator.DeviceExplorer.DeviceMemoryMap = new StringBuilder(memoryMap?.ToStringForOutput() ?? "Empty");
|
||||
ViewModelLocator.DeviceExplorer.DeviceFlashSectorMap = new StringBuilder(flashMap?.ToStringForOutput() ?? "Empty");
|
||||
ViewModelLocator.DeviceExplorer.DeviceDeploymentMap = new StringBuilder(deploymentMap?.ToStringForOutput() ?? "Empty");
|
||||
deviceExplorer.DeviceMemoryMap = new StringBuilder(memoryMap?.ToStringForOutput() ?? "Empty");
|
||||
deviceExplorer.DeviceFlashSectorMap = new StringBuilder(flashMap?.ToStringForOutput() ?? "Empty");
|
||||
deviceExplorer.DeviceDeploymentMap = new StringBuilder(deploymentMap?.ToStringForOutput() ?? "Empty");
|
||||
|
||||
// load view model property for system
|
||||
ViewModelLocator.DeviceExplorer.DeviceSystemInfo = new StringBuilder(deviceInfo?.ToString() ?? "Empty");
|
||||
deviceExplorer.DeviceSystemInfo = new StringBuilder(deviceInfo?.ToString() ?? "Empty");
|
||||
}
|
||||
else
|
||||
{
|
||||
// reset property to force that device capabilities are retrieved on next connection
|
||||
ViewModelLocator.DeviceExplorer.LastDeviceConnectedHash = 0;
|
||||
deviceExplorer.LastDeviceConnectedHash = 0;
|
||||
|
||||
// report issue to user
|
||||
MessageCentre.OutputMessage($"Error retrieving device information from {descriptionBackup}. Please reconnect device.");
|
||||
|
@ -460,7 +471,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
catch
|
||||
{
|
||||
// reset property to force that device capabilities are retrieved on next connection
|
||||
ViewModelLocator.DeviceExplorer.LastDeviceConnectedHash = 0;
|
||||
deviceExplorer.LastDeviceConnectedHash = 0;
|
||||
|
||||
// report issue to user
|
||||
MessageCentre.OutputMessage($"Error retrieving device information from {descriptionBackup}. Please reconnect device.");
|
||||
|
@ -480,12 +491,12 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
if (deviceInfo != null)
|
||||
{
|
||||
// load view model properties for maps
|
||||
ViewModelLocator.DeviceExplorer.TargetInfo = new StringBuilder(deviceInfo.ToString() ?? "Empty");
|
||||
deviceExplorer.TargetInfo = new StringBuilder(deviceInfo.ToString() ?? "Empty");
|
||||
}
|
||||
else
|
||||
{
|
||||
// reset property to force that device capabilities are retrieved on next connection
|
||||
ViewModelLocator.DeviceExplorer.LastDeviceConnectedHash = 0;
|
||||
deviceExplorer.LastDeviceConnectedHash = 0;
|
||||
|
||||
// report issue to user
|
||||
MessageCentre.OutputMessage($"Error retrieving device information from {descriptionBackup}. Please reconnect device.");
|
||||
|
@ -496,7 +507,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
catch
|
||||
{
|
||||
// reset property to force that device capabilities are retrieved on next connection
|
||||
ViewModelLocator.DeviceExplorer.LastDeviceConnectedHash = 0;
|
||||
deviceExplorer.LastDeviceConnectedHash = 0;
|
||||
|
||||
// report issue to user
|
||||
MessageCentre.OutputMessage($"Error retrieving device information from {descriptionBackup}. Please reconnect device.");
|
||||
|
@ -508,7 +519,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
else
|
||||
{
|
||||
// reset property to force that device capabilities are retrieved on next connection
|
||||
ViewModelLocator.DeviceExplorer.LastDeviceConnectedHash = 0;
|
||||
deviceExplorer.LastDeviceConnectedHash = 0;
|
||||
|
||||
MessageCentre.OutputMessage($"{descriptionBackup} is not responding, please reboot the device.");
|
||||
|
||||
|
@ -520,36 +531,36 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
|
||||
}
|
||||
|
||||
if (ViewModelLocator.DeviceExplorer.LastDeviceConnectionSource == ConnectionSource.nanoCLR)
|
||||
if (deviceExplorer.LastDeviceConnectionSource == ConnectionSource.nanoCLR)
|
||||
{
|
||||
// CLR, output full details
|
||||
MessageCentre.OutputMessage(string.Empty);
|
||||
MessageCentre.OutputMessage(string.Empty);
|
||||
MessageCentre.OutputMessage("System Information");
|
||||
MessageCentre.OutputMessage(ViewModelLocator.DeviceExplorer.DeviceSystemInfo.ToString());
|
||||
MessageCentre.OutputMessage(deviceExplorer.DeviceSystemInfo.ToString());
|
||||
|
||||
MessageCentre.OutputMessage(string.Empty);
|
||||
MessageCentre.OutputMessage(string.Empty);
|
||||
MessageCentre.OutputMessage(ViewModelLocator.DeviceExplorer.DeviceMemoryMap.ToString());
|
||||
MessageCentre.OutputMessage(deviceExplorer.DeviceMemoryMap.ToString());
|
||||
|
||||
MessageCentre.OutputMessage(string.Empty);
|
||||
MessageCentre.OutputMessage(string.Empty);
|
||||
MessageCentre.OutputMessage(ViewModelLocator.DeviceExplorer.DeviceFlashSectorMap.ToString());
|
||||
MessageCentre.OutputMessage(deviceExplorer.DeviceFlashSectorMap.ToString());
|
||||
|
||||
MessageCentre.OutputMessage(string.Empty);
|
||||
MessageCentre.OutputMessage(string.Empty);
|
||||
MessageCentre.OutputMessage("Deployment Map");
|
||||
MessageCentre.OutputMessage(ViewModelLocator.DeviceExplorer.DeviceDeploymentMap.ToString());
|
||||
MessageCentre.OutputMessage(deviceExplorer.DeviceDeploymentMap.ToString());
|
||||
MessageCentre.OutputMessage(string.Empty);
|
||||
}
|
||||
else if (ViewModelLocator.DeviceExplorer.LastDeviceConnectionSource == ConnectionSource.nanoBooter)
|
||||
else if (deviceExplorer.LastDeviceConnectionSource == ConnectionSource.nanoBooter)
|
||||
{
|
||||
// booter, can only output minimal details
|
||||
|
||||
MessageCentre.OutputMessage(string.Empty);
|
||||
MessageCentre.OutputMessage(string.Empty);
|
||||
MessageCentre.OutputMessage("Target Information");
|
||||
MessageCentre.OutputMessage(ViewModelLocator.DeviceExplorer.TargetInfo.ToString());
|
||||
MessageCentre.OutputMessage(deviceExplorer.TargetInfo.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -589,7 +600,9 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
// yield to give the UI thread a chance to respond to user input
|
||||
await Task.Yield();
|
||||
|
||||
var descriptionBackup = ViewModelLocator.DeviceExplorer.SelectedDevice.Description;
|
||||
var deviceExplorer = Ioc.Default.GetService<DeviceExplorerViewModel>();
|
||||
|
||||
var descriptionBackup = deviceExplorer.SelectedDevice.Description;
|
||||
|
||||
var logProgressIndicator = new Progress<string>(MessageCentre.InternalErrorWriteLine);
|
||||
var progressIndicator = new Progress<MessageWithProgress>((m) => MessageCentre.StartMessageWithProgress(m));
|
||||
|
@ -605,7 +618,15 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
await UpdateDeviceDependentToolbarButtonsAsync(false);
|
||||
|
||||
// make sure this device is showing as selected in Device Explorer tree view
|
||||
ViewModelLocator.DeviceExplorer.ForceNanoDeviceSelection();
|
||||
deviceExplorer.ForceNanoDeviceSelection();
|
||||
|
||||
// Get exclusive access to the device, but don't wait forever
|
||||
exclusiveAccess = GlobalExclusiveDeviceAccess.TryGet(deviceExplorer.SelectedDevice, ExclusiveAccessTimeout);
|
||||
if (exclusiveAccess is null)
|
||||
{
|
||||
MessageCentre.OutputMessage($"Cannot access {descriptionBackup}, another application is using the device.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get exclusive access to the device, but don't wait forever
|
||||
exclusiveAccess = GlobalExclusiveDeviceAccess.TryGet(ViewModelLocator.DeviceExplorer.SelectedDevice, ExclusiveAccessTimeout);
|
||||
|
@ -634,7 +655,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
MessageCentre.OutputMessage($"{descriptionBackup} deployment area erased.");
|
||||
|
||||
// reset the hash for the connected device so the deployment information can be refreshed, if and when requested
|
||||
ViewModelLocator.DeviceExplorer.LastDeviceConnectedHash = 0;
|
||||
deviceExplorer.LastDeviceConnectedHash = 0;
|
||||
|
||||
// yield to give the UI thread a chance to respond to user input
|
||||
await Task.Yield();
|
||||
|
@ -656,7 +677,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
else
|
||||
{
|
||||
// reset property to force that device capabilities are retrieved on next connection
|
||||
ViewModelLocator.DeviceExplorer.LastDeviceConnectedHash = 0;
|
||||
deviceExplorer.LastDeviceConnectedHash = 0;
|
||||
|
||||
MessageCentre.OutputMessage($"{descriptionBackup} is not responding, please reboot the device.");
|
||||
|
||||
|
@ -696,7 +717,9 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
// yield to give the UI thread a chance to respond to user input
|
||||
await Task.Yield();
|
||||
|
||||
var descriptionBackup = ViewModelLocator.DeviceExplorer.SelectedDevice.Description;
|
||||
var deviceExplorer = Ioc.Default.GetService<DeviceExplorerViewModel>();
|
||||
|
||||
var descriptionBackup = deviceExplorer.SelectedDevice.Description;
|
||||
|
||||
await Task.Run(async delegate
|
||||
{
|
||||
|
@ -707,7 +730,18 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
await UpdateDeviceDependentToolbarButtonsAsync(false);
|
||||
|
||||
// make sure this device is showing as selected in Device Explorer tree view
|
||||
ViewModelLocator.DeviceExplorer.ForceNanoDeviceSelection();
|
||||
deviceExplorer.ForceNanoDeviceSelection();
|
||||
|
||||
// Get exclusive access to the device, but don't wait forever
|
||||
exclusiveAccess = GlobalExclusiveDeviceAccess.TryGet(deviceExplorer.SelectedDevice, ExclusiveAccessTimeout);
|
||||
if (exclusiveAccess is null)
|
||||
{
|
||||
_ = MessageBox.Show($"Cannot access {deviceExplorer.SelectedDevice.Description}, another application is using the device.",
|
||||
".NET nanoFramework Device Explorer",
|
||||
MessageBoxButton.OK,
|
||||
MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
// Get exclusive access to the device, but don't wait forever
|
||||
exclusiveAccess = GlobalExclusiveDeviceAccess.TryGet(ViewModelLocator.DeviceExplorer.SelectedDevice, ExclusiveAccessTimeout);
|
||||
|
@ -736,11 +770,11 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
|
||||
if (networkConfigurations.Count > 0)
|
||||
{
|
||||
ViewModelLocator.DeviceExplorer.DeviceNetworkConfiguration = networkConfigurations[0];
|
||||
deviceExplorer.DeviceNetworkConfiguration = networkConfigurations[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewModelLocator.DeviceExplorer.DeviceNetworkConfiguration = new DeviceConfiguration.NetworkConfigurationProperties();
|
||||
deviceExplorer.DeviceNetworkConfiguration = new DeviceConfiguration.NetworkConfigurationProperties();
|
||||
}
|
||||
|
||||
// for now, just get the 1st Wi-Fi configuration, if exists
|
||||
|
@ -748,11 +782,11 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
|
||||
if (wirellesConfigurations.Count > 0)
|
||||
{
|
||||
ViewModelLocator.DeviceExplorer.DeviceWireless80211Configuration = wirellesConfigurations[0];
|
||||
deviceExplorer.DeviceWireless80211Configuration = wirellesConfigurations[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewModelLocator.DeviceExplorer.DeviceWireless80211Configuration = new DeviceConfiguration.Wireless80211ConfigurationProperties();
|
||||
deviceExplorer.DeviceWireless80211Configuration = new DeviceConfiguration.Wireless80211ConfigurationProperties();
|
||||
}
|
||||
|
||||
// yield to give the UI thread a chance to respond to user input
|
||||
|
@ -840,8 +874,18 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
// disable buttons
|
||||
await UpdateDeviceDependentToolbarButtonsAsync(false);
|
||||
|
||||
var deviceExplorer = Ioc.Default.GetService<DeviceExplorerViewModel>();
|
||||
|
||||
// make sure this device is showing as selected in Device Explorer tree view
|
||||
ViewModelLocator.DeviceExplorer.ForceNanoDeviceSelection();
|
||||
deviceExplorer.ForceNanoDeviceSelection();
|
||||
|
||||
// Get exclusive access to the device, but don't wait forever
|
||||
exclusiveAccess = GlobalExclusiveDeviceAccess.TryGet(deviceExplorer.SelectedDevice, ExclusiveAccessTimeout);
|
||||
if (exclusiveAccess is null)
|
||||
{
|
||||
MessageCentre.OutputMessage($"Cannot access {deviceExplorer.SelectedDevice.Description}, another application is using the device.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get exclusive access to the device, but don't wait forever
|
||||
exclusiveAccess = GlobalExclusiveDeviceAccess.TryGet(ViewModelLocator.DeviceExplorer.SelectedDevice, ExclusiveAccessTimeout);
|
||||
|
@ -870,7 +914,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
try
|
||||
{
|
||||
// reset the hash for the connected device so the deployment information can be refreshed, if and when requested
|
||||
ViewModelLocator.DeviceExplorer.LastDeviceConnectedHash = 0;
|
||||
deviceExplorer.LastDeviceConnectedHash = 0;
|
||||
|
||||
// set reboot option according to the button that was clicked
|
||||
RebootOptions rebootOption = RebootOptions.NormalReboot;
|
||||
|
@ -910,7 +954,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
await Task.Yield();
|
||||
|
||||
// reset property to force that device capabilities are retrieved on next connection
|
||||
ViewModelLocator.DeviceExplorer.LastDeviceConnectedHash = 0;
|
||||
deviceExplorer.LastDeviceConnectedHash = 0;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
@ -923,7 +967,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
else
|
||||
{
|
||||
// reset property to force that device capabilities are retrieved on next connection
|
||||
ViewModelLocator.DeviceExplorer.LastDeviceConnectedHash = 0;
|
||||
deviceExplorer.LastDeviceConnectedHash = 0;
|
||||
|
||||
MessageCentre.OutputMessage($"{previousSelectedDeviceDescription} is not responding, please reboot the device.");
|
||||
|
||||
|
@ -1019,8 +1063,10 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
|
||||
NanoDeviceCommService.DebugClient.StopDeviceWatchers();
|
||||
|
||||
var deviceExplorer = Ioc.Default.GetService<DeviceExplorerViewModel>();
|
||||
|
||||
// need to remove event handler
|
||||
NanoDeviceCommService.DebugClient.NanoFrameworkDevices.CollectionChanged -= ViewModelLocator.DeviceExplorer.NanoFrameworkDevices_CollectionChanged;
|
||||
NanoDeviceCommService.DebugClient.NanoFrameworkDevices.CollectionChanged -= deviceExplorer.NanoFrameworkDevices_CollectionChanged;
|
||||
|
||||
MessageCentre.OutputMessage(Environment.NewLine);
|
||||
MessageCentre.OutputMessage("***********************************************************************************");
|
||||
|
@ -1111,9 +1157,11 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
{
|
||||
await Task.Run(async delegate
|
||||
{
|
||||
if (ViewModelLocator.DeviceExplorer.SelectedDevice != null)
|
||||
var deviceExplorer = Ioc.Default.GetService<DeviceExplorerViewModel>();
|
||||
|
||||
if (deviceExplorer.SelectedDevice != null)
|
||||
{
|
||||
NanoDeviceCommService.SelectDevice(ViewModelLocator.DeviceExplorer.SelectedDevice.Description);
|
||||
NanoDeviceCommService.SelectDevice(deviceExplorer.SelectedDevice.Description);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1162,11 +1210,13 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
// get the menu command service to reach the toolbar commands
|
||||
var menuCommandService = Instance.MenuCommandService;
|
||||
|
||||
var deviceExplorer = Ioc.Default.GetService<DeviceExplorerViewModel>();
|
||||
|
||||
// are there any devices available
|
||||
if (ViewModelLocator.DeviceExplorer.AvailableDevices.Count > 0)
|
||||
if (deviceExplorer.AvailableDevices.Count > 0)
|
||||
{
|
||||
// any device selected?
|
||||
if (ViewModelLocator.DeviceExplorer.SelectedDevice != null)
|
||||
if (deviceExplorer.SelectedDevice != null)
|
||||
{
|
||||
// there is a device selected
|
||||
// enable ping button
|
||||
|
@ -1216,16 +1266,18 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
|
||||
private void UpdateRebootMenuGroup(OleMenuCommandService menuCommandService)
|
||||
{
|
||||
if (ViewModelLocator.DeviceExplorer.SelectedDevice != null)
|
||||
var deviceExplorer = Ioc.Default.GetService<DeviceExplorerViewModel>();
|
||||
|
||||
if (deviceExplorer.SelectedDevice != null)
|
||||
{
|
||||
// enable boot to nanoBooter, if available on target
|
||||
menuCommandService.FindCommand(GenerateCommandID(RebootNanoBooterID)).Enabled = ViewModelLocator.DeviceExplorer.SelectedDevice.HasNanoBooter;
|
||||
menuCommandService.FindCommand(GenerateCommandID(RebootNanoBooterID)).Enabled = deviceExplorer.SelectedDevice.HasNanoBooter;
|
||||
|
||||
// enable boot to bootloader, if available on target
|
||||
menuCommandService.FindCommand(GenerateCommandID(RebootBootloaderID)).Enabled = ViewModelLocator.DeviceExplorer.SelectedDevice.HasProprietaryBooter;
|
||||
menuCommandService.FindCommand(GenerateCommandID(RebootBootloaderID)).Enabled = deviceExplorer.SelectedDevice.HasProprietaryBooter;
|
||||
|
||||
// enable boot CLR if we are on CLR
|
||||
menuCommandService.FindCommand(GenerateCommandID(RebootClrID)).Enabled = ViewModelLocator.DeviceExplorer.SelectedDevice.DebugEngine != null ? ViewModelLocator.DeviceExplorer.SelectedDevice.DebugEngine.IsConnectedTonanoCLR : false;
|
||||
menuCommandService.FindCommand(GenerateCommandID(RebootClrID)).Enabled = deviceExplorer.SelectedDevice.DebugEngine != null ? deviceExplorer.SelectedDevice.DebugEngine.IsConnectedTonanoCLR : false;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1251,7 +1303,9 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
// are there any devices available
|
||||
if (isEnable)
|
||||
{
|
||||
if (ViewModelLocator.DeviceExplorer.AvailableDevices.Count == 0)
|
||||
var deviceExplorer = Ioc.Default.GetService<DeviceExplorerViewModel>();
|
||||
|
||||
if (deviceExplorer.AvailableDevices.Count == 0)
|
||||
{
|
||||
// no device available!!
|
||||
// done here
|
||||
|
@ -1259,7 +1313,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
}
|
||||
|
||||
// any device selected?
|
||||
if (ViewModelLocator.DeviceExplorer.SelectedDevice == null)
|
||||
if (deviceExplorer.SelectedDevice == null)
|
||||
{
|
||||
// no device selected!!
|
||||
// done here
|
||||
|
|
|
@ -3,39 +3,26 @@
|
|||
// See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using GalaSoft.MvvmLight;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using nanoFramework.Tools.Debugger;
|
||||
using nanoFramework.Tools.Debugger.WireProtocol;
|
||||
using PropertyChanged;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using CommunityToolkit.Mvvm.Messaging.Messages;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using nanoFramework.Tools.Debugger;
|
||||
using nanoFramework.Tools.Debugger.WireProtocol;
|
||||
using static nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel.DeviceExplorerViewModel.Messages;
|
||||
using Task = System.Threading.Tasks.Task;
|
||||
|
||||
namespace nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// This class contains properties that the main View can data bind to.
|
||||
/// <para>
|
||||
/// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// You can also use Blend to data bind with the tool's support.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// See http://www.galasoft.ch/mvvm
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[AddINotifyPropertyChangedInterface]
|
||||
public class DeviceExplorerViewModel : ViewModelBase, INotifyPropertyChanging
|
||||
public class DeviceExplorerViewModel : ObservableObject
|
||||
{
|
||||
public const int WRITE_TO_OUTPUT_TOKEN = 1;
|
||||
public const int SELECTED_NULL_TOKEN = 2;
|
||||
|
@ -44,12 +31,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel
|
|||
private const int SerialDeviceReconnectMaximumAttempts = 4 * 10;
|
||||
private ConnectionSource _lastDeviceConnectionSource;
|
||||
|
||||
// keep this here otherwise Fody won't be able to properly implement INotifyPropertyChanging
|
||||
#pragma warning disable 67
|
||||
public event PropertyChangingEventHandler PropertyChanging;
|
||||
#pragma warning restore 67
|
||||
|
||||
private bool _deviceEnumerationCompleted { get; set; }
|
||||
private bool _deviceEnumerationCompleted;
|
||||
|
||||
/// <summary>
|
||||
/// Sets if Device Explorer should auto-select a device when there is only a single one in the available list.
|
||||
|
@ -64,41 +46,43 @@ namespace nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel
|
|||
/// <summary>
|
||||
/// Gets the service provider from the owner package.
|
||||
/// </summary>
|
||||
private IServiceProvider _serviceProvider
|
||||
private IServiceProvider _serviceProvider => Package;
|
||||
|
||||
private INanoDeviceCommService _nanoDeviceCommService;
|
||||
public INanoDeviceCommService NanoDeviceCommService
|
||||
{
|
||||
get
|
||||
get => _nanoDeviceCommService;
|
||||
set
|
||||
{
|
||||
return Package;
|
||||
if (SetProperty(ref _nanoDeviceCommService, value))
|
||||
{
|
||||
OnNanoDeviceCommServiceChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public INanoDeviceCommService NanoDeviceCommService { private get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MainViewModel class.
|
||||
/// </summary>
|
||||
public DeviceExplorerViewModel()
|
||||
{
|
||||
if (IsInDesignMode)
|
||||
{
|
||||
// Code runs in Blend --> create design time data.
|
||||
AvailableDevices = new ObservableCollection<NanoDeviceBase>();
|
||||
|
||||
//AvailableDevices.Add(new NanoDevice<NanoSerialDevice>() { Description = "Awesome nanodevice1" });
|
||||
//AvailableDevices.Add(new NanoDevice<NanoSerialDevice>() { Description = "Awesome nanodevice2" });
|
||||
}
|
||||
else
|
||||
{
|
||||
// Code runs "for real"
|
||||
AvailableDevices = new ObservableCollection<NanoDeviceBase>();
|
||||
}
|
||||
|
||||
AvailableDevices = new ObservableCollection<NanoDeviceBase>();
|
||||
SelectedDevice = null;
|
||||
}
|
||||
|
||||
public ObservableCollection<NanoDeviceBase> AvailableDevices { set; get; }
|
||||
private ObservableCollection<NanoDeviceBase> _availableDevices;
|
||||
public ObservableCollection<NanoDeviceBase> AvailableDevices
|
||||
{
|
||||
get => _availableDevices;
|
||||
set => SetProperty(ref _availableDevices, value);
|
||||
}
|
||||
|
||||
public NanoDeviceBase SelectedDevice { get; set; }
|
||||
private NanoDeviceBase _selectedDevice;
|
||||
public NanoDeviceBase SelectedDevice
|
||||
{
|
||||
get => _selectedDevice;
|
||||
set => SetProperty(ref _selectedDevice, value);
|
||||
}
|
||||
|
||||
public string DeviceToReSelect { get; set; } = null;
|
||||
|
||||
|
@ -107,7 +91,6 @@ namespace nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel
|
|||
if (NanoDeviceCommService != null)
|
||||
{
|
||||
NanoDeviceCommService.DebugClient.DeviceEnumerationCompleted += SerialDebugClient_DeviceEnumerationCompleted;
|
||||
|
||||
NanoDeviceCommService.DebugClient.LogMessageAvailable += DebugClient_LogMessageAvailable;
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +109,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel
|
|||
|
||||
UpdateAvailableDevices();
|
||||
|
||||
MessengerInstance.Send(new NotificationMessage(""), MessagingTokens.NanoDevicesDeviceEnumerationCompleted);
|
||||
WeakReferenceMessenger.Default.Send(new NanoDeviceEnumerationCompletedMessage());
|
||||
}
|
||||
|
||||
private void UpdateAvailableDevices()
|
||||
|
@ -170,7 +153,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel
|
|||
// launch firmware update task
|
||||
foreach (var d in AvailableDevices)
|
||||
{
|
||||
MessengerInstance.Send(new NotificationMessage(d.ConnectionId.ToString()), MessagingTokens.LaunchFirmwareUpdateForNanoDevice);
|
||||
WeakReferenceMessenger.Default.Send(new LaunchFirmwareUpdateForNanoDeviceMessage(d.ConnectionId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -193,14 +176,14 @@ namespace nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel
|
|||
break;
|
||||
}
|
||||
|
||||
MessengerInstance.Send(new NotificationMessage(""), MessagingTokens.NanoDevicesCollectionHasChanged);
|
||||
WeakReferenceMessenger.Default.Send(new NanoDevicesCollectionHasChangedMessage());
|
||||
|
||||
// launch update for arriving devices, if any
|
||||
if (e.NewItems != null)
|
||||
{
|
||||
foreach (var d in e.NewItems)
|
||||
{
|
||||
MessengerInstance.Send(new NotificationMessage((d as NanoDeviceBase).ConnectionId.ToString()), MessagingTokens.LaunchFirmwareUpdateForNanoDevice);
|
||||
WeakReferenceMessenger.Default.Send(new LaunchFirmwareUpdateForNanoDeviceMessage((d as NanoDeviceBase).ConnectionId));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -209,7 +192,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel
|
|||
{
|
||||
foreach (var d in e.OldItems)
|
||||
{
|
||||
MessengerInstance.Send(new NotificationMessage((d as NanoDeviceBase).ConnectionId.ToString()), MessagingTokens.NanoDeviceHasDeparted);
|
||||
WeakReferenceMessenger.Default.Send(new NanoDeviceHasDepartedMessage((d as NanoDeviceBase).ConnectionId));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -256,13 +239,13 @@ namespace nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel
|
|||
SelectedDevice = nanoDevice;
|
||||
|
||||
// request forced selection of device in UI
|
||||
_ = Task.Run(() => { MessengerInstance.Send(new NotificationMessage(""), MessagingTokens.ForceSelectionOfNanoDevice); });
|
||||
_ = Task.Run(() => { WeakReferenceMessenger.Default.Send(new ForceSelectionOfNanoDeviceMessage()); });
|
||||
}
|
||||
|
||||
public void ForceNanoDeviceSelection()
|
||||
{
|
||||
// request forced selection of device in UI
|
||||
_ = Task.Run(() => { MessengerInstance.Send(new NotificationMessage(""), MessagingTokens.ForceSelectionOfNanoDevice); });
|
||||
_ = Task.Run(() => { WeakReferenceMessenger.Default.Send(new ForceSelectionOfNanoDeviceMessage()); });
|
||||
}
|
||||
|
||||
public void OnSelectedDeviceChanged()
|
||||
|
@ -271,15 +254,25 @@ namespace nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel
|
|||
LastDeviceConnectedHash = 0;
|
||||
|
||||
// signal event that the selected device has changed
|
||||
MessengerInstance.Send(new NotificationMessage(""), MessagingTokens.SelectedNanoDeviceHasChanged);
|
||||
WeakReferenceMessenger.Default.Send(new SelectedNanoDeviceHasChangedMessage());
|
||||
}
|
||||
|
||||
|
||||
#region Transport
|
||||
|
||||
public List<Debugger.WireProtocol.TransportType> AvailableTransportTypes { get; set; }
|
||||
|
||||
public Debugger.WireProtocol.TransportType SelectedTransportType { get; set; }
|
||||
private Debugger.WireProtocol.TransportType _selectedTransportType;
|
||||
public Debugger.WireProtocol.TransportType SelectedTransportType
|
||||
{
|
||||
get => _selectedTransportType;
|
||||
set
|
||||
{
|
||||
if (SetProperty(ref _selectedTransportType, value))
|
||||
{
|
||||
OnSelectedTransportTypeChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OnSelectedTransportTypeChanged()
|
||||
{
|
||||
|
@ -288,7 +281,6 @@ namespace nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel
|
|||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Device Capabilities
|
||||
|
||||
public StringBuilder DeviceDeploymentMap { get; set; }
|
||||
|
@ -309,29 +301,15 @@ namespace nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel
|
|||
/// <summary>
|
||||
/// used to store connection information about a previously connect device
|
||||
/// </summary>
|
||||
public ConnectionSource LastDeviceConnectionSource
|
||||
{
|
||||
get
|
||||
{
|
||||
if (LastDeviceConnectedHash != 0)
|
||||
{
|
||||
return _lastDeviceConnectionSource;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ConnectionSource.Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
_lastDeviceConnectionSource = value;
|
||||
}
|
||||
public ConnectionSource LastDeviceConnectionSource
|
||||
{
|
||||
get => LastDeviceConnectedHash != 0 ? _lastDeviceConnectionSource : ConnectionSource.Unknown;
|
||||
set => SetProperty(ref _lastDeviceConnectionSource, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
# region Network configuration dialog
|
||||
#region Network configuration dialog
|
||||
|
||||
public DeviceConfiguration.NetworkConfigurationProperties DeviceNetworkConfiguration { get; set; }
|
||||
|
||||
|
@ -340,43 +318,52 @@ namespace nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel
|
|||
public DeviceConfiguration.X509CaRootBundleProperties CaCertificateBundle { get; set; }
|
||||
public DeviceConfiguration.X509DeviceCertificatesProperties DeviceCertificate { get; internal set; }
|
||||
|
||||
public bool CanChangeMacAddress
|
||||
{
|
||||
|
||||
get
|
||||
{
|
||||
if (SelectedDevice is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SelectedDevice.DebugEngine != null &&
|
||||
!SelectedDevice.DebugEngine.Capabilities.IsUnknown)
|
||||
{
|
||||
return SelectedDevice.DebugEngine.Capabilities.CanChangeMacAddress;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public bool CanChangeMacAddress => SelectedDevice?.DebugEngine?.Capabilities?.CanChangeMacAddress ?? false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region messaging tokens
|
||||
|
||||
public static class MessagingTokens
|
||||
public sealed class Messages
|
||||
{
|
||||
public static readonly string SelectedNanoDeviceHasChanged = new Guid("{C3173983-A19A-49DD-A4BD-F25D360F7334}").ToString();
|
||||
public static readonly string NanoDevicesCollectionHasChanged = new Guid("{3E8906F9-F68A-45B7-A0CE-6D42BDB22455}").ToString();
|
||||
public static readonly string NanoDevicesDeviceEnumerationCompleted = new Guid("{347E2874-212C-4BC8-BB38-16E91FFCAB32}").ToString();
|
||||
public static readonly string ForceSelectionOfNanoDevice = new Guid("{8F012794-BC66-429D-9F9D-A9B0F546D6B5}").ToString();
|
||||
public static readonly string LaunchFirmwareUpdateForNanoDevice = new Guid("{93822E8C-4A94-4573-AC4F-DEB7FA703933}").ToString();
|
||||
public static readonly string NanoDeviceHasDeparted = new Guid("{38429FA1-3C16-44C2-937E-227C20AC0342}").ToString();
|
||||
public static readonly string VirtualDeviceOperationExecuting = new Guid("{B1B40C6E-5EE7-4A69-BB70-9A8663C928C1}").ToString();
|
||||
public sealed class NanoDeviceEnumerationCompletedMessage
|
||||
{
|
||||
}
|
||||
|
||||
public sealed class NanoDevicesCollectionHasChangedMessage
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public sealed class ForceSelectionOfNanoDeviceMessage
|
||||
{
|
||||
}
|
||||
|
||||
public sealed class LaunchFirmwareUpdateForNanoDeviceMessage : ValueChangedMessage<string>
|
||||
{
|
||||
public LaunchFirmwareUpdateForNanoDeviceMessage(string value) : base(value)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class NanoDeviceHasDepartedMessage : ValueChangedMessage<string>
|
||||
{
|
||||
public NanoDeviceHasDepartedMessage(string value) : base(value)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class SelectedNanoDeviceHasChangedMessage
|
||||
{
|
||||
}
|
||||
|
||||
public sealed class VirtualDeviceOperationExecutingMessage : ValueChangedMessage<bool>
|
||||
{
|
||||
public VirtualDeviceOperationExecutingMessage(bool value) : base(value)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
//
|
||||
// Copyright (c) .NET Foundation and Contributors
|
||||
// See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
using GalaSoft.MvvmLight.Ioc;
|
||||
|
||||
namespace nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel
|
||||
{
|
||||
/// <summary>
|
||||
/// This class contains static references to all the view models in the
|
||||
/// application and provides an entry point for the bindings.
|
||||
/// </summary>
|
||||
public class ViewModelLocator
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the ViewModelLocator class.
|
||||
/// </summary>
|
||||
public ViewModelLocator()
|
||||
{
|
||||
////if (ViewModelBase.IsInDesignModeStatic)
|
||||
////{
|
||||
//// // Create design time view services and models
|
||||
//// SimpleIoc.Default.Register<IDataService, DesignDataService>();
|
||||
////}
|
||||
////else
|
||||
////{
|
||||
//// // Create run time view services and models
|
||||
//// SimpleIoc.Default.Register<IDataService, DataService>();
|
||||
////}
|
||||
|
||||
SimpleIoc.Default.Register<DeviceExplorerViewModel>();
|
||||
}
|
||||
|
||||
public DeviceExplorerViewModel DeviceExplorer
|
||||
{
|
||||
get
|
||||
{
|
||||
return SimpleIoc.Default.GetInstance<DeviceExplorerViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public static void Cleanup()
|
||||
{
|
||||
// TODO Clear the ViewModels
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
using CliWrap;
|
||||
using CliWrap.Buffered;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Microsoft;
|
||||
using Microsoft.VisualStudio.Shell;
|
||||
using nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel;
|
||||
|
@ -17,6 +17,7 @@ using System.Net.Http;
|
|||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using static nanoFramework.Tools.VisualStudio.Extension.ToolWindow.ViewModel.DeviceExplorerViewModel.Messages;
|
||||
using Task = System.Threading.Tasks.Task;
|
||||
|
||||
namespace nanoFramework.Tools.VisualStudio.Extension
|
||||
|
@ -103,7 +104,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
MessageCentre.InternalErrorWriteLine($"VirtualDevice: Install/update nanoclr tool");
|
||||
|
||||
// signal install/update ongoing
|
||||
Messenger.Default.Send(new NotificationMessage(true.ToString()), DeviceExplorerViewModel.MessagingTokens.VirtualDeviceOperationExecuting);
|
||||
WeakReferenceMessenger.Default.Send(new VirtualDeviceOperationExecutingMessage(true));
|
||||
|
||||
|
||||
// get installed tool version (if installed)
|
||||
|
@ -216,7 +217,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
}
|
||||
|
||||
// signal install/update completed
|
||||
Messenger.Default.Send(new NotificationMessage(false.ToString()), DeviceExplorerViewModel.MessagingTokens.VirtualDeviceOperationExecuting);
|
||||
WeakReferenceMessenger.Default.Send(new VirtualDeviceOperationExecutingMessage(false));
|
||||
}
|
||||
|
||||
public void UpdateNanoClr()
|
||||
|
@ -388,7 +389,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(CancellationToken.None);
|
||||
|
||||
// signal start operation
|
||||
Messenger.Default.Send(new NotificationMessage(true.ToString()), DeviceExplorerViewModel.MessagingTokens.VirtualDeviceOperationExecuting);
|
||||
WeakReferenceMessenger.Default.Send(new VirtualDeviceOperationExecutingMessage(true));
|
||||
|
||||
MessageCentre.InternalErrorWriteLine($"VirtualDevice: Attempting to start virtual device");
|
||||
|
||||
|
@ -563,7 +564,7 @@ namespace nanoFramework.Tools.VisualStudio.Extension
|
|||
finally
|
||||
{
|
||||
// signal start operation completed
|
||||
Messenger.Default.Send(new NotificationMessage(false.ToString()), DeviceExplorerViewModel.MessagingTokens.VirtualDeviceOperationExecuting);
|
||||
WeakReferenceMessenger.Default.Send(new VirtualDeviceOperationExecutingMessage(false));
|
||||
|
||||
// rescan devices, if start was successful and this wasn't requested to skip
|
||||
if (_nanoClrProcess != null
|
||||
|
|
|
@ -86,7 +86,6 @@
|
|||
<Compile Include="$(MSBuildThisFileDirectory)ToolWindow.DeviceExplorer\ViewModel\DesignDataService.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ToolWindow.DeviceExplorer\ViewModel\DeviceExplorerViewModel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ToolWindow.DeviceExplorer\ViewModel\IDataService.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ToolWindow.DeviceExplorer\ViewModel\ViewModelLocator.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Utilities\DeploymentImageGenerator.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Utilities\EnumToItemsSource.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Utilities\ReferenceCrawler.cs" />
|
||||
|
|
Загрузка…
Ссылка в новой задаче