Пример #1
0
        /// <summary>
        /// Properties window for an event package
        /// </summary>
        /// <param name="eventPackage">The event package</param>
        /// <param name="clientLogic">Client Logic</param>
        public EventProperties(DisplayEventPackage eventPackage, ClientLogic clientLogic)
        {
            if (eventPackage == null)
            {
                throw new ArgumentNullException("eventPackage");
            }
            if (clientLogic == null)
            {
                throw new ArgumentNullException("clientLogic");
            }

            _eventPackage = eventPackage;
            _clientLogic  = clientLogic;

            InitializeComponent();

            if (!DesignerProperties.GetIsInDesignMode(this))
            {
                if (UserSettings.Settings.HaveWindow(WindowKey))
                {
                    UserSettings.Settings.RestoreWindow(WindowKey, this);
                }

                UserSettings.Settings.RestoreGridView(ListViewRawEventSignatureKey, listViewRawEventSignature.View as GridView);
                _listViewSorter = new ListViewSorter(listViewRawEventSignature);
                _listViewSorter.AddDefaultSort("Name", ListSortDirection.Ascending);
                _listViewSorter.AddDefaultSort("Value", ListSortDirection.Ascending);
            }
        }
Пример #2
0
 /// <summary>
 /// Selects an event package and optionally shows the event details
 /// </summary>
 /// <param name="eventPackage">DisplayEventPackage to select</param>
 /// <param name="showDetails">True if the event details view should be loaded</param>
 public void SelectAndShowEventDetails(DisplayEventPackage eventPackage, bool showDetails)
 {
     listViewEvents.SelectedItem = eventPackage;
     if (showDetails)
     {
         ShowSelectedEventDetails();
     }
 }
Пример #3
0
        private void menuItemCopyEventUrl_Click(object sender, RoutedEventArgs e)
        {
            DisplayEventPackage eventPackage = listViewEvents.SelectedItem as DisplayEventPackage;

            if (eventPackage != null)
            {
                Clipboard.SetText(StackHashUri.CreateUriString(UserSettings.Settings.CurrentContextId,
                                                               eventPackage.ProductId,
                                                               eventPackage.Id,
                                                               eventPackage.EventTypeName));
            }
        }
Пример #4
0
        private void SetEventBugIdCore(TextBox textBox)
        {
            DisplayEventPackage eventPackage = listViewEvents.SelectedItem as DisplayEventPackage;
            ClientLogic         clientLogic  = this.DataContext as ClientLogic;

            if ((textBox != null) && (eventPackage != null) && (clientLogic != null))
            {
                if (textBox.Text != eventPackage.BugId)
                {
                    eventPackage.BugId = textBox.Text;
                    clientLogic.SetEventBugId(eventPackage, textBox.Text);
                }
            }
        }
Пример #5
0
        private void menuitemOpenEventPage_Click(object sender, RoutedEventArgs e)
        {
            DisplayEventPackage eventPackage = listViewEvents.SelectedItem as DisplayEventPackage;

            if (eventPackage != null)
            {
                string eventDetailsUrl = string.Format(CultureInfo.InvariantCulture,
                                                       Properties.Settings.Default.WinQualEventDetailsTemplate,
                                                       eventPackage.Id,
                                                       eventPackage.EventTypeName);

                DefaultBrowser.OpenUrlInInternetExplorer(eventDetailsUrl);
            }
        }
Пример #6
0
        private void commandBindingProperties_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            DisplayEventPackage eventPackage = listViewEvents.SelectedItem as DisplayEventPackage;

            if (eventPackage != null)
            {
                ClientLogic clientLogic = this.DataContext as ClientLogic;
                Debug.Assert(clientLogic != null);

                EventProperties eventProperties = new EventProperties(eventPackage, clientLogic);
                eventProperties.Owner = Window.GetWindow(this);
                eventProperties.ShowDialog();

                listViewEvents.Items.Refresh();
            }
        }
Пример #7
0
        private void ShowSelectedEventDetails()
        {
            // set current event package and switch views
            ClientLogic clientLogic = this.DataContext as ClientLogic;

            Debug.Assert(clientLogic != null);

            DisplayEventPackage eventPackage = listViewEvents.SelectedItem as DisplayEventPackage;

            if (eventPackage != null)
            {
                clientLogic.CurrentEventPackage = eventPackage;
                clientLogic.GetEventNotes();
                clientLogic.CurrentView = ClientLogicView.EventDetail;
            }
        }
Пример #8
0
        private void comboBoxStatus_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            DisplayEventPackage eventPackage = listViewEvents.SelectedItem as DisplayEventPackage;
            ComboBox            comboBox     = e.OriginalSource as ComboBox;
            ClientLogic         clientLogic  = this.DataContext as ClientLogic;

            if ((comboBox != null) && (eventPackage != null) && (clientLogic != null))
            {
                DisplayMapping workFlowMapping = comboBox.SelectedItem as DisplayMapping;
                if (workFlowMapping != null)
                {
                    if (workFlowMapping.Id != eventPackage.WorkFlowStatus)
                    {
                        eventPackage.WorkFlowStatus = workFlowMapping.Id;
                        clientLogic.SetEventWorkFlow(eventPackage, workFlowMapping.Id);
                    }
                }
            }
        }
