diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-12-04 14:11:29 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-12-04 14:11:29 +0200 |
| commit | 5513ba4c2db05de40d9adfac645d7e77c35c71f7 (patch) | |
| tree | 0088cfa3a3a76692a37f65a4724a5429ca51ed2d /Software/Visual_Studio/PPC | |
| parent | 13f168081666328ac648c230ae0cdd4adf4fd133 (diff) | |
| download | Tango-5513ba4c2db05de40d9adfac645d7e77c35c71f7.tar.gz Tango-5513ba4c2db05de40d9adfac645d7e77c35c71f7.zip | |
Worked on PPC setup & update.
Diffstat (limited to 'Software/Visual_Studio/PPC')
10 files changed, 50 insertions, 70 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs index 12c4a9de9..02324b743 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineSetup/MachineSetupManager.cs @@ -123,7 +123,7 @@ namespace Tango.PPC.Common.MachineSetup } catch (Exception ex) { - throw LogManager.Log(ex, $"An error occurred while trying to contact machine service: {ex.Message}"); + throw LogManager.Log(ex, $"An error occurred while trying to contact machine service: {ex.FlattenMessage()}"); } LogManager.Log($"Machine setup response received: {Environment.NewLine}{setup_response.ToJsonString()}"); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs index b4780887b..5fcb7e209 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateManager.cs @@ -455,8 +455,6 @@ namespace Tango.PPC.Common.MachineUpdate { return Task.Factory.StartNew<MachineUpdateResult>(() => { - CurrentStep = MachineUpdateSteps.UpdatingFromPackage; - LogManager.Log($"Starting machine update from update package '{fileName}'..."); //Create temporary folders for packages. diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateSteps.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateSteps.cs index 74931d2d4..9c4e9e425 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateSteps.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/MachineUpdate/MachineUpdateSteps.cs @@ -17,6 +17,5 @@ namespace Tango.PPC.Common.MachineUpdate SynchronizingData, [Description("Updating Configuration")] SynchronizingMachineConfiguration, - UpdatingFromPackage } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Publisher/MainWindowVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.Publisher/MainWindowVM.cs index 5891f1228..081aeba22 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Publisher/MainWindowVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.Publisher/MainWindowVM.cs @@ -17,11 +17,13 @@ using System.Windows; using System.Windows.Data; using Tango.BL; using Tango.BL.Entities; +using Tango.Core; using Tango.Core.Commands; using Tango.Core.Cryptography; using Tango.Core.Helpers; using Tango.Core.IO; using Tango.PPC.Common.Update; +using Tango.Settings; using Tango.SharedUI; using Tango.SQLExaminer; @@ -149,17 +151,21 @@ namespace Tango.PPC.Publisher _hashGenerator = new BasicHashGenerator(); - ProvisionSequenceItems = new ObservableCollection<SequenceItem>(); + var settings = SettingsManager.Default.GetOrCreate<PublisherSettings>(); + + ProvisionSequenceItems = new ObservableCollection<SequenceItem>(settings.ProvisionSequenceItems); ProvisionSequenceItemsView = CollectionViewSource.GetDefaultView(ProvisionSequenceItems); ProvisionSequenceItemsView.SortDescriptions.Add(new SortDescription(nameof(SequenceItem.Index), ListSortDirection.Ascending)); - UpdateSequenceItems = new ObservableCollection<SequenceItem>(); + UpdateSequenceItems = new ObservableCollection<SequenceItem>(settings.UpdateSequenceItems); UpdateSequenceItemsView = CollectionViewSource.GetDefaultView(UpdateSequenceItems); UpdateSequenceItemsView.SortDescriptions.Add(new SortDescription(nameof(SequenceItem.Index), ListSortDirection.Ascending)); - using (ObservablesContext db = ObservablesContext.CreateDefault("localhost\\SQLEXPRESS")) + SettingsManager.Default.GetOrCreate<CoreSettings>(); + SettingsManager.Default.Save(); + + using (ObservablesContext db = ObservablesContext.CreateDefault()) { - db.Configuration.LazyLoadingEnabled = false; MachineVersions = db.MachineVersions.ToList(); SelectedMachineVersion = MachineVersions.OrderBy(x => x.Version).LastOrDefault(); } @@ -195,6 +201,11 @@ namespace Tango.PPC.Publisher IsUpdating = true; String tempFile = String.Empty; + var settings = SettingsManager.Default.GetOrCreate<PublisherSettings>(); + settings.ProvisionSequenceItems = ProvisionSequenceItems.ToList(); + settings.UpdateSequenceItems = UpdateSequenceItems.ToList(); + settings.Save(); + try { var response = await _client.UploadVersion(new UploadVersionRequest() diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Publisher/PublisherSettings.cs b/Software/Visual_Studio/PPC/Tango.PPC.Publisher/PublisherSettings.cs new file mode 100644 index 000000000..d9f10cd01 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.Publisher/PublisherSettings.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Settings; + +namespace Tango.PPC.Publisher +{ + public class PublisherSettings : SettingsBase + { + public List<SequenceItem> ProvisionSequenceItems { get; set; } + + public List<SequenceItem> UpdateSequenceItems { get; set; } + + public PublisherSettings() + { + ProvisionSequenceItems = new List<SequenceItem>(); + UpdateSequenceItems = new List<SequenceItem>(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Publisher/Tango.PPC.Publisher.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Publisher/Tango.PPC.Publisher.csproj index 1e12b7cfa..ef692809f 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Publisher/Tango.PPC.Publisher.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.Publisher/Tango.PPC.Publisher.csproj @@ -77,6 +77,7 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </ApplicationDefinition> + <Compile Include="PublisherSettings.cs" /> <Compile Include="SequenceItem.cs" /> <Page Include="MainWindow.xaml"> <Generator>MSBuild:Compile</Generator> @@ -131,6 +132,10 @@ <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> <Name>Tango.Core</Name> </ProjectReference> + <ProjectReference Include="..\..\Tango.Settings\Tango.Settings.csproj"> + <Project>{D8F1AD85-526A-4F50-B6DC-D437AF63D8D8}</Project> + <Name>Tango.Settings</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.SharedUI\Tango.SharedUI.csproj"> <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> <Name>Tango.SharedUI</Name> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config index ca5f29fc1..b2738c8cf 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.config @@ -10,62 +10,6 @@ <runtime> <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.2.0" newVersion="1.2.2.0" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-1.4.2.0" newVersion="1.4.2.0" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="System.IO.FileSystem" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.1.2.0" newVersion="4.1.2.0" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="System.IO.FileSystem.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="System.Security.Cryptography.Primitives" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="System.Xml.XPath.XDocument" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="System.Console" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="System.Diagnostics.StackTrace" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="System.Reactive.Core" publicKeyToken="94bc3704cddfc263" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-3.0.3000.0" newVersion="3.0.3000.0" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-3.19.8.16603" newVersion="3.19.8.16603" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory.Platform" publicKeyToken="31bf3856ad364e35" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-3.19.8.16603" newVersion="3.19.8.16603" /> - </dependentAssembly> - <dependentAssembly> - <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> - <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" /> - </dependentAssembly> </assemblyBinding> </runtime> <entityFramework> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs index 957a4ee1d..6b566dcd2 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs @@ -171,8 +171,6 @@ namespace Tango.PPC.UI.PPCApplication _machine = new MachineBuilder(ObservablesContext.CreateDefault()).SetFirst().WithOrganization().WithConfiguration().Build(); } - _eventLogger.Log(EventTypes.ApplicationStarted, "Application Started!"); - initialized = true; } catch (Exception ex) @@ -214,6 +212,7 @@ namespace Tango.PPC.UI.PPCApplication { LogManager.Log($"Raising {nameof(ApplicationStarted)} event..."); + _eventLogger.Log(EventTypes.ApplicationStarted, "Application Started!"); ApplicationStarted?.Invoke(this, new EventArgs()); LogManager.Log("Invoking PPC view models OnApplicationStarted methods..."); 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 3f255989f..d74e989e9 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 @@ -12,7 +12,7 @@ <FileAlignment>512</FileAlignment> <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <WarningLevel>4</WarningLevel> - <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> + <AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects> <NuGetPackageImportStamp> </NuGetPackageImportStamp> <IsWebBootstrapper>false</IsWebBootstrapper> @@ -463,7 +463,7 @@ copy /Y "$(SolutionDir)Referenced Assemblies\vcruntime140d.dll" "$(TargetDir)"</ </PropertyGroup> <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.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs index 5598362be..281e54958 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs @@ -74,10 +74,12 @@ namespace Tango.PPC.UI.ViewModels { using (ObservablesContext db = ObservablesContext.CreateDefault()) { - if (db.Users.Count() == 1) + var machine = await db.Machines.FirstAsync(); + + if (db.Users.Count() == 1 || machine.AutoLogin) { var user = await db.Users.FirstAsync(); - LogManager.Log($"Application started. Single user detected ({user.Email}). Skipping LoginView..."); + LogManager.Log($"Application started. Single user/Auto login detected ({user.Email}). Skipping LoginView..."); await AuthenticationProvider.Login(user.Email, user.Password, false); IsLoading = false; } |
