public void GenerateDashboard(DoSoEmail email, bool prevewOnly = false) { var dashboardXml = Dashboard?.Xml; if (string.IsNullOrEmpty(dashboardXml)) { return; } var width = DashboardWidth ?? 1000; var height = DashboardHeight ?? 1000; using (var viewver = new DashboardViewer()) { viewver.Dock = System.Windows.Forms.DockStyle.Fill; using (var ms = new MemoryStream()) { using (var sr = new StreamWriter(ms, Encoding.UTF8)) { var doc = new XmlDocument(); doc.LoadXml(dashboardXml); var definitionXml = doc.OuterXml; sr.Write(definitionXml); sr.Flush(); ms.Position = 0; try { viewver.LoadDashboard(ms); } catch (Exception e) { throw; } viewver.Size = new System.Drawing.Size(width, height); if (!prevewOnly) { var path = Path.Combine(email.FolderPath, "Dashboard" + ".png"); viewver.ExportToImage(path); //email.SourceFilePath += path + ";"; } else { using (var form = new DevExpress.XtraEditors.XtraForm()) { form.Width = width; form.Height = height; viewver.Parent = form; form.ShowDialog(); } } } } } }
public void ShowDashBoard(DashboardViewer dbv, bool canRead) { if (canRead) { if (dbv.Dashboard == null) { dbv.LoadDashboard(@"UmitechDashBoard.xml"); dbv.Show(); } else { dbv.Show(); } } else { dbv.Hide(); XtraMessageBox.Show("You need to have administrative rights to have a look the dashboard of the comapany", "You Cant View Dashbord", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void simpleAction_PreviwDashboard_Execute(object sender, SimpleActionExecuteEventArgs e) { //var os = Application.CreateObjectSpace(); //var dashboard = os.GetObject(View.CurrentObject as DoSoDashboard); //var detailView = Application.CreateDetailView(os, dashboard); //var svp = new ShowViewParameters //{ // CreatedView = detailView, // NewWindowTarget = NewWindowTarget.Default, // TargetWindow = TargetWindow.Default, //}; using (var viewver = new DashboardViewer()) { viewver.Dock = System.Windows.Forms.DockStyle.Fill; using (var ms = new MemoryStream()) { using (var sr = new StreamWriter(ms, Encoding.Default)) { var doc = new XmlDocument(); doc.LoadXml((View.CurrentObject as DoSoDashboard).Xml); var definitionXml = doc.OuterXml; sr.Write(definitionXml); sr.Flush(); ms.Position = 0; viewver.LoadDashboard(ms); using (var form = new DevExpress.XtraEditors.XtraForm()) { form.Width = 1600; form.Height = 900; viewver.Parent = form; form.ShowDialog(); } } } } //Application.ShowViewStrategy.ShowView(svp, new ShowViewSource(null, null)); }