/// <summary>
 /// Initializes a new instance of <seealso cref="ErrorFrameTooltipViewModel"/> class.
 /// </summary>
 /// <param name="errorItem">The error item the tooltip shows.</param>
 public ErrorFrameTooltipViewModel(ErrorGroupItem errorItem)
 {
     OnCloseButtonCommand          = new ProtectedCommand(ShowTooltipUtils.HideTooltip);
     OnBackToErrorReportingCommand = new ProtectedCommand(
         () => ToolWindowCommandUtils.ShowToolWindow <ErrorReportingDetailToolWindow>());
     Error = errorItem;
 }
Esempio n. 2
0
        private void NavigateToDetailWindow(ErrorGroupItem groupItem)
        {
            var window = ToolWindowCommandUtils.ShowToolWindow <ErrorReportingDetailToolWindow>();

            window.ViewModel.UpdateView(groupItem, _selectedTimeRange);

            EventsReporterWrapper.ReportEvent(ErrorsViewerNavigateToDetailWindowEvent.Create());
        }
        private async Task NavigateToDetailWindowAsync(ErrorGroupItem groupItem)
        {
            ErrorReportingDetailToolWindow window =
                await ToolWindowCommandUtils.ShowToolWindowAsync <ErrorReportingDetailToolWindow>();

            window.ViewModel.UpdateView(groupItem, _selectedTimeRange);

            EventsReporterWrapper.ReportEvent(ErrorsViewerNavigateToDetailWindowEvent.Create());
        }
        /// <summary>
        /// Load new even group data.
        /// </summary>
        private async Task UpdateEventGroupAsync()
        {
            if (GroupItem == null)
            {
                throw new ErrorReportingException("GroupItem is null.");
            }

            // In most cases, it is because Project id is null
            if (DataSource == null)
            {
                return;
            }

            IsGroupLoading = true;
            ShowError      = false;
            try
            {
                var groups = await DataSource?.GetPageOfGroupStatusAsync(
                    SelectedTimeRangeItem.GroupTimeRange,
                    SelectedTimeRangeItem.TimedCountDuration,
                    GroupItem.ErrorGroup.Group.GroupId);

                if (groups?.ErrorGroupStats != null && groups.ErrorGroupStats.Count > 0)
                {
                    GroupItem = new ErrorGroupItem(groups.ErrorGroupStats.FirstOrDefault(), SelectedTimeRangeItem);
                }
                else
                {
                    GroupItem.SetCountEmpty();
                    RaisePropertyChanged(nameof(GroupItem));
                }
            }
            catch (DataSourceException)
            {
                ShowError   = true;
                ErrorString = Resources.ErrorReportingDataSourceGenericErrorMessage;
            }
            catch (ErrorReportingException)
            {
                ShowError   = true;
                ErrorString = Resources.ErrorReportingInternalCodeErrorGenericMessage;
            }
            finally
            {
                IsGroupLoading = false;
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Update detail view with a new <paramref name="errorGroupItem"/>.
        /// </summary>
        /// <param name="errorGroupItem">The error group item showing in the detail view.</param>
        /// <param name="groupSelectedTimeRangeItem">The selected time range.</param>
        public void UpdateView(ErrorGroupItem errorGroupItem, TimeRangeItem groupSelectedTimeRangeItem)
        {
            if (errorGroupItem == null)
            {
                throw new ErrorReportingException(new ArgumentNullException(nameof(errorGroupItem)));
            }
            if (groupSelectedTimeRangeItem == null)
            {
                throw new ErrorReportingException(new ArgumentNullException(nameof(groupSelectedTimeRangeItem)));
            }

            IsAccountChanged = false;
            GroupItem        = errorGroupItem;
            if (groupSelectedTimeRangeItem.GroupTimeRange == SelectedTimeRangeItem?.GroupTimeRange)
            {
                ErrorHandlerUtils.HandleAsyncExceptions(UpdateEventAsync);
            }
            else
            {
                // This will triger a call to UpdateGroupAndEventAsync().
                SelectedTimeRangeItem = AllTimeRangeItems.First(x => x.GroupTimeRange == groupSelectedTimeRangeItem.GroupTimeRange);
            }
        }
Esempio n. 6
0
        private void NavigateToDetailWindow(ErrorGroupItem groupItem)
        {
            var window = ToolWindowCommandUtils.ShowToolWindow <ErrorReportingDetailToolWindow>();

            window.ViewModel.UpdateView(groupItem, _selectedTimeRange);
        }