aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-08-25 01:25:36 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-08-25 01:25:36 +0300
commitcc39950f6dd2a41f029d8d878e132ec80d9b0dd0 (patch)
tree474ff5c7f2101e424bd0c1a8356e5a0fb701af06 /Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI
parent8c3729dc78b533fff733564bab871b1bd69a75c0 (diff)
downloadTango-cc39950f6dd2a41f029d8d878e132ec80d9b0dd0.tar.gz
Tango-cc39950f6dd2a41f029d8d878e132ec80d9b0dd0.zip
Tango FSE + FSE Log Viewer + Custom Protocol - Completed !!!
Diffstat (limited to 'Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI')
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/LoadFromTfsMode.cs19
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/LogViewerViewModel.cs4
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Tango.FSE.LogViewer.UI.csproj24
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModelLocator.cs4
-rw-r--r--Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModels/LayoutViewVM.cs56
5 files changed, 104 insertions, 3 deletions
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/LoadFromTfsMode.cs b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/LoadFromTfsMode.cs
new file mode 100644
index 000000000..618a872d3
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/LoadFromTfsMode.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.FSE.LogViewer.UI
+{
+ public enum LoadFromTfsMode
+ {
+ [Description("Tango.FSE")]
+ FSE,
+ [Description("Tango.PPC")]
+ PPC,
+ [Description("Embedded")]
+ Embedded
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/LogViewerViewModel.cs b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/LogViewerViewModel.cs
index e90956353..35eb8b371 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/LogViewerViewModel.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/LogViewerViewModel.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Core.DI;
+using Tango.FSE.BL;
using Tango.FSE.Common.Notifications;
using Tango.FSE.Common.Storage;
using Tango.SharedUI;
@@ -17,5 +18,8 @@ namespace Tango.FSE.LogViewer.UI
[TangoInject]
public IStorageProvider StorageProvider { get; set; }
+
+ [TangoInject]
+ public ICryptographyProvider CryptographyProvider { get; set; }
}
}
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Tango.FSE.LogViewer.UI.csproj b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Tango.FSE.LogViewer.UI.csproj
index b66c33d7c..d78944d97 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Tango.FSE.LogViewer.UI.csproj
+++ b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/Tango.FSE.LogViewer.UI.csproj
@@ -60,6 +60,7 @@
</ApplicationDefinition>
<Compile Include="ArgsObject.cs" />
<Compile Include="Converters\PolygonTabToPointCollectionConverter.cs" />
+ <Compile Include="LoadFromTfsMode.cs" />
<Compile Include="LogViewerViewModel.cs" />
<Compile Include="ViewModelLocator.cs" />
<Compile Include="ViewModels\LayoutViewVM.cs" />
@@ -167,6 +168,14 @@
<Project>{8491D07B-C1F6-4B62-A412-41B9FD2D6538}</Project>
<Name>Tango.SharedUI</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\Tango.TFS\Tango.TFS.csproj">
+ <Project>{998f8471-dc1b-41b6-9d96-354e1b4e7a32}</Project>
+ <Name>Tango.TFS</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Tango.FSE.BL\Tango.FSE.BL.csproj">
+ <Project>{834C81C3-09B5-45D7-BE12-E7D1E6655A7C}</Project>
+ <Name>Tango.FSE.BL</Name>
+ </ProjectReference>
<ProjectReference Include="..\Tango.FSE.Common\Tango.FSE.Common.csproj">
<Project>{bc37cccb-7392-4f78-8d1c-e9629e6e046e}</Project>
<Name>Tango.FSE.Common</Name>
@@ -175,12 +184,25 @@
<Project>{26c54a4f-315d-4b79-b163-eddde8f93a86}</Project>
<Name>Tango.FSE.UI</Name>
</ProjectReference>
+ <ProjectReference Include="..\Tango.FSE.Web\Tango.FSE.Web.csproj">
+ <Project>{D6F7D31D-7F8C-45E2-AE0A-FBBD1F5F9D5F}</Project>
+ <Name>Tango.FSE.Web</Name>
+ </ProjectReference>
</ItemGroup>
<ItemGroup>
<Resource Include="log_viewer_icon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
- <PostBuildEvent>copy /Y "$(TargetPath)" "$(SolutionDir)Build\FSE\$(ConfigurationName)"</PostBuildEvent>
+ <PostBuildEvent>copy /Y "$(SolutionDir)Referenced Assemblies\Microsoft.WITDataStore32.dll" "$(TargetDir)"
+
+@echo Copying output to FSE Build folder...
+@echo Copying $(TargetFileName)...
+copy /Y "$(TargetPath)" "$(SolutionDir)Build\FSE\$(ConfigurationName)"
+@echo Copying $(TargetName).pdb...
+copy /Y "$(TargetDir)$(TargetName).pdb" "$(SolutionDir)Build\FSE\$(ConfigurationName)"
+@echo Copying $(TargetFileName).config...
+copy /Y "$(TargetDir)$(TargetFileName).config" "$(SolutionDir)Build\FSE\$(ConfigurationName)"
+</PostBuildEvent>
</PropertyGroup>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModelLocator.cs b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModelLocator.cs
index 177409e7d..a9b9f85e8 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModelLocator.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModelLocator.cs
@@ -4,9 +4,11 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.Core.DI;
+using Tango.FSE.BL;
using Tango.FSE.Common.Notifications;
using Tango.FSE.Common.Storage;
using Tango.FSE.LogViewer.UI.ViewModels;
+using Tango.FSE.UI.Cryptography;
using Tango.FSE.UI.Notifications;
using Tango.FSE.UI.Storage;
@@ -18,9 +20,11 @@ namespace Tango.FSE.LogViewer.UI
{
TangoIOC.Default.Unregister<INotificationProvider>();
TangoIOC.Default.Unregister<IStorageProvider>();
+ TangoIOC.Default.Unregister<ICryptographyProvider>();
TangoIOC.Default.Register<INotificationProvider, DefaultNotificationProvider>();
TangoIOC.Default.Register<IStorageProvider, DefaultStorageProvider>();
+ TangoIOC.Default.Register<ICryptographyProvider, DefaultCryptographyProvider>();
TangoIOC.Default.Register<MainViewVM>();
TangoIOC.Default.Register<LayoutViewVM>();
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModels/LayoutViewVM.cs
index 40d86bc32..1a255fa9e 100644
--- a/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModels/LayoutViewVM.cs
+++ b/Software/Visual_Studio/FSE/Tango.FSE.LogViewer.UI/ViewModels/LayoutViewVM.cs
@@ -10,10 +10,14 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
using Tango.Core.Commands;
+using Tango.FSE.BL.WindowsRegistry;
using Tango.FSE.Common.Helpers;
+using Tango.FSE.Web.Messages;
using Tango.Integration.Logging;
using Tango.Logging;
using ZetaIpc.Runtime.Server;
+using Tango.TFS;
+using System.Diagnostics;
namespace Tango.FSE.LogViewer.UI.ViewModels
{
@@ -57,7 +61,7 @@ namespace Tango.FSE.LogViewer.UI.ViewModels
private void MainWindow_ContentRendered(object sender, EventArgs e)
{
- var startupArgs = StartupArgsHelper.CleanArgsFromWeb(Environment.GetCommandLineArgs().Skip(1).ToArray()).ToList();
+ var startupArgs = Environment.GetCommandLineArgs().Skip(1).ToList();
OnApplicationReady(startupArgs);
}
@@ -266,9 +270,21 @@ namespace Tango.FSE.LogViewer.UI.ViewModels
private async void HandleStartupArgs(List<string> args)
{
+ if (args == null) return;
+
+ args = StartupArgsHelper.CleanArgsFromWeb(args.ToArray()).ToList();
+
if (args.Count == 3 && args[0] == "-remote")
{
- MessageBox.Show($"TODO: Load From Remote, Type: {args[1]}, Work ID: {args[2]}");
+ try
+ {
+ LoadFromTFS(args[2], (LoadFromTfsMode)Enum.Parse(typeof(LoadFromTfsMode), args[1]));
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex);
+ await NotificationProvider.ShowError($"Error loading the specified work item logs.\n{ex.FlattenMessage()}");
+ }
}
else
{
@@ -285,5 +301,41 @@ namespace Tango.FSE.LogViewer.UI.ViewModels
}
}
}
+
+ private async void LoadFromTFS(String workItemID, LoadFromTfsMode mode)
+ {
+ try
+ {
+ String tempFile = null;
+
+ using (NotificationProvider.PushTaskItem($"Loading {mode} logs from work item {workItemID}..."))
+ {
+ await Task.Factory.StartNew(() =>
+ {
+ int id = int.Parse(workItemID);
+
+ var encrypted = RegistryService.Default.GetValue("TFS");
+ BugReportingInfoResponse info = CryptographyProvider.Decrypt<BugReportingInfoResponse>(encrypted);
+
+ TeamFoundationServiceClient client = new TeamFoundationServiceClient(info.CollectionUrl, String.Empty, info.PersonalToken);
+ Project project = client.GetProject("Tango").Result;
+
+ var attachements = client.GetWorkItemAttachements(id).Result;
+ AttachementHandler handler = attachements.Where(x => x.Extension == ".log").LastOrDefault(x => x.Name.StartsWith(mode.ToDescription()));
+
+ var tempFolder = TemporaryManager.CreateFolder();
+ tempFile = Path.Combine(tempFolder, handler.Name);
+ handler.Download(tempFile).Wait();
+ });
+
+ await OpenLogFile(tempFile);
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex);
+ await NotificationProvider.ShowError($"Error loading the specified work item logs.\n{ex.FlattenMessage()}");
+ }
+ }
}
}