Ejemplo n.º 1
0
 public DashboardsEditPresenter(DashboardDesigner view, DashboardsEditViewModel viewModel)
     : base(viewModel)
 {
     // should consider wiring UI elements from DashboardsEdit
     // into this presenter instance in a more granular way
     View = view;
     View.DashboardClosing += View_DashboardClosing;
 }
Ejemplo n.º 2
0
        public Form1()
        {
            InitializeComponent();
            DControl = this.dashboardDesigner1;

            dashboardDesigner1.AllowEditComponentName = true;
            dashboardDesigner1.LoadDashboard("Data\\Dashboard.xml");
        }
        private void DashboardDesigner1_CustomizeDashboardItemCaption(object sender, CustomizeDashboardItemCaptionEventArgs e)
        {
            DashboardDesigner dDesigner = sender as DashboardDesigner;

            if (e.DashboardItemName == "chartDashboardItem1" && dDesigner.Parameters.Count > 0)
            {
                e.FilterText = string.Format(" {0}", dDesigner.Parameters[0].SelectedValue);
            }
        }
        public ScatterChartConstantLineUserValueModule(DashboardDesigner designer, SvgImage barImage = null)
        {
            this.designer = designer;
            BarButtonItem barItem = AddBarItem("Constant line", barImage, designer.Ribbon);

            barItem.ItemClick += BarItem_Click;
            designer.DashboardItemControlUpdated += Designer_DashboardItemControlUpdated;
            designer.CustomExport += Designer_CustomExport;
        }
Ejemplo n.º 5
0
 public DashboardDesignerForm()
 {
     InitializeComponent();
     _dashboardDesigner = new DashboardDesigner();
     Controls.Add(_dashboardDesigner);
     _dashboardDesigner.Dock = DockStyle.Fill;
     _dashboardDesigner.CreateRibbon();
     _dashboardDesigner.ActionOnClose = DashboardActionOnClose.Discard;
     _editHistory = (History)Designer.GetPropertyValue("History");
 }
Ejemplo n.º 6
0
 protected override void OnClosed(EventArgs e)
 {
     _editHistory.Changed -= _EditHistory_Changed;
     _editHistory          = null;
     _template             = null;
     _objectSpace          = null;
     _dashboardDesigner.Dashboard.Dispose();
     _dashboardDesigner = null;
     base.OnClosed(e);
 }
Ejemplo n.º 7
0
        public Form2(Form1 parentForm)
        {
            InitializeComponent();
            this.dashboardViewer1.LoadDashboard("Data\\DashboardChild.xml");
            this.ParentForm = parentForm;
            DashboardDesigner dParentControl = this.ParentForm.DControl;

            dParentControl.MasterFilterSet     += DControl_MasterFilterSet;
            dParentControl.MasterFilterCleared += DControl_MasterFilterCleared;
            dParentControl.DrillDownPerformed  += DControl_DrillDownPerformed;
            dParentControl.DrillUpPerformed    += DControl_DrillUpPerformed;
        }
Ejemplo n.º 8
0
        public DashboardDesignerForm()
        {
            InitializeComponent();
            _dashboardDesigner = new DashboardDesigner();
            Controls.Add(_dashboardDesigner);
            _dashboardDesigner.Dock = DockStyle.Fill;
            _dashboardDesigner.CreateRibbon();
            _dashboardDesigner.ActionOnClose = DashboardActionOnClose.Discard;
            _editHistory = Designer.GetPrivatePropertyValue <History>("History");

            _dashboardDesigner.DataSourceWizardSettings.EnableCustomSql = true;
        }
