Example #1
0
        // Event handler for clicking the display button
        private void btnDisplay_Click(object sender, RoutedEventArgs e)
        {
            // Create a new TradeTable
            TradeTable = new TradeTable();

            // Attempt to read the csv at the path selected, if it succeeds
            if (TradeTable.ReadCSV(path.Text))
            {
                // Set the data context for the datagrids to the query results
                stockDataGrid.DataContext = TradeTable.GetStockVWAP();
                tradeTypeGrid.DataContext = TradeTable.GetStockPerTradeTypeVWAP();

                // Create a set to contain epics
                HashSet <string> epics = new HashSet <string>();

                // Iterate through the rows of the table
                foreach (DataRow row in TradeTable.Table.Rows)
                {
                    // Add the epic to the set
                    _ = epics.Add(row.ItemArray[0].ToString());
                }

                // Use the epics as the itemsource for the filter list
                filter.ItemsSource = epics;

                // Set visibility for the tabs and the export button
                dataGridTabs.Visibility      = Visibility.Visible;
                btnSelectSavePath.Visibility = Visibility.Visible;
            }
        }
Example #2
0
        // Event handler for when the filter is changed
        private void filter_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            // Get the query for the filter
            DataTable filteredTable = TradeTable.GetFilteredVWAP((string)filter.SelectedValue);

            // If the query failed
            if (filteredTable == null)
            {
                // Hide the grid and chart
                filterGrid.Visibility  = Visibility.Hidden;
                filterChart.Visibility = Visibility.Hidden;
            }
            else
            {
                // Create a new chartdata with the query results
                ChartData = new ChartData <double>(filteredTable);

                // Set the datacontext for the grid and chart
                filterGrid.DataContext  = filteredTable;
                filterChart.DataContext = ChartData;

                // Show the grid and chart
                filterGrid.Visibility  = Visibility.Visible;
                filterChart.Visibility = Visibility.Visible;
            }
        }