/// <summary> /// Browses the report. /// </summary> /// <param name="parm">The parm.</param> private void BrowseReport(object parm) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.AddExtension = true; openFileDialog.InitialDirectory = SampleSourceHelper.GetSamplePath() + @"Common\Data\CubeModelTemplates"; openFileDialog.DefaultExt = "xml"; openFileDialog.Filter = "Report Set (.xml)|*.xml"; openFileDialog.RestoreDirectory = true; bool?openFileDialogResult = openFileDialog.ShowDialog(); if (openFileDialogResult.HasValue && openFileDialogResult.Value) { this.ReportPath = openFileDialog.FileName; this.DataManager.LoadReportDefinitionFile(this.ReportPath); ObservableCollection <string> newList = new ObservableCollection <string>(); foreach (OlapReport item in this.DataManager.Reports) { newList.Add(item.Name); } this.AvailableReportNames = newList; this.SelectedReport = this.DataManager.Reports[0].Name; } else { MessageBox.Show("Report is not in an appropriate format"); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { this.ShowWaitingDialog(); try { olapgrid1.OlapDataManager = olapDataManager; string samplePath = SampleSourceHelper.GetSamplePath() + @"\Common\Data\CubeModelTemplates\ReportDefenitionFile.xml"; this.txtReportFilePath.Text = samplePath; LoadReports(samplePath); } catch (FileNotFoundException ex) { MessageBox.Show(ex.Message, "File not found"); } this.CloseWaitingDialog(); cmbReportSet.SelectedIndex = 1; }
/// <summary> /// Initializes a new instance of the <see cref="ViewModel"/> class. /// </summary> public ViewModel() { this.olapDataManager = new OlapDataManager(ConnectionString); this.olapDataManager.LoadReportDefinitionFile(SampleSourceHelper.GetSamplePath() + @"Common\Data\CubeModelTemplates\ReportDefenitionFile.xml"); this.olapDataManager.LoadReport(this.olapDataManager.Reports[0].Name); }
public Model() { this.SqlQuery = new StringBuilder("Select Country,State,City,Year,Semester,Quarter,Month,Date,ProductCategory,ProductSubCategory,ProductName,Quantity from [Sheet1$]"); try { this.dbConnection = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + SampleSourceHelper.GetSamplePath() + "\\Common\\Data\\Sales DB.xls;Extended Properties=Excel 8.0;"); } catch { //Return } }
protected override void Invoke(object parameter) { var visualBrush = Target.GridBackground as VisualBrush; var panel = ((this.Target.GridBackground as VisualBrush).Visual as Panel); if (panel != null && panel.Children.Count > 1 && panel.Children[0] is Image && panel.Children[1] is TextBlock) { if (parameter is SelectionChangedEventArgs && ((parameter as SelectionChangedEventArgs).Source as ComboBox).Name == "combo_hralign") { string selectedValue = ((parameter as SelectionChangedEventArgs).Source as ComboBox).SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem: ", ""); switch (selectedValue) { case "Left": visualBrush.AlignmentX = AlignmentX.Left; horizontalAlignment = AlignmentX.Left; break; case "Right": visualBrush.AlignmentX = AlignmentX.Right; horizontalAlignment = AlignmentX.Right; break; case "Center": visualBrush.AlignmentX = AlignmentX.Center; horizontalAlignment = AlignmentX.Center; break; } } else if (parameter is SelectionChangedEventArgs && ((parameter as SelectionChangedEventArgs).Source as ComboBox).Name == "combo_vralign") { string selectedValue = ((parameter as SelectionChangedEventArgs).Source as ComboBox).SelectedItem.ToString().Replace("System.Windows.Controls.ComboBoxItem: ", ""); switch (selectedValue) { case "Top": visualBrush.AlignmentY = AlignmentY.Top; verticalAlignment = AlignmentY.Top; break; case "Bottom": visualBrush.AlignmentY = AlignmentY.Bottom; verticalAlignment = AlignmentY.Bottom; break; case "Center": visualBrush.AlignmentY = AlignmentY.Center; verticalAlignment = AlignmentY.Center; break; } } else if (parameter is EventArgs && (parameter as RoutedEventArgs).Source is RadioButton && ((parameter as RoutedEventArgs).Source as RadioButton).Name == "rd_imagewatermark") { (panel.Children[0] as Image).Visibility = Visibility.Visible; (panel.Children[1] as TextBlock).Visibility = Visibility.Hidden; visualBrush.AlignmentY = verticalAlignment; visualBrush.AlignmentX = horizontalAlignment; string samplePath = SampleSourceHelper.GetSamplePath() + @"Common\Images\OlapChart"; (panel.Children[0] as Image).Source = new BitmapImage(new Uri(samplePath + @"\Watermark.png")); } else if (parameter is EventArgs && (parameter as RoutedEventArgs).Source is RadioButton && ((parameter as RoutedEventArgs).Source as RadioButton).Name == "rd_textwatermark") { (panel.Children[0] as Image).Source = null; (panel.Children[0] as Image).Visibility = Visibility.Hidden; (panel.Children[1] as TextBlock).Visibility = Visibility.Visible; visualBrush.AlignmentY = verticalAlignment; visualBrush.AlignmentX = horizontalAlignment; } if (parameter is EventArgs) { int i = 0; string[] colors = { "Red", "Lime", "Cyan", "Violet", "DeepSkyBlue", "DarkGray", "Blue" }; foreach (ChartSeries series in this.Target.Series) { var color = ColorConverter.ConvertFromString(colors[i]); if (color != null) { SolidColorBrush brush = new SolidColorBrush((Color)color); series.StrokeThickness = 3; series.Interior = brush; } i += 1; } } } }