Ejemplo n.º 9
0
 public void Attach(DashboardDesigner designer, string chartItemName)
 {
     if (designer != null || viewer != null)
     {
         Detach();
     }
     chartStorage       = new List <ChartControl>();
     this.designer      = designer;
     this.chartItemName = chartItemName;
     designer.DashboardItemControlCreated        += DashboardItemControlCreated;
     designer.DashboardItemControlUpdated        += DashboardItemControlUpdated;
     designer.DashboardItemBeforeControlDisposed += DashboardItemBeforeControlDisposed;
 }
 private void DashboardDesigner1_CustomizeDashboardTitle(object sender, CustomizeDashboardTitleEventArgs e)
 {
     e.Items.Add(new DashboardToolbarItem("Clear Log", new Action <DashboardToolbarItemClickEventArgs>((args) =>
     {
         memoEdit1.Text = string.Empty;
     }
                                                                                                       )));
     e.Items.Add(new DashboardToolbarItem("Add a new Grid item", new Action <DashboardToolbarItemClickEventArgs>((args) =>
     {
         DashboardDesigner dControl = sender as DashboardDesigner;
         dControl.Dashboard.Items.AddRange(new GridDashboardItem(), new ChartDashboardItem());
     }
                                                                                                                 )));
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Salva o dashboard no banco
        /// </summary>
        /// <param name="dashboardDesigner">Designer do dashboard</param>
        /// <param name="dash">Dashboard a ser persistido</param>
        /// <returns>O Dashboard persistido no banco ou null</returns>
        public DashboardImage SaveDashboard(DashboardDesigner dashboardDesigner, DashboardImage dash)
        {
            try
            {
                using (var ctx = new ReportContext())
                {
                    //nome informado no dashboard
                    dash.DefaultName = dashboardDesigner.ActiveControl.Name;

                    //gera um nome aleatorio utilizando o nome setado no dashboard
                    string dashPath = generatePath(dash, ctx);

                    using (MemoryStream ms = new MemoryStream())
                    {
                        //objeto designer do dashboard
                        var designer = dashboardDesigner.Dashboard;

                        //salva o layout em memoria
                        designer.SaveToXml(ms);

                        //salva o dashboard no disco em formato xml
                        designer.SaveToXml(dashPath);

                        //obtem os bytes do dashboard
                        var bytes = ms.GetBuffer();

                        //passa os bytes do dashboard pro objeto dashboard
                        dash.ReportImageData = bytes;

                        //persiste o objeto no banco
                        if (ctx.DashboardImageDao.Save(dash))
                        {
                            return(dash);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                XMessageIts.Advertencia("Houve um erro ao salvar o dashboard.\n\n"
                                        + ex.Message);

                LoggerUtilIts.GenerateLogs(ex);
            }

            return(null);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Atualiza o dashboard existente no banco
        /// </summary>
        /// <param name="dashboardDesigner">Designer do dashboard</param>
        /// <param name="dash">Dashboard a ser persistido</param>
        /// <returns>O Dashboard persistido no banco ou null</returns>
        public bool UpdateDashboard(DashboardDesigner dashboardDesigner, DashboardImage dash)
        {
            try
            {
                using (var ctx = new ReportContext())
                {
                    //nome padrão
                    dash.DefaultName = dashboardDesigner.ActiveControl.Name;

                    //gera um nome aleatorio utilizando o nome setado no dashboard
                    string dashPath = generatePath(dash, ctx);
                    // using (MemoryStream ms = new MemoryStream())

                    //objeto designer do dashboard
                    var designer = dashboardDesigner.Dashboard;

                    FileManagerIts.DeleteFile(dashPath);
                    //salva o layout em memoria
                    //designer.SaveToXml(ms);

                    //salva o dashboard no disco em formato xml
                    designer.SaveToXml(dashPath);

                    var bytes = FileManagerIts.GetBytesFromFile(dashPath); //ms.GetBuffer();

                    //passando objeto pro contexto
                    var current = ctx.DashboardImageDao.Find(dash.IdReport);

                    //atualiza o dashboard
                    current.Update(dash);

                    //garante a atualização
                    current.ReportImageData = bytes;

                    //efetiva no banco
                    return(ctx.DashboardImageDao.Update(current));
                }
            }
            catch (Exception ex)
            {
                XMessageIts.Advertencia("Houve um erro na atualização do dashboard.\n\n"
                                        + ex.Message);

                LoggerUtilIts.GenerateLogs(ex);
                return(false);
            }
        }
        private void DashboardDesigner1_DashboardItemSelectionChanged(object sender, DashboardItemSelectionChangedEventArgs e)
        {
            DashboardDesigner dDesigner = sender as DashboardDesigner;

            if (e.DashboardItemName == "gridDashboardItem1" || e.DashboardItemName == "gridDashboardItem2")
            {
                if (e.CurrentSelection.Count == 0)
                {
                    dDesigner.Parameters[0].SelectedValue = null;
                }
                else
                {
                    selectionCache = e.CurrentSelection;
                    string companyName = e.CurrentSelection[0].GetAxisPoint().DimensionValue.Value.ToString();
                    dDesigner.Parameters[0].SelectedValue = companyName;
                }
            }
        }
Ejemplo n.º 14
0
 public void Detach()
 {
     this.chartItemName = string.Empty;
     if (this.designer != null)
     {
         designer.DashboardItemControlCreated        -= DashboardItemControlCreated;
         designer.DashboardItemControlUpdated        -= DashboardItemControlUpdated;
         designer.DashboardItemBeforeControlDisposed -= DashboardItemBeforeControlDisposed;
         this.designer = null;
     }
     if (this.viewer != null)
     {
         viewer.DashboardItemControlCreated        -= DashboardItemControlCreated;
         viewer.DashboardItemControlUpdated        -= DashboardItemControlUpdated;
         viewer.DashboardItemBeforeControlDisposed -= DashboardItemBeforeControlDisposed;
         this.viewer = null;
     }
     chartStorage = null;
 }
Ejemplo n.º 15
0
 public DashboardDesignerOpeningEventArgs(DashboardDesigner designer)
 {
     Designer = designer;
 }
Ejemplo n.º 16
0
 public DashboardEditViewPresenter(DashboardDesigner designer, DashboardsEditViewViewModel viewModel)
 {
     _viewModel = viewModel;
     _designer = designer;
     _designer.DashboardClosing += designer_DashboardClosing;
 }
Ejemplo n.º 17
0
 public DashboardEditViewPresenter(DashboardDesigner designer, DashboardsEditViewViewModel viewModel)
 {
     _viewModel = viewModel;
     _designer  = designer;
     _designer.DashboardClosing += designer_DashboardClosing;
 }
Ejemplo n.º 18
0
 protected override void OnDesignerShown(DashboardDesigner dashboardDesigner)
 {
     dashboardDesigner.DataSourceWizard.SqlWizardSettings.EnableCustomSql = true;
     dashboardDesigner.DataSourceWizard.SqlWizardSettings.DatabaseCredentialsSavingBehavior = DevExpress.DataAccess.Wizard.SensitiveInfoSavingBehavior.Prompt;
     base.OnDesignerShown(dashboardDesigner);
 }
 public CustomConnectionStorageService(DashboardDesigner designer)
 {
     this.designer = designer;
 }