예제 #1
0
        /// <summary>
        /// Generate Traceability Matrix Report
        /// </summary>
        /// <param name="project">
        /// Project Name
        /// </param>
        public void GenerateMatrix(string project)
        {
            var popup = new MatrixReport();
            InitMatrixPopUp(popup, project);

            popup.Create(null, Icons.TraceabilityMatrix);

            if (!popup.IsCanceled)
            {
                matrixReportData.ColumnsTypesSelectedItem = popup.HorizontalTypes.SelectedItem.ToString();
                matrixReportData.RowsTypesSelectedItem = popup.VerticalTypes.SelectedItem.ToString();
                matrixReportData.RelatedSelectedItem = popup.Relateds.SelectedItem.ToString();

                if (popup.chkIncludeNotLinked.IsChecked != null)
                {
                    matrixReportData.IncludeNotLinkedItems = popup.chkIncludeNotLinked.IsChecked.Value;
                }
   
                matrixReportData.DateFrom = popup.dateFrom.SelectedDate;
                matrixReportData.DateTo = popup.dateTo.SelectedDate;
                matrixReportData.StateColumnsSelectedItem = popup.GetSelectedStates(popup.StateHorisontal);
                matrixReportData.StateRowsSelectedItem = popup.GetSelectedStates(popup.StateVertical);

                progressDialog = new ProgressDialog();
                string uiCulture = Thread.CurrentThread.CurrentUICulture.ToString();
                progressDialog.Execute(
                    (cancelTokenSource) =>
                        {
                            Thread.CurrentThread.CurrentUICulture = new CultureInfo(uiCulture);
                            cancellationTokenSource = cancelTokenSource;
                            var workItemsInColumn = new List<WorkItem>();
                            var workItemsInRow = new List<WorkItem>();
                            if (!cancellationTokenSource.IsCancellationRequested)
                            {
                                progressDialog.UpdateProgress(0, ResourceHelper.GetResourceString("MSG_RETRIEVING_DATA"), true);

                                MatrixData data = GetItemsByMatrixFilter(project);

                                workItemsInRow = data.Rows;
                                workItemsInColumn = data.Columns;

                                if (workItemsInRow.Count == 0 || workItemsInColumn.Count == 0)
                                {
                                    MessageBox.Show(ResourceHelper.GetResourceString("MSG_DATA_NOT_AVAILABLE"), string.Empty, MessageBoxButton.OK, MessageBoxImage.Information);
                                    return;
                                }

                                workItemsInRow.Sort((x, y) => x.Id.CompareTo(y.Id));
                                workItemsInColumn.Sort((x, y) => x.Id.CompareTo(y.Id));

                                DrawMatrixReport(project, workItemsInRow, workItemsInColumn);
                            }
                        });

                progressDialog.Create(string.Format(ResourceHelper.GetResourceString("MSG_TRACEBILITY_MATRIX"), project), Icons.TraceabilityMatrix);
            }
        }
예제 #2
0
        /// <summary>
        /// Init Matrix Report popup with default values.
        /// </summary>
        /// <param name="popup">
        /// MatrixReport
        /// </param>
        /// <param name="project">
        /// project name
        /// </param>
        private void InitMatrixPopUp(MatrixReport popup, string project)
        {
            Project proj = tfsManager.GetProject(project);
            List<WorkItemType> types = proj.WorkItemTypes.Cast<WorkItemType>().OrderBy(f => f.Name).ToList();
            IEnumerable<string> itemTypes = types.Where(f => f.Name != "Code Review Request" && f.Name != "Code Review Response" && f.Name != "Feedback Request" && f.Name != "Feedback Response" && f.Name != "Shared Steps").Select(f => f.Name);
            itemTypes = itemTypes.Where(f => f != "Запрос на проверку кода" && f != "Ответ на проверку кода" && f != "Ответ на отзыв" && f != "Запрос отзыва" && f != "Общие шаги").Select(f => f);
            popup.HorizontalTypes.SelectionChanged += (s, a) =>
                {
                    if (popup.HorizontalTypes.SelectedValue != null)
                    {
                        List<string> states = tfsManager.GetWorkItemStatesByType(project, popup.HorizontalTypes.SelectedValue.ToString());
                        popup.InitStateValues(popup.StateHorisontal, states);
                    }
                };
            popup.VerticalTypes.SelectionChanged += (s, a) =>
                {
                    if (popup.HorizontalTypes.SelectedValue != null)
                    {
                        List<string> states = tfsManager.GetWorkItemStatesByType(project, popup.VerticalTypes.SelectedValue.ToString());
                        popup.InitStateValues(popup.StateVertical, states);
                    }
                };
            popup.HorizontalTypes.ItemsSource = itemTypes;
            popup.HorizontalTypes.SelectedItem = 0;
            popup.VerticalTypes.ItemsSource = itemTypes;
            popup.VerticalTypes.SelectedIndex = 0;

            List<string> wiLinkTypes = proj.Store.WorkItemLinkTypes.Select(f => f.ForwardEnd.Name).ToList();
            wiLinkTypes.AddRange(proj.Store.WorkItemLinkTypes.Select(f => f.ReverseEnd.Name));
            wiLinkTypes = wiLinkTypes.OrderBy(f => f).Distinct().ToList();
            wiLinkTypes.Insert(0, ResourceHelper.GetResourceString("ALL"));
            popup.Relateds.Items.Clear();
            popup.Relateds.ItemsSource = wiLinkTypes;
            popup.Relateds.SelectedIndex = 0;
        }