} // end method InitialiseDataGrid /// <summary> /// Initialise component properties. /// </summary> private void InitialiseTab() { _strikePriceVolumeDataProcessor = new StrikePriceVolumeDataProcessor(); _strikePriceTotalVolumeViewModel = new StrikePriceTotalVolumeViewModel(); _volumeUnitViewModel = new VolumeUnitViewModel(); TextBoxSymbol.AutoCompleteSource = _stockSymbolNameViewModel.StockSymbolNameRecords; // Set the auto-complete data source of the text box for the symbol. // Set the specified property values of the data pickers. DatePickerStartDate.CultureInfo = new CultureInfo(Properties.Settings.Default.CultureInfo); DatePickerEndDate.CultureInfo = new CultureInfo(Properties.Settings.Default.CultureInfo); // Set the specified property values of the data grid. DataGridStrikePriceVolumeTable.FilterItemsPopulating += DataGridStrikePriceVolumeTable_FilterItemsPopulating; DataGridStrikePriceVolumeTable.PrintSettings.AllowColumnWidthFitToPrintPage = false; DataGridStrikePriceVolumeTable.PrintSettings.AllowPrintByDrawing = false; DataGridStrikePriceVolumeTable.PrintSettings.AllowPrintStyles = false; DataGridStrikePriceVolumeTable.PrintSettings.AllowRepeatHeaders = true; DataGridStrikePriceVolumeTable.PrintSettings.CanPrintStackedHeaders = true; DataGridStrikePriceVolumeTable.PrintSettings.PrintHeaderRowHeight = 40; // Customise header rows' height to show day volume headers completely. DataGridStrikePriceVolumeTable.PrintSettings.PrintPageFooterHeight = Properties.Settings.Default.ContentTextFontSize; DataGridStrikePriceVolumeTable.PrintSettings.PrintPageFooterTemplate = Application.Current.Resources["PrintedPageFooterTemplate"] as DataTemplate; DataGridStrikePriceVolumeTable.PrintSettings.PrintPreviewWindowStyle = Application.Current.Resources["PrintPreviewWindowStyle"] as Style; DataGridStrikePriceVolumeTable.QueryUnboundColumnValue += DataGridStrikePriceVolumeTable_QueryUnboundColumnValue; ColumnStrikePrice.HeaderText += "\n" + Properties.Resources.LeftBracket + Properties.Resources.PriceUnit + Properties.Resources.RightBracket; ColumnStrikePrice.MaximumWidth = Properties.Settings.Default.MaxCellWidth; ColumnStrikePrice.MinimumWidth = Properties.Settings.Default.MinCellWidth; ColumnTotalVolume.MaximumWidth = Properties.Settings.Default.MaxCellWidth; ColumnTotalVolume.MinimumWidth = Properties.Settings.Default.MinCellWidth; _excelExportingOptions = new ExcelExportingOptions { ExportStackedHeaders = true, ExportingEventHandler = ExcelExportingHandler }; // Set options for exporting to Excel. } // end method InitialiseTab
} // end method InitialiseGeneral /// <summary> /// Initialise the table part. /// </summary> private void InitialiseTable() { var tableColumnSettingsExplanation = Properties.Resources.DayVolume + Properties.Resources.TableColumnSettings_Explanation; // Sorting setting. TextBlockSortingExplanation.Text += tableColumnSettingsExplanation; CheckListBoxItemStrikePriceSorting.Content += Properties.Resources.LeftBracket + Properties.Resources.DefaultSettingValue + (Properties.DefaultUserSettings.Default.StrikePriceSorting ? Properties.Resources.Checked : Properties.Resources.Unchecked) + Properties.Resources.RightBracket; CheckListBoxItemTotalVolumeSorting.Content += Properties.Resources.LeftBracket + Properties.Resources.DefaultSettingValue + (Properties.DefaultUserSettings.Default.TotalVolumeSorting ? Properties.Resources.Checked : Properties.Resources.Unchecked) + Properties.Resources.RightBracket; CheckListBoxItemDayVolumeSorting.Content += Properties.Resources.LeftBracket + Properties.Resources.DefaultSettingValue + (Properties.DefaultUserSettings.Default.DayVolumeSorting ? Properties.Resources.Checked : Properties.Resources.Unchecked) + Properties.Resources.RightBracket; // Filtering setting. TextBlockFilteringExplanation.Text += tableColumnSettingsExplanation; CheckListBoxItemStrikePriceFiltering.Content += Properties.Resources.LeftBracket + Properties.Resources.DefaultSettingValue + (Properties.DefaultUserSettings.Default.StrikePriceFiltering ? Properties.Resources.Checked : Properties.Resources.Unchecked) + Properties.Resources.RightBracket; CheckListBoxItemTotalVolumeFiltering.Content += Properties.Resources.LeftBracket + Properties.Resources.DefaultSettingValue + (Properties.DefaultUserSettings.Default.TotalVolumeFiltering ? Properties.Resources.Checked : Properties.Resources.Unchecked) + Properties.Resources.RightBracket; CheckListBoxItemDayVolumeFiltering.Content += Properties.Resources.LeftBracket + Properties.Resources.DefaultSettingValue + (Properties.DefaultUserSettings.Default.DayVolumeFiltering ? Properties.Resources.Checked : Properties.Resources.Unchecked) + Properties.Resources.RightBracket; // Volume unit setting. var volumeUnitViewModel = new VolumeUnitViewModel(); TextBlockTotalVolumeUnit.Text += Properties.Resources.LeftBracket + Properties.Resources.DefaultSettingValue + volumeUnitViewModel.VolumeUnitRecords.First(item => item.Coefficient == Properties.DefaultUserSettings.Default.TotalVolumeUnit).Name + Properties.Resources.RightBracket + Properties.Resources.Colon; TextBlockDayVolumeUnit.Text += Properties.Resources.LeftBracket + Properties.Resources.DefaultSettingValue + volumeUnitViewModel.VolumeUnitRecords.First(item => item.Coefficient == Properties.DefaultUserSettings.Default.DayVolumeUnit).Name + Properties.Resources.RightBracket + Properties.Resources.Colon; ComboBoxTotalVolumeUnit.ItemsSource = volumeUnitViewModel.VolumeUnitRecords; ComboBoxTotalVolumeUnit.SelectedItem = volumeUnitViewModel.VolumeUnitRecords.First(item => item.Coefficient == Properties.Settings.Default.TotalVolumeUnit); ComboBoxDayVolumeUnit.ItemsSource = volumeUnitViewModel.VolumeUnitRecords; ComboBoxDayVolumeUnit.SelectedItem = volumeUnitViewModel.VolumeUnitRecords.First(item => item.Coefficient == Properties.Settings.Default.DayVolumeUnit); // Volume decimal digits setting. TextBlockTotalVolumeDecimalDigits.Text += Properties.Resources.LeftBracket + Properties.Resources.DefaultSettingValue + Properties.DefaultUserSettings.Default.TotalVolumeDecimalDigits + Properties.Resources.RightBracket + Properties.Resources.Colon; TextBlockDayVolumeDecimalDigits.Text += Properties.Resources.LeftBracket + Properties.Resources.DefaultSettingValue + Properties.DefaultUserSettings.Default.DayVolumeDecimalDigits + Properties.Resources.RightBracket + Properties.Resources.Colon; var volumeDecimalDigitsArray = new[] {"0", "1", "2", "3", "4", "5", "6"}; ComboBoxTotalVolumeDecimalDigits.ItemsSource = volumeDecimalDigitsArray; ComboBoxTotalVolumeDecimalDigits.SelectedIndex = Properties.Settings.Default.TotalVolumeDecimalDigits; ComboBoxDayVolumeDecimalDigits.ItemsSource = volumeDecimalDigitsArray; ComboBoxDayVolumeDecimalDigits.SelectedIndex = Properties.Settings.Default.DayVolumeDecimalDigits; } // end method InitialiseTable