Пример #9
0
        private void menuItemSendEventToPlugin_Click(object sender, RoutedEventArgs e)
        {
            ClientLogic clientLogic = this.DataContext as ClientLogic;

            Debug.Assert(clientLogic != null);

            MenuItem menuItem = e.OriginalSource as MenuItem;

            if (menuItem != null)
            {
                StackHashBugTrackerPlugIn plugin = menuItem.Tag as StackHashBugTrackerPlugIn;
                if (plugin != null)
                {
                    DisplayEventPackage eventPackage = listViewEvents.SelectedItem as DisplayEventPackage;
                    if (eventPackage != null)
                    {
                        clientLogic.SendEventToPlugin(eventPackage, plugin.Name);
                    }
                }
            }
        }
Пример #10
0
        private void listViewEvents_ContextMenuOpening(object sender, ContextMenuEventArgs e)
        {
            ClientLogic clientLogic = this.DataContext as ClientLogic;

            Debug.Assert(clientLogic != null);

            DisplayEventPackage eventPackage = listViewEvents.SelectedItem as DisplayEventPackage;

            if (eventPackage != null)
            {
                menuitemOpenEventPage.IsEnabled     = true;
                menuItemSendEventToPlugin.IsEnabled = ((clientLogic.ActivePlugins != null) && (clientLogic.ActivePlugins.Count > 0) && (!clientLogic.PluginHasError));
                menuItemCopyEventUrl.IsEnabled      = true;
            }
            else
            {
                menuitemOpenEventPage.IsEnabled     = false;
                menuItemSendEventToPlugin.IsEnabled = false;
                menuItemCopyEventUrl.IsEnabled      = false;
            }
        }
Пример #11
0
        private void textBoxReference_KeyDown(object sender, KeyEventArgs e)
        {
            TextBox textBox = e.OriginalSource as TextBox;

            if (textBox != null)
            {
                if ((e.Key == Key.Return) || (e.Key == Key.Enter))
                {
                    SetEventBugIdCore(textBox);
                    e.Handled = true;
                }
                else if (e.Key == Key.Escape)
                {
                    DisplayEventPackage eventPackage = listViewEvents.SelectedItem as DisplayEventPackage;
                    if ((eventPackage != null) && (eventPackage.BugId != null))
                    {
                        textBox.Text = eventPackage.BugId;
                        e.Handled    = true;
                    }
                }
            }
        }
Пример #12
0
        private void listViewEvents_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ClientLogic clientLogic = this.DataContext as ClientLogic;

            Debug.Assert(clientLogic != null);

            // update charts
            DisplayEventPackage eventPackage = listViewEvents.SelectedItem as DisplayEventPackage;

            if (eventPackage != null)
            {
                clientLogic.CurrentEventPackage = eventPackage;

                // !!! optimize this and other charts by calculating in ClientLogic (or even in the service)
                Dictionary <string, ulong>   operatingSystemBreakout = new Dictionary <string, ulong>();
                Dictionary <string, ulong>   languageBreakout        = new Dictionary <string, ulong>();
                Dictionary <DateTime, ulong> hitDateBreakout         = new Dictionary <DateTime, ulong>();

                foreach (DisplayEventInfo eventInfo in eventPackage.EventInfoList)
                {
                    if (operatingSystemBreakout.ContainsKey(eventInfo.OperatingSystemName))
                    {
                        operatingSystemBreakout[eventInfo.OperatingSystemName] += (ulong)eventInfo.TotalHits;
                    }
                    else
                    {
                        operatingSystemBreakout.Add(eventInfo.OperatingSystemName, (ulong)eventInfo.TotalHits);
                    }

                    if (languageBreakout.ContainsKey(eventInfo.Language))
                    {
                        languageBreakout[eventInfo.Language] += (ulong)eventInfo.TotalHits;
                    }
                    else
                    {
                        languageBreakout.Add(eventInfo.Language, (ulong)eventInfo.TotalHits);
                    }

                    // make sure we key on just year/month/day
                    DateTime hitDate = new DateTime(eventInfo.HitDateLocal.Year,
                                                    eventInfo.HitDateLocal.Month,
                                                    eventInfo.HitDateLocal.Day);
                    if (hitDateBreakout.ContainsKey(hitDate))
                    {
                        hitDateBreakout[hitDate] += (ulong)eventInfo.TotalHits;
                    }
                    else
                    {
                        hitDateBreakout.Add(hitDate, (ulong)eventInfo.TotalHits);
                    }
                }

                List <PieChartDataPoint> pieChartOSData = new List <PieChartDataPoint>(operatingSystemBreakout.Count);
                foreach (string key in operatingSystemBreakout.Keys)
                {
                    pieChartOSData.Add(new PieChartDataPoint(operatingSystemBreakout[key],
                                                             key));
                }

                pieChartOs.SetData(pieChartOSData);

                List <PieChartDataPoint> pieChartLanguageData = new List <PieChartDataPoint>(operatingSystemBreakout.Count);
                foreach (string key in languageBreakout.Keys)
                {
                    pieChartLanguageData.Add(new PieChartDataPoint(languageBreakout[key],
                                                                   key));
                }

                pieChartLang.SetData(pieChartLanguageData);

                dateChartHits.SetData(hitDateBreakout);
            }
            else
            {
                clientLogic.CurrentEventPackage = null;

                pieChartLang.ClearData();
                pieChartOs.ClearData();
                dateChartHits.ClearData();
            }
        }