From 2a21fe4c9ac87cceed96a03d5ff5ff1aa0d64016 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 7 Feb 2019 17:19:25 +0200 Subject: Fixed and improved bug reporting in machine studio. --- .../Views/ReportIssueView.xaml | 27 ++++++++- .../Views/ReportIssueView.xaml.cs | 64 ++++++++++++++++++++++ 2 files changed, 88 insertions(+), 3 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views') 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 7387c4ae5..5f5e1042b 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml @@ -35,7 +35,7 @@ - + @@ -50,7 +50,28 @@ - + + + + + + + + + + + + + + + + + + + + + + @@ -101,7 +122,7 @@ - + diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml.cs index 72bef1205..b6e701841 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml.cs @@ -12,6 +12,8 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.MachineStudio.UI.ViewModels; +using Tango.TFS; namespace Tango.MachineStudio.UI.Views { @@ -20,16 +22,78 @@ namespace Tango.MachineStudio.UI.Views /// public partial class ReportIssueView : UserControl { + private ReportIssueViewVM _vm; + public ReportIssueView() { InitializeComponent(); this.Loaded += ReportIssueView_Loaded; + this.DataContextChanged += ReportIssueView_DataContextChanged; + } + + private void ReportIssueView_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) + { + _vm = this.DataContext as ReportIssueViewVM; } private void ReportIssueView_Loaded(object sender, RoutedEventArgs e) { txt_title.Focus(); } + + private void TreeView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs e) + { + _vm.WorkItem.Area = e.NewValue as Area; + toggleArea.IsChecked = false; + } + + private TreeView tree; + + private void TreeView_Loaded(object sender, RoutedEventArgs e) + { + tree = sender as TreeView; + tree.ItemContainerGenerator.StatusChanged += ItemContainerGenerator_StatusChanged; + } + + private void ItemContainerGenerator_StatusChanged(object sender, EventArgs e) + { + if (tree.ItemContainerGenerator.Status == System.Windows.Controls.Primitives.GeneratorStatus.ContainersGenerated) + { + TreeViewItem i = tree.ItemContainerGenerator.ContainerFromIndex(0) as TreeViewItem; + i.IsExpanded = true; + } + } + + static TreeViewItem GetTreeViewItem(ItemsControl parent, object item, bool isExpanded) + { + if (item is TreeViewItem tvi) + return tvi; + + var result = ContainerFromItem(parent, item); + if (result == null && isExpanded) + { + parent.UpdateLayout(); + result = ContainerFromItem(parent, item); + } + return result; + } + + static TreeViewItem ContainerFromItem(ItemsControl parent, object item) => (TreeViewItem)parent.ItemContainerGenerator.ContainerFromItem(item); + + void SelectTreeViewItem(TreeView treeView, TreeViewItem Item) + { + Item.IsExpanded = Item.DataContext == areaCombo.SelectedItem; + + foreach (var item in Item.Items) + { + var i = GetTreeViewItem(treeView, item, false); + + i.IsExpanded = i.DataContext == areaCombo.SelectedItem; + + if (i.HasItems) + SelectTreeViewItem(treeView, i); + } + } } } -- cgit v1.3.1 From 340de72c8da0c0a5a661664f7fa26f756e43a15a Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 7 Feb 2019 17:44:48 +0200 Subject: Improved bug reporting in machine studio. --- Software/DB/PPC/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/PPC/Tango_log.ldf | Bin 53673984 -> 53673984 bytes Software/DB/Tango.mdf | Bin 75497472 -> 75497472 bytes Software/DB/Tango_log.ldf | Bin 22675456 -> 22675456 bytes .../Build/Shortcuts/Machine Studio.lnk | Bin 1516 -> 1516 bytes .../Properties/AssemblyInfo.cs | 2 +- .../ViewModels/ReportIssueViewVM.cs | 2 +- .../Views/ReportIssueView.xaml.cs | 31 --------------------- Software/Visual_Studio/Tango.TFS/Project.cs | 22 +++++++++++++++ 9 files changed, 24 insertions(+), 33 deletions(-) (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views') diff --git a/Software/DB/PPC/Tango.mdf b/Software/DB/PPC/Tango.mdf index 163385c60..06a8a5c42 100644 Binary files a/Software/DB/PPC/Tango.mdf and b/Software/DB/PPC/Tango.mdf differ diff --git a/Software/DB/PPC/Tango_log.ldf b/Software/DB/PPC/Tango_log.ldf index 97b391cde..83a828688 100644 Binary files a/Software/DB/PPC/Tango_log.ldf and b/Software/DB/PPC/Tango_log.ldf differ diff --git a/Software/DB/Tango.mdf b/Software/DB/Tango.mdf index 7c71ba79c..e95b77f75 100644 Binary files a/Software/DB/Tango.mdf and b/Software/DB/Tango.mdf differ diff --git a/Software/DB/Tango_log.ldf b/Software/DB/Tango_log.ldf index c71484957..b89a66e7d 100644 Binary files a/Software/DB/Tango_log.ldf and b/Software/DB/Tango_log.ldf differ diff --git a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk index 35386360d..3e9b1c933 100644 Binary files a/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk and b/Software/Visual_Studio/Build/Shortcuts/Machine Studio.lnk differ diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs index c61e58fd8..c8a6d47c3 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ using System.Runtime.InteropServices; [assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)] [assembly: AssemblyTitle("Tango - Machine Studio")] -[assembly: AssemblyVersion("4.0.3.0")] +[assembly: AssemblyVersion("4.0.4.0")] [assembly: ComVisible(false)] \ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ReportIssueViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ReportIssueViewVM.cs index 21330a4fc..6df5fc4bc 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ReportIssueViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/ReportIssueViewVM.cs @@ -47,7 +47,7 @@ namespace Tango.MachineStudio.UI.ViewModels Project = project; WorkItem = workItem; - var area = project.Areas.FirstOrDefault(x => x.Name == _settings.DefaultIssueReportArea); + var area = project.GetAreaByName(_settings.DefaultIssueReportArea); if (area != null) { workItem.Area = area; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml.cs index b6e701841..e17ed7d93 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/ReportIssueView.xaml.cs @@ -64,36 +64,5 @@ namespace Tango.MachineStudio.UI.Views i.IsExpanded = true; } } - - static TreeViewItem GetTreeViewItem(ItemsControl parent, object item, bool isExpanded) - { - if (item is TreeViewItem tvi) - return tvi; - - var result = ContainerFromItem(parent, item); - if (result == null && isExpanded) - { - parent.UpdateLayout(); - result = ContainerFromItem(parent, item); - } - return result; - } - - static TreeViewItem ContainerFromItem(ItemsControl parent, object item) => (TreeViewItem)parent.ItemContainerGenerator.ContainerFromItem(item); - - void SelectTreeViewItem(TreeView treeView, TreeViewItem Item) - { - Item.IsExpanded = Item.DataContext == areaCombo.SelectedItem; - - foreach (var item in Item.Items) - { - var i = GetTreeViewItem(treeView, item, false); - - i.IsExpanded = i.DataContext == areaCombo.SelectedItem; - - if (i.HasItems) - SelectTreeViewItem(treeView, i); - } - } } } diff --git a/Software/Visual_Studio/Tango.TFS/Project.cs b/Software/Visual_Studio/Tango.TFS/Project.cs index b3584ca23..b48d3b701 100644 --- a/Software/Visual_Studio/Tango.TFS/Project.cs +++ b/Software/Visual_Studio/Tango.TFS/Project.cs @@ -18,6 +18,28 @@ namespace Tango.TFS public List Members { get; set; } public List Tags { get; set; } + public Area GetAreaByName(String name) + { + return GetAreaByName(Areas, name); + } + + private Area GetAreaByName(List areas, String name) + { + foreach (var area in areas) + { + if (area.Name == name) return area; + + var a = GetAreaByName(area.SubAreas, name); + + if (a != null) + { + return a; + } + } + + return null; + } + public Project() { Areas = new List(); -- cgit v1.3.1