diff options
| author | Mirta <mirta@twine-s.com> | 2020-11-23 16:13:53 +0200 |
|---|---|---|
| committer | Mirta <mirta@twine-s.com> | 2020-11-23 16:13:53 +0200 |
| commit | 91c007adced573e09b77ab4be4a5aba623a816cc (patch) | |
| tree | 250221fc2def7d59f1393be8394f766faf576656 /Software/Visual_Studio/PPC | |
| parent | 4e9af2b852eb3b9eecfa09e9bc76869558e183cb (diff) | |
| parent | 50a3c0b857b4aa88a9e3970d69256f12b5b24eb8 (diff) | |
| download | Tango-91c007adced573e09b77ab4be4a5aba623a816cc.tar.gz Tango-91c007adced573e09b77ab4be4a5aba623a816cc.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC')
17 files changed, 416 insertions, 47 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs index 3f6024b38..ef1126261 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -19,6 +19,8 @@ using Tango.PPC.Common; using Tango.PPC.Common.Connection; using Tango.PPC.Common.ExternalBridge; using Tango.PPC.Common.Messages; +using Tango.PPC.Common.OS; +using Tango.PPC.Common.UWF; using Tango.SharedUI.Components; using Tango.WiFi; @@ -30,8 +32,17 @@ namespace Tango.PPC.MachineSettings.ViewModels /// <seealso cref="Tango.PPC.Common.PPCViewModel" /> public class MainViewVM : PPCViewModel { + private TimeZoneInfo _previousTimeZone; + private bool _previousEnableUWF; + #region Properties + [TangoInject] + private IOperationSystemManager OperationSystemManager { get; set; } + + [TangoInject] + private IUnifiedWriteFilterManager UnifiedWriteFilterManager { get; set; } + private Machine _machine; public Machine Machine { @@ -151,6 +162,34 @@ namespace Tango.PPC.MachineSettings.ViewModels set { _autoCheckForUpdates = value; RaisePropertyChangedAuto(); } } + private List<TimeZoneInfo> _timeZones; + /// <summary> + /// Gets or sets the available time zones. + /// </summary> + public List<TimeZoneInfo> TimeZones + { + get { return _timeZones; } + set { _timeZones = value; RaisePropertyChangedAuto(); } + } + + private TimeZoneInfo _selectedTimeZone; + /// <summary> + /// Gets or sets the selected time zone. + /// </summary> + public TimeZoneInfo SelectedTimeZone + { + get { return _selectedTimeZone; } + set { _selectedTimeZone = value; RaisePropertyChangedAuto(); } + } + + private bool _enableUWF; + public bool EnableUWF + { + get { return _enableUWF; } + set { _enableUWF = value; RaisePropertyChangedAuto(); } + } + + #endregion #region Commands @@ -210,6 +249,55 @@ namespace Tango.PPC.MachineSettings.ViewModels Settings.Save(); await MachineProvider.SaveMachine(); + + if (_previousTimeZone.ToStringSafe() != SelectedTimeZone.ToStringSafe()) + { + if (await NotificationProvider.ShowQuestion("Changing the time zone requires the application to restart. Do you wish to restart the application?")) + { + try + { + LogManager.Log($"Setting new time zone to '{SelectedTimeZone.ToString()}'."); + NotificationProvider.SetGlobalBusyMessage("Setting new time zone..."); + await OperationSystemManager.ChangeTimeZone(SelectedTimeZone); + NotificationProvider.ReleaseGlobalBusyMessage(); + ApplicationManager.Restart(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error changing the time zone."); + NotificationProvider.ReleaseGlobalBusyMessage(); + await NotificationProvider.ShowError($"Error setting timezone.\n{ex.FlattenMessage()}"); + } + } + } + + if (_previousEnableUWF != EnableUWF) + { + await NotificationProvider.ShowWarning("Changes to disk protection (UWF) will take effect only after a full system restart."); + + try + { + LogManager.Log($"Changing UWF mode to '{EnableUWF}'."); + if (EnableUWF) + { + NotificationProvider.SetGlobalBusyMessage("Enabling disk protection (UWF)..."); + await UnifiedWriteFilterManager.Enable(); + } + else + { + NotificationProvider.SetGlobalBusyMessage("Disabling disk protection (UWF)..."); + await UnifiedWriteFilterManager.Disable(); + } + NotificationProvider.ReleaseGlobalBusyMessage(); + } + catch (Exception ex) + { + NotificationProvider.ReleaseGlobalBusyMessage(); + LogManager.Log(ex, "Error setting UWF mode."); + await NotificationProvider.ShowError($"Could not change the disk protection mode\n{ex.FlattenMessage()}"); + } + } + await NavigationManager.NavigateBack(); } } @@ -224,7 +312,14 @@ namespace Tango.PPC.MachineSettings.ViewModels /// </summary> public override void OnApplicationStarted() { - + try + { + TimeZones = OperationSystemManager.GetAvailableTimeZones().ToList(); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error retrieving available time zones."); + } } public async override void OnApplicationReady() @@ -239,7 +334,7 @@ namespace Tango.PPC.MachineSettings.ViewModels } } - public override void OnNavigatedTo() + public async override void OnNavigatedTo() { base.OnNavigatedTo(); @@ -274,6 +369,19 @@ namespace Tango.PPC.MachineSettings.ViewModels SynchronizeDiagnostics = Settings.SynchronizeDiagnostics; AutoCheckForUpdates = Settings.AutoCheckForUpdates; + + SelectedTimeZone = TimeZones.SingleOrDefault(x => x.StandardName == TimeZone.CurrentTimeZone.StandardName); + _previousTimeZone = SelectedTimeZone; + + try + { + EnableUWF = await UnifiedWriteFilterManager.IsEnabled(); + _previousEnableUWF = EnableUWF; + } + catch (Exception ex) + { + LogManager.Log(ex, "Error getting UWF status."); + } } private async void OnEnableRemoteAssistanceChanged() diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index c8e2d4fff..ba3516be4 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -87,7 +87,7 @@ </touch:TouchExpander> <!--JOBS--> - <touch:TouchExpander Margin="0 20 0 0" Header="JOBS" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}"> + <touch:TouchExpander Margin="0 20 0 0" Header="Jobs" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}"> <StackPanel> <controls:TableGrid Margin="10" RowHeight="70" MakeFirstColumnVerticalAlignmentBottom="False" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> <TextBlock VerticalAlignment="Center">Supported Job Types</TextBlock> @@ -253,6 +253,21 @@ </StackPanel> </touch:TouchExpander> + <!--DATE & TIME--> + <touch:TouchExpander Margin="0 20 0 0" Header="Date & Time" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}" Visibility="{Binding ApplicationManager.IsInTechnicianMode,Converter={StaticResource BooleanToVisibilityConverter}}"> + <StackPanel Margin="10 30 10 10"> + + <DockPanel TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <StackPanel> + <TextBlock VerticalAlignment="Center">Time Zone</TextBlock> + <touch:TouchComboBox Margin="0 10 0 0" ItemsSource="{Binding TimeZones}" SelectedItem="{Binding SelectedTimeZone,Mode=TwoWay}"> + + </touch:TouchComboBox> + </StackPanel> + </DockPanel> + </StackPanel> + </touch:TouchExpander> + <!--TECHNICIAN--> <touch:TouchExpander Visibility="{Binding ApplicationManager.IsInTechnicianMode,Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0 20 0 0" Header="Advanced" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}"> <StackPanel Margin="10 30 10 10"> @@ -337,6 +352,11 @@ <touch:TouchNumericTextBox Minimum="1" Maximum="120" KeyboardContainer="{Binding ElementName=Container}" Value="{Binding Settings.InsightsMaxStorageDuration,Converter={StaticResource TimeSpanToDaysConverter}}" Margin="0 0 100 0" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="90"></touch:TouchNumericTextBox> </DockPanel> + <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> + <TextBlock VerticalAlignment="Center">Enable UWF (Disk Protection)</TextBlock> + <touch:TouchToggleSlider IsChecked="{Binding EnableUWF}" Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90"></touch:TouchToggleSlider> + </DockPanel> + <DockPanel Margin="0 20 0 0"> <touch:TouchIcon VerticalAlignment="Top" Icon="InformationOutline" Foreground="{StaticResource TangoGrayTextBrush}"></touch:TouchIcon> <TextBlock Margin="10 0 0 0" VerticalAlignment="Top" TextWrapping="Wrap" FontSize="{StaticResource TangoSmallFontSize}" Foreground="{StaticResource TangoGrayTextBrush}"> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/ImageGalleryControl.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/ImageGalleryControl.xaml index f3b45d5b8..495335ff1 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/ImageGalleryControl.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Controls/ImageGalleryControl.xaml @@ -88,7 +88,7 @@ </ListBox.ItemContainerStyle> </ListBox> - <controls:NavigationControl x:Name="navigationControl" TransitionType="Slide" TransitionDuration="00:00:0.2" SelectedIndex="{TemplateBinding SelectedIndex}"> + <controls:NavigationControl x:Name="navigationControl" GalleryMode="True" TransitionType="Slide" TransitionDuration="00:00:0.2" SelectedIndex="{TemplateBinding SelectedIndex}"> </controls:NavigationControl> </DockPanel> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs index ddc0f6cdb..4d2e9c1df 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/DataStore/DefaultDataStoreService.cs @@ -17,18 +17,33 @@ using Tango.PPC.Common.ExternalBridge; using Tango.Transport; using Tango.Core.ExtensionMethods; using Newtonsoft.Json.Linq; +using Tango.BL; +using Tango.DataStore.Editing; +using Newtonsoft.Json; +using Tango.Core; namespace Tango.PPC.Common.DataStore { [TangoCreateWhenRegistered] - public class DefaultDataStoreService : IDataStoreService, IExternalBridgeRequestHandler + public class DefaultDataStoreService : ExtendedObject, IDataStoreService, IExternalBridgeRequestHandler { private IDataStoreManager _manager; + private IMachineProvider _machineProvider; + private List<ListerReceiver> _listenerReceivers; + + private class ListerReceiver + { + public String Token { get; set; } + public ExternalBridgeReceiver Receiver { get; set; } + } public DefaultDataStoreService(IPPCExternalBridgeService externalBridge, IMachineProvider machineProvider) { externalBridge.RegisterRequestHandler(this); + + _listenerReceivers = new List<ListerReceiver>(); + _machineProvider = machineProvider; machineProvider.MachineOperator.RegisterRequestHandler<PutDataStoreItemRequest>(OnPutDataStoreItemRequest); machineProvider.MachineOperator.RegisterRequestHandler<GetDataStoreItemRequest>(OnGetDataStoreItemRequest); } @@ -53,6 +68,7 @@ namespace Tango.PPC.Common.DataStore [ExternalBridgeRequestHandlerMethod(typeof(RemoteDataStorePutRequest), RequestHandlerLoggingMode.LogRequestName)] public async Task OnRemoteDataStorePutRequest(RemoteDataStorePutRequest request, String token, ExternalBridgeReceiver receiver) { + ValidateCollectionAndKey(request.Collection, request.Key); GetManager().GetCollection(request.Collection).Put(request.Key, request.Value); await receiver.SendGenericResponse(new RemoteDataStorePutResponse(), token); } @@ -60,6 +76,8 @@ namespace Tango.PPC.Common.DataStore [ExternalBridgeRequestHandlerMethod(typeof(RemoteDataStoreGetRequest), RequestHandlerLoggingMode.LogRequestName)] public async Task OnRemoteDataStoreGetRequest(RemoteDataStoreGetRequest request, String token, ExternalBridgeReceiver receiver) { + ValidateCollectionAndKey(request.Collection, request.Key); + if (request.DefaultValue is JObject obj) { request.DefaultValue = DataStoreProtoObject.FromJObject(obj); @@ -76,6 +94,8 @@ namespace Tango.PPC.Common.DataStore [ExternalBridgeRequestHandlerMethod(typeof(RemoteDataStoreGetItemRequest), RequestHandlerLoggingMode.LogRequestName)] public async Task OnRemoteDataStoreGetItemRequest(RemoteDataStoreGetItemRequest request, String token, ExternalBridgeReceiver receiver) { + ValidateCollectionAndKey(request.Collection, request.Key); + if (request.DefaultValue is JObject obj) { request.DefaultValue = DataStoreProtoObject.FromJObject(obj); @@ -101,6 +121,7 @@ namespace Tango.PPC.Common.DataStore [ExternalBridgeRequestHandlerMethod(typeof(RemoteDataStoreDeleteRequest), RequestHandlerLoggingMode.LogRequestName)] public async Task OnRemoteDataStoreDeleteRequest(RemoteDataStoreDeleteRequest request, String token, ExternalBridgeReceiver receiver) { + throw new InvalidOperationException("Deleting from the data store is not allowed."); GetManager().GetCollection(request.Collection).Delete(request.Key); await receiver.SendGenericResponse(new RemoteDataStoreDeleteResponse(), token); } @@ -108,6 +129,7 @@ namespace Tango.PPC.Common.DataStore [ExternalBridgeRequestHandlerMethod(typeof(RemoteDataStoreDeleteAllRequest), RequestHandlerLoggingMode.LogRequestName)] public async Task OnRemoteDataStoreDeleteAllRequest(RemoteDataStoreDeleteAllRequest request, String token, ExternalBridgeReceiver receiver) { + throw new InvalidOperationException("Deleting from the data store is not allowed."); GetManager().GetCollection(request.Collection).DeleteAll(); await receiver.SendGenericResponse(new RemoteDataStoreDeleteAllResponse(), token); } @@ -132,6 +154,117 @@ namespace Tango.PPC.Common.DataStore }, token); } + [ExternalBridgeRequestHandlerMethod(typeof(RemoteDataStoreGetAllItemsRequest), RequestHandlerLoggingMode.LogRequestName)] + public async Task OnRemoteDataStoreGetAllItemsRequest(RemoteDataStoreGetAllItemsRequest request, String token, ExternalBridgeReceiver receiver) + { + List<RemoteDataStoreCollection> collections = new List<RemoteDataStoreCollection>(); + + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var items = db.DataStoreItems.Where(x => !x.IsDeleted).ToList(); + + foreach (var itemsGroup in items.GroupBy(x => x.CollectionName)) + { + RemoteDataStoreCollection collection = new RemoteDataStoreCollection(); + collection.Name = itemsGroup.First().CollectionName; + collections.Add(collection); + + foreach (var item in itemsGroup) + { + collection.Items.Add(CreateRemoteItem(item.ToDataStoreItem())); + } + } + } + + await receiver.SendGenericResponse(new RemoteDataStoreGetAllItemsResponse() + { + Collections = collections + }, token); + } + + [ExternalBridgeRequestHandlerMethod(typeof(UpdateDataStoreRequest), RequestHandlerLoggingMode.LogRequestName)] + public async Task OnUpdateDataStoreRequest(UpdateDataStoreRequest request, String token, ExternalBridgeReceiver receiver) + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + var allItems = db.DataStoreItems.ToList(); + + foreach (var guid in request.ToDelete) + { + var item = allItems.FirstOrDefault(x => x.Guid == guid); + if (item != null) + { + item.IsDeleted = true; + item.IsSynchronized = true; + item.LastUpdated = DateTime.UtcNow; + } + } + + foreach (var item in request.ToUpsert) + { + ValidateCollectionAndKey(item.CollectionName, item.Key); + } + + foreach (var item in request.ToUpsert) + { + var itemDb = allItems.FirstOrDefault(x => x.CollectionName == item.CollectionName && x.Key == item.Key); + + if (itemDb == null) + { + itemDb = new BL.Entities.DataStoreItem(); + itemDb.Guid = item.Guid; + db.DataStoreItems.Add(itemDb); + } + + itemDb.CollectionName = item.CollectionName; + itemDb.DataType = item.DataType; + itemDb.IsDeleted = item.IsDeleted; + itemDb.IsSynchronized = true; + itemDb.Key = item.Key; + itemDb.LastUpdated = item.LastUpdated; + itemDb.Value = item.Value; + } + + db.SaveChanges(); + + if (_machineProvider.IsConnected) + { + Core.Threading.ThreadFactory.StartNew(() => + { + foreach (var item in request.ToUpsert) + { + try + { + var response = _machineProvider.MachineOperator.SendRequest<DataStoreItemModifiedRequest, DataStoreItemModifiedResponse>(new DataStoreItemModifiedRequest() + { + Collection = item.CollectionName, + Key = item.Key + }).Result; + } + catch (Exception ex) + { + Logging.LogManager.Default.Log(ex, $"Error notifying firmware about data store item change '{item.CollectionName}.{item.Key}'."); + } + } + }); + } + } + + await receiver.SendGenericResponse(new UpdateDataStoreResponse(), token); + } + + [ExternalBridgeRequestHandlerMethod(typeof(RemoteDataStoreStartListenRequest), RequestHandlerLoggingMode.LogRequestName)] + public async Task OnRemoteDataStoreStartListenRequest(RemoteDataStoreStartListenRequest request, String token, ExternalBridgeReceiver receiver) + { + _listenerReceivers.Add(new ListerReceiver() { Receiver = receiver, Token = token }); + + await receiver.SendGenericResponse(new RemoteDataStoreStartListenResponse() + { + ChangeType = RemoteDataStoreChangeType.None, + Item = null + }, token); + } + private RemoteDataStoreItem CreateRemoteItem(IDataStoreItem item) { RemoteDataStoreItem remote = new RemoteDataStoreItem(); @@ -149,8 +282,40 @@ namespace Tango.PPC.Common.DataStore { try { + ValidateCollectionAndKey(request.Collection, request.Key); + GetManager().GetCollection(request.Collection).Put(request.Key, GetPMRValue(request.Item)); await transporter.SendResponse(new PutDataStoreItemResponse(), token); + + try + { + if (_listenerReceivers.Count > 0) + { + var item = GetManager().GetCollection(request.Collection).GetItem(request.Key); + var remoteItem = CreateRemoteItem(item); + + foreach (var listener in _listenerReceivers.ToList()) + { + try + { + await listener.Receiver.SendGenericResponse(new RemoteDataStoreStartListenResponse() + { + ChangeType = RemoteDataStoreChangeType.Modified, + CollectionName = request.Collection, + Item = remoteItem + }, listener.Token); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error sending data store item notification to receiver '{listener.Receiver.Adapter.ToString()}'"); + } + } + } + } + catch (Exception ex) + { + LogManager.Log(ex, "Error generating data store item notifications."); + } } catch (Exception ex) { @@ -173,6 +338,8 @@ namespace Tango.PPC.Common.DataStore { try { + ValidateCollectionAndKey(request.Collection, request.Key); + var item = GetManager().GetCollection(request.Collection).GetItem(request.Key, GetPMRValue(request.DefaultItem)); await transporter.SendResponse(new GetDataStoreItemResponse() { @@ -278,9 +445,29 @@ namespace Tango.PPC.Common.DataStore #endregion + private void ValidateCollectionAndKey(String collection = null, String key = null) + { + if (collection != null) + { + if (!DataStoreHelper.ValidateCollectionOrKeyName(collection)) + { + throw new ArgumentException("Collection name contains invalid characters."); + } + } + + if (key != null) + { + if (!DataStoreHelper.ValidateCollectionOrKeyName(key)) + { + throw new ArgumentException("Item key contains invalid characters."); + } + } + } + public void OnReceiverDisconnected(ExternalBridgeReceiver receiver) { //Do nothing. + _listenerReceivers.RemoveAll(x => x.Receiver == receiver); } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj index 4cb3b42dc..9d39c96d9 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj @@ -364,6 +364,26 @@ <EmbeddedResource Include="SafetyLevelOperations.csv" /> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\..\DataStore\Tango.DataStore.Editing\Tango.DataStore.Editing.csproj"> + <Project>{ee088ff7-04d1-41fb-9d6a-cedeee7a7b9c}</Project> + <Name>Tango.DataStore.Editing</Name> + </ProjectReference> + <ProjectReference Include="..\..\DataStore\Tango.DataStore.EF\Tango.DataStore.EF.csproj"> + <Project>{88d9906b-8fc4-4fe0-b7eb-127a0a8fcee4}</Project> + <Name>Tango.DataStore.EF</Name> + </ProjectReference> + <ProjectReference Include="..\..\DataStore\Tango.DataStore.LiteDB\Tango.DataStore.Lite.csproj"> + <Project>{fa96bc0c-4055-475c-9dcc-70a5a9436b10}</Project> + <Name>Tango.DataStore.Lite</Name> + </ProjectReference> + <ProjectReference Include="..\..\DataStore\Tango.DataStore.Remote\Tango.DataStore.Remote.csproj"> + <Project>{29448f3c-9b3e-4da6-8555-46a8b9a6b3aa}</Project> + <Name>Tango.DataStore.Remote</Name> + </ProjectReference> + <ProjectReference Include="..\..\DataStore\Tango.DataStore\Tango.DataStore.csproj"> + <Project>{e0364dfa-0721-4637-9d32-9d22aac109d6}</Project> + <Name>Tango.DataStore</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.AdvancedInstaller\Tango.AdvancedInstaller.csproj"> <Project>{c5df1816-34e5-4700-824c-29623a1baa22}</Project> <Name>Tango.AdvancedInstaller</Name> @@ -388,22 +408,6 @@ <Project>{58e8825f-0c96-449c-b320-1e82b0aa876b}</Project> <Name>Tango.CSV</Name> </ProjectReference> - <ProjectReference Include="..\..\Tango.DataStore.EF\Tango.DataStore.EF.csproj"> - <Project>{88d9906b-8fc4-4fe0-b7eb-127a0a8fcee4}</Project> - <Name>Tango.DataStore.EF</Name> - </ProjectReference> - <ProjectReference Include="..\..\Tango.DataStore.LiteDB\Tango.DataStore.Lite.csproj"> - <Project>{fa96bc0c-4055-475c-9dcc-70a5a9436b10}</Project> - <Name>Tango.DataStore.Lite</Name> - </ProjectReference> - <ProjectReference Include="..\..\Tango.DataStore.Remote\Tango.DataStore.Remote.csproj"> - <Project>{29448f3c-9b3e-4da6-8555-46a8b9a6b3aa}</Project> - <Name>Tango.DataStore.Remote</Name> - </ProjectReference> - <ProjectReference Include="..\..\Tango.DataStore\Tango.DataStore.csproj"> - <Project>{e0364dfa-0721-4637-9d32-9d22aac109d6}</Project> - <Name>Tango.DataStore</Name> - </ProjectReference> <ProjectReference Include="..\..\Tango.Emulations\Tango.Emulations.csproj"> <Project>{63561e19-ff5a-414b-a5ef-e30711543e1d}</Project> <Name>Tango.Emulations</Name> @@ -516,7 +520,7 @@ </Target> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/AlternativeUnifiedWriteFilterManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/AlternativeUnifiedWriteFilterManager.cs index 828bccf83..c95cdb376 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/AlternativeUnifiedWriteFilterManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/AlternativeUnifiedWriteFilterManager.cs @@ -4,20 +4,16 @@ using System.Linq; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; +using Tango.Core; using Tango.Core.Components; namespace Tango.PPC.Common.UWF { - public class AlternativeUnifiedWriteFilterManager : IUnifiedWriteFilterManager + public class AlternativeUnifiedWriteFilterManager : ExtendedObject, IUnifiedWriteFilterManager { private const string UWF_PATH = "C:\\Windows\\Sysnative\\uwfmgr.exe"; /// <summary> - /// Gets a value indicating whether UWF if currently enabled on the system. - /// </summary> - public bool IsEnabled { get; private set; } - - /// <summary> /// Installs and configures the service (requires restart). /// </summary> /// <returns></returns> @@ -68,5 +64,31 @@ namespace Tango.PPC.Common.UWF command.OutputEncoding = CmdCommand.OutEncoding.Unicode; await command.Run(); } + + /// <summary> + /// Gets a value indicating whether UWF if currently enabled on the system. + /// </summary> + /// <returns></returns> + public async Task<bool> IsEnabled() + { + String pattern = @"Next Session Settings[\n\r]+FILTER SETTINGS[\n\r]+\s+Filter state:\s+(OFF|ON)"; + + LogManager.Log($"Getting UWF status using pattern '{pattern}'..."); + CmdCommand command = new CmdCommand(UWF_PATH, $"get-config"); + command.OutputEncoding = CmdCommand.OutEncoding.Unicode; + var result = await command.Run(); + + Match match = Regex.Match(result.StandardOutput, pattern); + if (match != null && match.Success && match.Groups.Count > 1) + { + var value = match.Groups[1].Value; + + LogManager.Log($"UWF pattern parsing result: '{value}'."); + + return value.ToStringOrEmpty().Trim() == "ON"; + } + + return false; + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/DefaultUnifiedWriteFilterManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/DefaultUnifiedWriteFilterManager.cs index 65cb3f466..5684f6926 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/DefaultUnifiedWriteFilterManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/DefaultUnifiedWriteFilterManager.cs @@ -2,7 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Text.RegularExpressions; using System.Threading.Tasks; +using Tango.Core; using Tango.Core.Components; namespace Tango.PPC.Common.UWF @@ -11,7 +13,7 @@ namespace Tango.PPC.Common.UWF /// Represents the default unified writer filter manager. /// </summary> /// <seealso cref="Tango.PPC.Common.UWF.IUnifiedWriteFilterManager" /> - public class DefaultUnifiedWriteFilterManager : IUnifiedWriteFilterManager + public class DefaultUnifiedWriteFilterManager : ExtendedObject, IUnifiedWriteFilterManager { private const int UWF_CAPACITY_MB = 5000; private const string UWF_PATH = "C:\\Windows\\Sysnative\\uwfmgr.exe"; @@ -24,11 +26,6 @@ namespace Tango.PPC.Common.UWF }; /// <summary> - /// Gets a value indicating whether UWF if currently enabled on the system. - /// </summary> - public bool IsEnabled { get; } - - /// <summary> /// Installs and configures the service (requires restart). /// </summary> public async Task Setup() @@ -95,5 +92,31 @@ namespace Tango.PPC.Common.UWF command.OutputEncoding = CmdCommand.OutEncoding.Unicode; await command.Run(); } + + /// <summary> + /// Gets a value indicating whether UWF if currently enabled on the system. + /// </summary> + /// <returns></returns> + public async Task<bool> IsEnabled() + { + String pattern = @"Next Session Settings[\n\r]+FILTER SETTINGS[\n\r]+\s+Filter state:\s+(OFF|ON)"; + + LogManager.Log($"Getting UWF status using pattern '{pattern}'..."); + CmdCommand command = new CmdCommand(UWF_PATH, $"get-config"); + command.OutputEncoding = CmdCommand.OutEncoding.Unicode; + var result = await command.Run(); + + Match match = Regex.Match(result.StandardOutput, pattern); + if (match != null && match.Success && match.Groups.Count > 1) + { + var value = match.Groups[1].Value; + + LogManager.Log($"UWF pattern parsing result: '{value}'."); + + return value.ToStringOrEmpty().Trim() == "ON"; + } + + return false; + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/IUnifiedWriteFilterManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/IUnifiedWriteFilterManager.cs index 05fa1876a..b6a661ab5 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/IUnifiedWriteFilterManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/UWF/IUnifiedWriteFilterManager.cs @@ -14,7 +14,8 @@ namespace Tango.PPC.Common.UWF /// <summary> /// Gets a value indicating whether UWF if currently enabled on the system. /// </summary> - bool IsEnabled { get; } + /// <returns></returns> + Task<bool> IsEnabled(); /// <summary> /// Installs and configures the service (requires restart). diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs index fb5b9796f..5218d9f70 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Connectivity/DefaultConnectivityProvider.cs @@ -182,7 +182,7 @@ namespace Tango.PPC.UI.Connectivity || net.NetworkInterfaceType == NetworkInterfaceType.Ethernet3Megabit || net.NetworkInterfaceType == NetworkInterfaceType.FastEthernetFx || net.NetworkInterfaceType == NetworkInterfaceType.FastEthernetT - || net.NetworkInterfaceType == NetworkInterfaceType.GigabitEthernet) && net.Name == "Ethernet" && net.OperationalStatus == OperationalStatus.Up) + || net.NetworkInterfaceType == NetworkInterfaceType.GigabitEthernet) && net.Name.ToStringOrEmpty().StartsWith("Ethernet") && net.OperationalStatus == OperationalStatus.Up) { IsLanConnected = true; return; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadBreakView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadBreakView.xaml index 6c64520a4..f17860d42 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadBreakView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadBreakView.xaml @@ -51,7 +51,7 @@ <TextBlock TextWrapping="Wrap" TextAlignment="Center" Margin="40 0" HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Please check guiding units on both sides of the system and fix/tie the thread if possible.</TextBlock> </StackPanel> - <commonControls:ImageGalleryControl Duration="00:00:02"> + <commonControls:ImageGalleryControl Duration="00:00:03"> <Image Stretch="Uniform" Source="/Images/ThreadLoading/GuidingUnits/1.jpg"></Image> </commonControls:ImageGalleryControl> </DockPanel> @@ -77,7 +77,7 @@ <Grid> <Grid Visibility="{Binding IsArcHead,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> - <commonControls:ImageGalleryControl Duration="00:00:02"> + <commonControls:ImageGalleryControl Duration="00:00:03"> <Image Stretch="Uniform" Source="/Images/ThreadLoading/FeedingUnits/1.jpg"></Image> <Image Stretch="Uniform" Source="/Images/ThreadLoading/FeedingUnits/2.jpg"></Image> <Image Stretch="Uniform" Source="/Images/ThreadLoading/FeedingUnits/3.jpg"></Image> @@ -86,7 +86,7 @@ </Grid> <Grid Visibility="{Binding IsArcHead,Converter={StaticResource BooleanToVisibilityConverter}}"> - <commonControls:ImageGalleryControl Duration="00:00:02"> + <commonControls:ImageGalleryControl Duration="00:00:03"> <Image Stretch="Uniform" Source="/Images/ThreadLoading/FeedingUnits/arc/1.jpg"></Image> <Image Stretch="Uniform" Source="/Images/ThreadLoading/FeedingUnits/arc/2.jpg"></Image> <Image Stretch="Uniform" Source="/Images/ThreadLoading/FeedingUnits/arc/3.jpg"></Image> @@ -122,7 +122,7 @@ </TextBlock> </StackPanel> - <commonControls:ImageGalleryControl Duration="00:00:02"> + <commonControls:ImageGalleryControl Duration="00:00:03"> <Image Stretch="Uniform" Source="/Images/ThreadLoading/TheDryer/1.jpg"></Image> <Image Stretch="Uniform" Source="/Images/ThreadLoading/TheDryer/2.jpg"></Image> <Image Stretch="Uniform" Source="/Images/ThreadLoading/TheDryer/3.jpg"></Image> @@ -149,7 +149,7 @@ </TextBlock> </StackPanel> - <commonControls:ImageGalleryControl Duration="00:00:02"> + <commonControls:ImageGalleryControl Duration="00:00:03"> <Image Stretch="Uniform" Source="/Images/ThreadLoading/DryerClose/1.jpg"></Image> <Image Stretch="Uniform" Source="/Images/ThreadLoading/DryerClose/2.jpg"></Image> <Image Stretch="Uniform" Source="/Images/ThreadLoading/DryerClose/3.jpg"></Image> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadBreakViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadBreakViewVM.cs index 131f976c1..e737f3b12 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadBreakViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadBreakViewVM.cs @@ -157,6 +157,7 @@ namespace Tango.PPC.UI.Dialogs catch (Exception ex) { LogManager.Log(ex, LogCategory.Warning, "Error occurred while attempting to perform thread jogging."); + await NotificationProvider.ShowError($"Thread movement verification failed.\n{ex.FlattenMessage()}"); Stage = WizardStage.FeedingUnits; } } @@ -192,6 +193,7 @@ namespace Tango.PPC.UI.Dialogs catch (Exception ex) { LogManager.Log(ex, LogCategory.Warning, "Error occurred while attempting to perform thread jogging."); + await NotificationProvider.ShowError($"Thread movement verification failed.\n{ex.FlattenMessage()}"); Stage = WizardStage.TheDryer; } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml index 3d37c81bd..e45065c61 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Dialogs/ThreadLoadingView.xaml @@ -78,7 +78,7 @@ </Grid> <Grid> - <commonControls:ImageGalleryControl Duration="00:00:02"> + <commonControls:ImageGalleryControl Duration="00:00:03"> <Image Stretch="Uniform" Source="/Images/ThreadLoading/NewThread/ReadyForLoading/arc/1.jpg"></Image> <Image Stretch="Uniform" Source="/Images/ThreadLoading/NewThread/ReadyForLoading/arc/2.jpg"></Image> <Image Stretch="Uniform" Source="/Images/ThreadLoading/NewThread/ReadyForLoading/arc/3.jpg"></Image> @@ -136,7 +136,7 @@ </UniformGrid> <DockPanel Margin="0 50 0 0" > <StackPanel DockPanel.Dock="Top"> - <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Something went wrong</TextBlock> + <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Something went wrong, press 'retry' to try again</TextBlock> <touch:TouchIcon Icon="AlertCircleOutline" Margin="0 40 0 0" HorizontalAlignment="Center" Foreground="{StaticResource TangoErrorBrush}" Width="100" Height="100" /> <TextBlock Margin="0 10 0 0" FontSize="{StaticResource TangoSmallFontSize}" TextAlignment="Center" TextWrapping="Wrap" HorizontalAlignment="Center" Foreground="{StaticResource TangoGrayTextBrush}" Text="{Binding Error}"></TextBlock> </StackPanel> @@ -153,7 +153,7 @@ </UniformGrid> <DockPanel Margin="0 50 0 0" > <StackPanel DockPanel.Dock="Top"> - <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Something went wrong</TextBlock> + <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Something went wrong, press 'retry' to try again</TextBlock> <touch:TouchIcon Icon="AlertCircleOutline" Margin="0 40 0 0" HorizontalAlignment="Center" Foreground="{StaticResource TangoErrorBrush}" Width="100" Height="100" /> <TextBlock Margin="0 10 0 0" FontSize="{StaticResource TangoSmallFontSize}" TextAlignment="Center" TextWrapping="Wrap" HorizontalAlignment="Center" Foreground="{StaticResource TangoGrayTextBrush}" Text="{Binding Error}"></TextBlock> </StackPanel> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/ThreadLoading/FeedingUnits/4.JPG b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/ThreadLoading/FeedingUnits/4.JPG Binary files differindex 575066c23..52063b213 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/ThreadLoading/FeedingUnits/4.JPG +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/ThreadLoading/FeedingUnits/4.JPG diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/ThreadLoading/FeedingUnits/arc/4.jpg b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/ThreadLoading/FeedingUnits/arc/4.jpg Binary files differindex 575066c23..52063b213 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/ThreadLoading/FeedingUnits/arc/4.jpg +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/ThreadLoading/FeedingUnits/arc/4.jpg diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index aad563fc1..930178b7e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango PPC Application")] -[assembly: AssemblyVersion("1.2.1.0")] +[assembly: AssemblyVersion("1.2.4.0")] diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 7f520ecc5..1257fee46 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -753,6 +753,8 @@ if $(ConfigurationName) == Release del "$(TargetDir)firmware_package.tfp" if $(ConfigurationName) == Release del *.xml +if $(ConfigurationName) == Release del WebRtc.NET.pdb + if $(ConfigurationName) == Debug copy /Y "$(TargetDir)Packages" "$(TargetDir)"</PostBuildEvent> </PropertyGroup> <PropertyGroup> @@ -761,7 +763,7 @@ if $(ConfigurationName) == Debug copy /Y "$(TargetDir)Packages" "$(TargetDir)"</ </PropertyGroup> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs index 562a3b659..a2baec8b8 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -64,7 +64,7 @@ namespace Tango.PPC.UI.ViewModels { int index = Status.Cartridge.Index; - var idsPack = _machineProvider.Machine.Configuration.IdsPacks.FirstOrDefault(x => x.PackIndex == index); + var idsPack = _machineProvider.Machine.Configuration.NoneEmptyIdsPacks.FirstOrDefault(x => x.PackIndex == index); if (idsPack != null) { |
