public MainWindow() { InitializeComponent(); // Reveal 初期設定用コード RevealSettings revealSettings = new RevealSettings(null); revealView.Settings = revealSettings; }
public MainWindow() { InitializeComponent(); // Reveal 初期設定用コード RevealSettings revealSettings = new RevealSettings(null); revealView.Settings = revealSettings; // データソースを設定 revealView.DataSourcesRequested += RevealView_DataSourcesRequested; // データプロバイダを設定 revealView.DataProvider = new EmbedDataProvider(); }
private void RegisterRevealMenu(FrameworkElement sender) { MenuItem menuItem = sender as MenuItem; DataGrid dg = ((ContextMenu)menuItem.Parent).PlacementTarget as DataGrid; RevealDialogWindow revealWindow = new RevealDialogWindow(); // グリッドの1件目のレコードから型情報を取得する。 Type recordType; object recordFirst; foreach (var record in dg.ItemsSource) { recordType = record.GetType(); recordFirst = record; break; } //this.dataGrid.ItemsSource DataGridDataProvider dataGridDataProvider = new DataGridDataProvider( (IEnumerable <object>)dg.ItemsSource, dg.Columns); // データグリッドのアイテムリソースを設定 //dataGridDataProvider.Data = (IEnumerable<object>)this.dataGrid.ItemsSource; // Reveal 初期設定用コード RevealSettings revealSettings = new RevealSettings(null); revealWindow.revealView.Settings = revealSettings; // データソースの設定 revealWindow.revealView.DataSourcesRequested += RevealView_DataSourcesRequested; // グリッドのデータを提供するプロバイダ revealWindow.revealView.DataProvider = dataGridDataProvider; revealWindow.ShowDialog(); // (メモリリーク対策)イベントを開放するため、画面を閉じた際にイベントを開放。 revealWindow.Closed += RevealWindow_Closed; }
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 !!"); } }