aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy <Roy.mail.net@gmail.com>2023-05-08 17:11:38 +0300
committerRoy <Roy.mail.net@gmail.com>2023-05-08 17:11:38 +0300
commitf1d5de87c0335b5c954eceef94c8c7f72278d7df (patch)
tree4565b01453a00711c3c1136ba6a2302e9257f66e /Software/Visual_Studio
parent32ff3d6cc46e121a221232c67515e2f58e737bf2 (diff)
downloadTango-f1d5de87c0335b5c954eceef94c8c7f72278d7df.tar.gz
Tango-f1d5de87c0335b5c954eceef94c8c7f72278d7df.zip
Added Machine Type to TFS Lib & MS.
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs3
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs1
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs5
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml9
-rw-r--r--Software/Visual_Studio/Tango.TFS/MachineType.cs17
-rw-r--r--Software/Visual_Studio/Tango.TFS/Tango.TFS.csproj3
-rw-r--r--Software/Visual_Studio/Tango.TFS/TeamFoundationServiceClient.cs13
-rw-r--r--Software/Visual_Studio/Tango.TFS/WorkItem.cs7
8 files changed, 54 insertions, 4 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs
index 25dfc2dc8..6ae71d50d 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs
@@ -9,6 +9,7 @@ using Tango.BL;
using Tango.Integration.Operation;
using Tango.Logging;
using Tango.MachineStudio.Common.Web;
+using Tango.PMR.Common;
using Tango.PMR.Printing;
using Tango.Settings;
using Tango.Transport.Adapters;
@@ -178,6 +179,8 @@ namespace Tango.MachineStudio.Common
/// </summary>
public MachineStudioTheme Theme { get; set; }
+ public int LastConnectedMachineType { get; set; }
+
/// <summary>
/// Initializes a new instance of the <see cref="MachineStudio"/> class.
/// </summary>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs
index 78230b8a0..2efe4c719 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/StudioApplication/DefaultStudioApplicationManager.cs
@@ -402,6 +402,7 @@ namespace Tango.MachineStudio.UI.StudioApplication
ConnectedMachine = connectedMachine;
var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>();
ConnectedMachine.JobUploadStrategy = settings.JobUploadStrategy;
+ settings.LastConnectedMachineType = Machine.MachineType;
}
else
{
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs
index b716ed1fb..7a0a9414c 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs
@@ -152,6 +152,8 @@ namespace Tango.MachineStudio.UI.TFS
throw LogManager.Default.Log(new AuthenticationException($"User '{user_email}' is not part of the Tango VSTS team. Please contact your administrator."));
}
+ var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>();
+
item.CreatedBy = currentUser;
item.ChangedBy = currentUser;
item.AuthorizedAs = currentUser;
@@ -161,7 +163,8 @@ namespace Tango.MachineStudio.UI.TFS
item.Severity = Severity.Medium;
item.State = State.New;
item.Type = WorkItemType.Bug;
- item.Environment = SettingsManager.Default.GetOrCreate<MachineStudioSettings>().DeploymentSlot.ToDescription();
+ item.Environment = settings.DeploymentSlot.ToDescription();
+ item.MachineType = (MachineType)settings.LastConnectedMachineType;
foreach (var window in Application.Current.Windows.OfType<Window>().Where(x => !String.IsNullOrWhiteSpace(x.Title)))
{
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml
index aac712f59..3eeb5f901 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml
@@ -12,7 +12,7 @@
xmlns:tfs="clr-namespace:Tango.TFS;assembly=Tango.TFS"
xmlns:tfss="clr-namespace:Tango.MachineStudio.UI.TFS"
xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views"
- mc:Ignorable="d" Width="530" Height="660" Background="{StaticResource Dialog.Background}" d:DataContext="{d:DesignInstance Type=vm:ReportIssueViewVM, IsDesignTimeCreatable=False}" Foreground="{StaticResource MainWindow.Foreground}">
+ mc:Ignorable="d" Width="530" Height="700" Background="{StaticResource Dialog.Background}" d:DataContext="{d:DesignInstance Type=vm:ReportIssueViewVM, IsDesignTimeCreatable=False}" Foreground="{StaticResource MainWindow.Foreground}">
<UserControl.Resources>
<converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" />
@@ -44,6 +44,11 @@
</DockPanel>
<DockPanel Margin="0 10 0 0">
+ <materialDesign:PackIcon Kind="Settings" Width="24" Height="24" VerticalAlignment="Center" Margin="0 0 10 0" />
+ <ComboBox materialDesign:HintAssist.Hint="Machine Type" materialDesign:HintAssist.IsFloating="True" ItemsSource="{Binding Source={x:Type tfs:MachineType},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding WorkItem.MachineType}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>
+ </DockPanel>
+
+ <DockPanel Margin="0 10 0 0">
<materialDesign:PackIcon Kind="Account" Width="24" Height="24" VerticalAlignment="Center" Margin="0 0 10 0" />
<autoComplete:AutoCompleteTextBox Provider="{StaticResource TeamMembersProvider}" SelectedItem="{Binding WorkItem.AssignedTo,Mode=TwoWay}" DisplayMember="DisplayName" materialDesign:HintAssist.Hint="Assigned To" materialDesign:HintAssist.IsFloating="True"></autoComplete:AutoCompleteTextBox>
</DockPanel>
@@ -83,7 +88,7 @@
<materialDesign:PackIcon Kind="Tag" Width="24" Height="24" VerticalAlignment="Center" Margin="0 0 10 0" />
<TextBlock VerticalAlignment="Center"><Run>Tags</Run> <Run FontSize="10" Foreground="Gray">(highlight selected tags)</Run></TextBlock>
</DockPanel>
- <ScrollViewer Margin="30 0 0 0" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Height="120">
+ <ScrollViewer Margin="30 0 0 0" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Height="100">
<ItemsControl ItemsSource="{Binding SelectedTags}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
diff --git a/Software/Visual_Studio/Tango.TFS/MachineType.cs b/Software/Visual_Studio/Tango.TFS/MachineType.cs
new file mode 100644
index 000000000..044155b2b
--- /dev/null
+++ b/Software/Visual_Studio/Tango.TFS/MachineType.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.TFS
+{
+ public enum MachineType
+ {
+ [Description("TS 1800")]
+ TS1800 = 0,
+ [Description("Twine X4")]
+ TwineX4 = 1,
+ }
+}
diff --git a/Software/Visual_Studio/Tango.TFS/Tango.TFS.csproj b/Software/Visual_Studio/Tango.TFS/Tango.TFS.csproj
index 3e3e6f6fd..271491a7e 100644
--- a/Software/Visual_Studio/Tango.TFS/Tango.TFS.csproj
+++ b/Software/Visual_Studio/Tango.TFS/Tango.TFS.csproj
@@ -207,6 +207,7 @@
<Compile Include="Email.cs" />
<Compile Include="ITeamFoundationEmailClient.cs" />
<Compile Include="Iteration.cs" />
+ <Compile Include="MachineType.cs" />
<Compile Include="Priority.cs" />
<Compile Include="Project.cs" />
<Compile Include="ResolvedReason.cs" />
@@ -266,7 +267,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/Tango.TFS/TeamFoundationServiceClient.cs b/Software/Visual_Studio/Tango.TFS/TeamFoundationServiceClient.cs
index 750c5fa58..379dcac2e 100644
--- a/Software/Visual_Studio/Tango.TFS/TeamFoundationServiceClient.cs
+++ b/Software/Visual_Studio/Tango.TFS/TeamFoundationServiceClient.cs
@@ -40,6 +40,7 @@ namespace Tango.TFS
public const String MACHINE_SN = "Custom.MachineSN";
public const String ENVIRONMENT = "Custom.Environment";
public const String LOGGED_IN_USER = "Custom.LoggedInUser";
+ public const String MACHINE_TYPE = "Custom.MachineType";
}
#endregion
@@ -428,6 +429,13 @@ namespace Tango.TFS
});
}
+ patchDocument.Add(new JsonPatchOperation
+ {
+ Operation = Operation.Add,
+ Path = GetExtensionFieldNameForWrite(ExtensionFields.MACHINE_TYPE),
+ Value = workItem.MachineType.ToDescription(),
+ });
+
var resultWorkItem = witClient.CreateWorkItemAsync(patchDocument, project.Name, workItem.Type.ToString(), bypassRules: true).Result;
workItem.ID = resultWorkItem.Id.Value;
@@ -944,6 +952,11 @@ namespace Tango.TFS
workItem.Environment = TryGetField(item.Fields, ExtensionFields.ENVIRONMENT).ToString();
}
+ if (item.Fields.ContainsKey(ExtensionFields.MACHINE_TYPE))
+ {
+ workItem.MachineType = ParseEnumByDescription<MachineType>(item.Fields[ExtensionFields.MACHINE_TYPE].ToString());
+ }
+
workItem.Comment = TryGetField(item.Fields, GetFieldNameForRead(CoreField.History)).ToString();
return workItem;
diff --git a/Software/Visual_Studio/Tango.TFS/WorkItem.cs b/Software/Visual_Studio/Tango.TFS/WorkItem.cs
index 35c2f8669..552a64161 100644
--- a/Software/Visual_Studio/Tango.TFS/WorkItem.cs
+++ b/Software/Visual_Studio/Tango.TFS/WorkItem.cs
@@ -80,6 +80,13 @@ namespace Tango.TFS
set { _priority = value; RaisePropertyChangedAuto(); }
}
+ private MachineType _machineType;
+ public MachineType MachineType
+ {
+ get { return _machineType; }
+ set { _machineType = value; RaisePropertyChangedAuto(); }
+ }
+
private String _stepsToReproduce;
public String StepsToReproduce
{