private async void MainWindow_Loaded(object sender, RoutedEventArgs e) { var marketingDashboardPath = Path.Combine(Environment.CurrentDirectory, "Dashboards/Marketing.rdash"); RVDashboard dashboard = null; using (var fileStream = File.OpenRead(marketingDashboardPath)) { dashboard = await RevealUtility.LoadDashboard(fileStream); } _revealView.Settings = new RevealSettings(dashboard); }
private async void Dashboard_Loaded(object sender, RoutedEventArgs e) { //インメモリデータを設定するためのイベントハンダラ this.revealView1.DataSourcesRequested += RevealView1_DataSourcesRequested; //ダッシュボード定義情報の保存のためのイベントハンダラ this.revealView1.SaveDashboard += RevealView1_SaveDashboard; //ダッシュボード画像の保存のためのイベントハンダラ this.revealView1.ImageExported += RevealView1_ImageExported; //データプロバイダの設定 this.revealView1.DataProvider = new EmbedDataProvider(this.DataContext as DashboardViewModel); //既に定義ファイルがある場合は読み込み、なければ新規ダッシュボードとして立ち上げる var path = @"..\..\Dashboards\Sales.rdash"; if (UserInfo.showGlobalFilter == true) { path = @"..\..\Dashboards\SalesWithGlobalFilter.rdash"; } var revealView = new RevealView(); RVDashboard dashboard = null; // nullを設定すると新規ダッシュボード作成となる if (File.Exists(path)) { using (var fileStream = File.OpenRead(path)) { //定義ファイルの読み込み dashboard = await RevealUtility.LoadDashboard(fileStream); } } var settings = new RevealSettings(dashboard); if (UserInfo.permissionLevel == 0) { //編集許可 settings.CanEdit = true; settings.ShowMenu = true; } else { //編集禁止 settings.CanEdit = false; settings.ShowMenu = true; } //その他オプション設定 settings.ShowChangeVisualization = true; settings.CanSaveAs = false; // rdash定義ファイルの保存メニュー settings.ShowExportImage = true; settings.ShowFilters = true; settings.ShowRefresh = true; settings.ShowExportToPowerpoint = true; settings.ShowExportToPDF = true; //外部グローバルフィルターの設定 if (UserInfo.showGlobalFilter == true) { // Filter settings globalFilter.Visibility = Visibility.Visible; _from = fromThumb.Value; _to = toThumb.Value; settings.ShowFilters = false; _isIgnoreFilterTrigger = false; settings.DateFilter = new RVDateDashboardFilter(RVDateFilterType.CustomRange, new RVDateRange(_from, _to)); } else { globalFilter.Visibility = Visibility.Collapsed; } // 上記設定情報をRevealViewに適用 this.revealView1.Settings = settings; if (UserInfo.permissionLevel != 0 && dashboard is null) { //編集権限がなく、ダッシュボードが未だ存在しない場合 this.revealView1.Visibility = Visibility.Collapsed; MessageBox.Show("ダッシュボードが定義されていません。"); } }
private async void Dashboard_Loaded(object sender, RoutedEventArgs e) { // Event handler to set in-memory datasource this.revealView1.DataSourcesRequested += RevealView1_DataSourcesRequested; // Event handler to save dashboards this.revealView1.SaveDashboard += RevealView1_SaveDashboard; // Event handler to save images this.revealView1.ImageExported += RevealView1_ImageExported; // Data provider setting this.revealView1.DataProvider = new EmbedDataProvider(this.DataContext as DashboardViewModel); // If the file exists load it, if not create a new dashboard var path = @"..\..\Dashboards\Sales.rdash"; var revealView = new RevealView(); RVDashboard dashboard = null; // setting null means a new dashboard creation if (File.Exists(path)) { using (var fileStream = File.OpenRead(path)) { // Load dashboard definition dashboard = await RevealUtility.LoadDashboard(fileStream); } } var settings = new RevealSettings(dashboard); if (UserInfo.permissionLevel == 0) { // Editable settings.CanEdit = true; settings.ShowMenu = true; } else { // Not editable settings.CanEdit = false; settings.ShowMenu = true; } // Other option settings settings.ShowChangeVisualization = true; settings.CanSaveAs = false; settings.ShowExportImage = true; settings.ShowFilters = true; settings.ShowRefresh = true; //Set Maximized visualization //settings.MaximizedVisualization = settings.Dashboard.Visualizations.First(); this.revealView1.Settings = settings; if (UserInfo.permissionLevel != 0 && dashboard is null) { // In case no edit rights and no dashboard difined this.revealView1.Visibility = Visibility.Collapsed; MessageBox.Show("No dashboard defined !!"); } }