예제 #1
0
        private void listViewProducts_ContextMenuOpening(object sender, ContextMenuEventArgs e)
        {
            DisplayProduct productInfo = listViewProducts.SelectedItem as DisplayProduct;

            if (productInfo != null)
            {
                // set appropriate text
                menuItemToggleSyncEnabled.IsEnabled   = true;
                menuItemToggleSyncEnabled.Header      = productInfo.SynchronizeEnabled ? Properties.Resources.DisableSync : Properties.Resources.EnableSync;
                menuItemOpenProductPage.IsEnabled     = true;
                menuItemSendProductToPlugin.IsEnabled = productInfo.SynchronizeEnabled;
                menuItemCopyProductUrl.IsEnabled      = productInfo.SynchronizeEnabled;
                menuItemClearSelection.IsEnabled      = true;
            }
            else
            {
                // no selection
                menuItemToggleSyncEnabled.IsEnabled   = false;
                menuItemToggleSyncEnabled.Header      = Properties.Resources.EnableSync;
                menuItemOpenProductPage.IsEnabled     = false;
                menuItemSendProductToPlugin.IsEnabled = false;
                menuItemCopyProductUrl.IsEnabled      = false;
                menuItemClearSelection.IsEnabled      = false;
            }
        }
예제 #2
0
        private void ListEvents()
        {
            // make sure we have the right event list
            DisplayProduct product = listViewProducts.SelectedItem as DisplayProduct;

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

                    clientLogic.PopulateEventPackages(product,
                                                      null,
                                                      clientLogic.LastEventsSort,
                                                      1,
                                                      UserSettings.Settings.EventPageSize,
                                                      UserSettings.Settings.GetDisplayHitThreshold(product.Id),
                                                      ClientLogicView.EventList,
                                                      PageIntention.First,
                                                      UserSettings.Settings.ShowEventsWithoutCabs);
                }
                else
                {
                    StackHashMessageBox.Show(Window.GetWindow(this),
                                             string.Format(CultureInfo.CurrentCulture,
                                                           Properties.Resources.MainProductList_ProductDisabledMBMessage,
                                                           product.NameAndVersion),
                                             Properties.Resources.MainProductList_ProductDisabledMBTitle,
                                             StackHashMessageBoxType.Ok,
                                             StackHashMessageBoxIcon.Information);
                }
            }
        }
예제 #3
0
        private void menuItemCopyProductUrl_Click(object sender, RoutedEventArgs e)
        {
            DisplayProduct productInfo = listViewProducts.SelectedItem as DisplayProduct;

            if (productInfo != null)
            {
                Clipboard.SetText(StackHashUri.CreateUriString(UserSettings.Settings.CurrentContextId, productInfo.Id));
            }
        }
예제 #4
0
        private void menuItemToggleSyncEnabled_Click(object sender, RoutedEventArgs e)
        {
            DisplayProduct productInfo = listViewProducts.SelectedItem as DisplayProduct;

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

                clientLogic.AdminSetProductSyncState(productInfo.Id, !productInfo.SynchronizeEnabled);
                e.Handled = true;
            }
        }
예제 #5
0
        private void CheckBox_Unchecked(object sender, RoutedEventArgs e)
        {
            CheckBox checkBoxSource = e.OriginalSource as CheckBox;

            if (checkBoxSource != null)
            {
                DisplayProduct product = checkBoxSource.DataContext as DisplayProduct;
                if (product != null)
                {
                    this.ClientLogic.AdminSetProductSyncState(product.Id, false);
                    e.Handled = true;
                }
            }
        }
예제 #6
0
        private void menuItemOpenProductPage_Click(object sender, RoutedEventArgs e)
        {
            DisplayProduct productInfo = listViewProducts.SelectedItem as DisplayProduct;

            if (productInfo != null)
            {
                string eventListUrl = string.Format(CultureInfo.InvariantCulture,
                                                    Properties.Settings.Default.WinQualEventListTemplate,
                                                    productInfo.Id,
                                                    productInfo.Name,
                                                    productInfo.Version);

                DefaultBrowser.OpenUrlInInternetExplorer(eventListUrl);
            }
        }
예제 #7
0
        private void commandBindingProperties_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            DisplayProduct product = listViewProducts.SelectedItem as DisplayProduct;

            if (product != null)
            {
                int currentFilter = UserSettings.Settings.GetDisplayHitThreshold(product.Id);

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

                ProductProperties productProperties = new ProductProperties(product, clientLogic);
                productProperties.Owner = Window.GetWindow(this);
                productProperties.ShowDialog();

                listViewProducts.Items.Refresh();
            }
        }
예제 #8
0
        private void TryUpdateCharts()
        {
            DisplayProduct product = listViewProducts.SelectedItem as DisplayProduct;

            if (product != null)
            {
                if (product.LocaleSummary != null)
                {
                    worldMapControl.UpdateMap(product.LocaleSummary);
                }

                if (product.OsSummary != null)
                {
                    List <PieChartDataPoint> pieChartData = new List <PieChartDataPoint>(product.OsSummary.Count);
                    foreach (StackHashProductOperatingSystemSummary os in product.OsSummary)
                    {
                        pieChartData.Add(new PieChartDataPoint(os.TotalHits, os.OperatingSystemName));
                    }
                    pieChartOs.SetData(pieChartData);
                }

                if (product.HitDateSummary != null)
                {
                    Dictionary <DateTime, ulong> hitDateBreakout = new Dictionary <DateTime, ulong>();
                    foreach (StackHashProductHitDateSummary hitDate in product.HitDateSummary)
                    {
                        DateTime hitDateLocal = hitDate.HitDate.ToLocalTime().Date;

                        if (hitDateBreakout.ContainsKey(hitDateLocal))
                        {
                            hitDateBreakout[hitDateLocal] += (ulong)hitDate.TotalHits;
                        }
                        else
                        {
                            hitDateBreakout.Add(hitDateLocal, (ulong)hitDate.TotalHits);
                        }
                    }
                    dateChartHits.SetData(hitDateBreakout);
                }
            }
        }
예제 #9
0
        /// <summary>
        /// Properties window for a product
        /// </summary>
        /// <param name="product">The product</param>
        /// <param name="clientLogic">Client logic</param>
        public ProductProperties(DisplayProduct product, ClientLogic clientLogic)
        {
            if (product == null)
            {
                throw new ArgumentNullException("product");
            }
            if (clientLogic == null)
            {
                throw new ArgumentNullException("clientLogic");
            }

            _product     = product;
            _clientLogic = clientLogic;

            InitializeComponent();

            if (UserSettings.Settings.HaveWindow(WindowKey))
            {
                UserSettings.Settings.RestoreWindow(WindowKey, this);
            }
        }
예제 #10
0
        private void menuItemSendProductToPlugin_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)
                {
                    DisplayProduct productInfo = listViewProducts.SelectedItem as DisplayProduct;
                    if (productInfo != null)
                    {
                        clientLogic.SendProductToPlugin(productInfo, plugin.Name);
                    }
                }
            }
        }
예제 #11
0
 /// <summary>
 /// Selects a product
 /// </summary>
 /// <param name="product">DisplayProduct to select</param>
 public void SelectProduct(DisplayProduct product)
 {
     listViewProducts.SelectedItem = null;
     listViewProducts.SelectedItem = product;
 }