Esempio n. 1
0
        private void btnModificarFormato_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            XtraReport report = new XtraReport();
            String     path   = Path.Combine(Directory.GetCurrentDirectory(), "FormatosCheques", string.Format("Formato-{0}.repx", currentRow["IDFormato"])).ToString();

            report.LoadLayout(path);
            //DevExpress.XtraReports.Configuration.Settings.Default.StorageOptions.RootDirectory = Path.Combine(Directory.GetCurrentDirectory(), "FormatosCheques");


            ReportDesignTool designTool = new ReportDesignTool(report);
            IDesignForm      desingForm = designTool.DesignRibbonForm;

            mdiController = desingForm.DesignMdiController;
            //mdiController.SetCommandVisibility(ReportCommand.SaveFileAs, CommandVisibility.None);
            //mdiController.SetCommandVisibility(ReportCommand.SaveFile, CommandVisibility.None);
            mdiController.SetCommandVisibility(ReportCommand.SaveAll, CommandVisibility.None);
            mdiController.SetCommandVisibility(ReportCommand.NewReport, CommandVisibility.None);
            mdiController.SetCommandVisibility(ReportCommand.OpenFile, CommandVisibility.None);
            mdiController.SetCommandVisibility(ReportCommand.OpenRemoteReport, CommandVisibility.None);
            mdiController.SetCommandVisibility(ReportCommand.OpenSubreport, CommandVisibility.None);


            designTool.DesignRibbonForm.DesignMdiController.DesignPanelLoaded += new DesignerLoadedEventHandler(DesignMdiController_DesignPanelLoaded);

            designTool.ShowRibbonDesigner();
        }
        public CustomMenuCreationService(XRDesignMdiController controller)
        {
            this.controller = controller;
            Guid guid = Guid.NewGuid();

            showGridCommandID = new CommandID(guid, 0);
            hideGridCommandID = new CommandID(guid, 1);
        }
        public static void Apply(XRDesignMdiController designMdiController, XRDesignDockManager designDockManager)
        {
            CustomFieldListImageProviderFeature.Instance.CustomColumnImageIndex -= CustomFieldListImageProviderFeature_CustomColumnImageIndex;
            CustomFieldListImageProviderFeature.Instance.CustomColumnImageIndex += CustomFieldListImageProviderFeature_CustomColumnImageIndex;

            if (designMdiController.ActiveDesignPanel == null)
                designMdiController.DesignPanelLoaded += designMdiController_DesignPanelLoaded;
            else
                RefreshFieldListImages(designDockManager);

            MenuCreationServiceContainer.Get(designMdiController).Add(new SummaryFieldsMenuCreationService(designMdiController, designDockManager));
        }
Esempio n. 4
0
        /// <summary>
        /// Atualiza o relatorio que está sendo editado
        /// </summary>
        /// <param name="reportDesigner"></param>
        /// <param name="report"></param>
        public bool UpdateReport(XRDesignMdiController reportDesigner, ReportImage report)
        {
            try
            {
                using (var ctx = new ReportContext())
                {
                    //objeto designer do relatório
                    var xtraReport = reportDesigner.ActiveDesignPanel.Report;

                    //nome setado no relatório
                    //report.DefaultName = xtraReport.Name;

                    //gera um nome aleatorio utilizando o nome setado no relatório
                    string reportPath = generatePath(report, ctx);

                    using (MemoryStream ms = new MemoryStream())
                    {
                        //salva o layout em memoria
                        xtraReport.SaveLayout(ms);

                        //salva o relatorio no disco em formato repx (Fica serializado)
                        xtraReport.SaveLayout(reportPath);

                        ////salva pro xml
                        //xtraReport.SaveLayoutToXml(reportPath + ".xml");

                        //obtem os bytes do relatório
                        var bytes = ms.GetBuffer();

                        //AppConfigDefaultManager.Configuration.ChangeConnectionStringRuntime
                        //    ("ITS", AppConfigManager.Configuration.AppConfig.ConnectionString);

                        //passa o objeto para o contexto
                        var current = ctx.ReportImageDao.Find(report.IdReport);

                        //atualiza o relatorio
                        report.ReportImageData = bytes;

                        //passa pro objeto do contexto
                        current.Update(report);

                        report.Update(current);

                        //persiste a atualização no banco
                        return(ctx.ReportImageDao.Update(current));
                    }
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
        Control CreateTemplateControl(XRDesignMdiController controller)
        {
            TemplateUserControl control = new TemplateUserControl(controller)
            {
                Dock = System.Windows.Forms.DockStyle.Fill
            };

            control.Storage = new PersistentControlTemplateStorage("SampleStorage.xml"); // Persistent storage
            //userControl.Storage = new ControlTemplateStorage(); // In-memory storage

            controller.DesignPanelListeners.Add(control);
            return(control);
        }
        private void ShowReportDesigner()
        {
            XRDesignForm          form          = new XRDesignForm();
            XRDesignMdiController mdiController = form.DesignMdiController;

            mdiController.DesignPanelLoaded += new DesignerLoadedEventHandler(mdiController_DesignPanelLoaded);
            mdiController.OpenReport(new XtraReport1());
            form.ShowDialog();
            if (mdiController.ActiveDesignPanel != null)
            {
                mdiController.ActiveDesignPanel.CloseReport();
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Salva o relatorio que está aberto no banco
        /// </summary>
        /// <param name="reportDesigner"></param>
        /// <param name="report"></param>
        public ReportImage SaveReport(XRDesignMdiController reportDesigner, ReportImage report)
        {
            try
            {
                using (var ctx = new ReportContext())
                {
                    //objeto designer do relatório
                    var xtraReport = reportDesigner.ActiveDesignPanel.Report;

                    //nome setado no relatório
                    //report.DefaultName = xtraReport.Name;

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

                    using (MemoryStream ms = new MemoryStream())
                    {
                        //salva o relatorio
                        reportDesigner.ActiveDesignPanel.SaveReport(reportPath);

                        //salva o layout em memoria
                        xtraReport.SaveLayout(ms);

                        xtraReport.SaveLayoutToXml(reportPath + ".xml");

                        //salva o relatorio no disco em formato repx
                        xtraReport.SaveLayout(reportPath);

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

                        //gerar os bytes do arquivo
                        report.ReportImageData = bytes;

                        if (ctx.ReportImageDao.Save(report))
                        {
                            return(report);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                XMessageIts.Advertencia("Houve um erro ao salvar relatório.\n\n"
                                        + ex.Message);

                LoggerUtilIts.GenerateLogs(ex);
            }

            return(null);
        }
        public bool ShowpageEditDesign()
        {
            try
            {
                ReportDesignTool rrtDT = new ReportDesignTool(rrt);

                GroupAndSortDockPanel groupSort = (GroupAndSortDockPanel)rrtDT.DesignRibbonForm.DesignDockManager[DesignDockPanelType.GroupAndSort];
                groupSort.Visibility = DockVisibility.AutoHide;

                ErrorListDockPanel errorList = (ErrorListDockPanel)rrtDT.DesignRibbonForm.DesignDockManager[DesignDockPanelType.ErrorList];
                errorList.Visibility = DockVisibility.AutoHide;

                FieldListDockPanel fieldList = (FieldListDockPanel)rrtDT.DesignRibbonForm.DesignDockManager[DesignDockPanelType.FieldList];
                fieldList.Visibility = DockVisibility.AutoHide;

                ReportExplorerDockPanel reportExplorer = (ReportExplorerDockPanel)rrtDT.DesignRibbonForm.DesignDockManager[DesignDockPanelType.ReportExplorer];
                reportExplorer.Visibility = DockVisibility.AutoHide;

                PropertyGridDockPanel propertyGrid = (PropertyGridDockPanel)rrtDT.DesignRibbonForm.DesignDockManager[DesignDockPanelType.PropertyGrid];
                propertyGrid.Visibility = DockVisibility.AutoHide;

                ToolBoxDockPanel toolBox = (ToolBoxDockPanel)rrtDT.DesignRibbonForm.DesignDockManager[DesignDockPanelType.ToolBox];
                toolBox.Visibility = DockVisibility.AutoHide;

                mdiController = rrtDT.DesignRibbonForm.DesignMdiController;
                mdiController.DesignPanelLoaded += new DesignerLoadedEventHandler(mdiController_DesignPanelLoaded);

                rrtDT.ShowRibbonDesignerDialog();

                if (mdiController.ActiveDesignPanel != null)
                {
                    mdiController.ActiveDesignPanel.CloseReport();
                }

                if (coluu)
                {
                    coluu = false;

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public OpenCommandHandler(XRDesignMdiController xrDesigner, CompositionContainer container)
        {
            if (xrDesigner == null)
            {
                throw new ArgumentNullException("xrDesigner");
            }

            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            _xrDesigner = xrDesigner;
            container.ComposeParts(this);
        }
Esempio n. 10
0
        public static void Apply(XRDesignMdiController designMdiController, XRDesignDockManager designDockManager)
        {
            CustomFieldListImageProviderFeature.Instance.CustomColumnImageIndex -= CustomFieldListImageProviderFeature_CustomColumnImageIndex;
            CustomFieldListImageProviderFeature.Instance.CustomColumnImageIndex += CustomFieldListImageProviderFeature_CustomColumnImageIndex;

            if (designMdiController.ActiveDesignPanel == null)
            {
                designMdiController.DesignPanelLoaded += designMdiController_DesignPanelLoaded;
            }
            else
            {
                RefreshFieldListImages(designDockManager);
            }

            MenuCreationServiceContainer.Get(designMdiController).Add(new SummaryFieldsMenuCreationService(designMdiController, designDockManager));
        }
        public static void OnDesignPanelActivated(this XRDesignMdiController controller, Action <XRDesignPanel> handler)
        {
            controller.DesignPanelLoaded += (sender1, designLoadedArgs) =>
            {
                var designPanel = (XRDesignPanel)sender1;

                EventHandler activated = null;
                activated = (sender2, emptyArgs) =>
                {
                    designLoadedArgs.DesignerHost.Activated -= activated;
                    handler.Invoke(designPanel);
                };

                designLoadedArgs.DesignerHost.Activated += activated;
            };
        }
        public static void Apply(XRDesignMdiController designMdiController, XRDesignDockManager designDockManager)
        {
            CustomFieldListImageProviderFeature.Instance.CustomColumnImageIndex -= CustomFieldListImageProviderFeature_CustomColumnImageIndex;
            CustomFieldListImageProviderFeature.Instance.CustomColumnImageIndex += CustomFieldListImageProviderFeature_CustomColumnImageIndex;

            if (designMdiController.ActiveDesignPanel == null)
            {
                DesignerLoadedEventHandler handler = null;
                designMdiController.DesignPanelLoaded += handler = (s, e) =>
                {
                    designMdiController.DesignPanelLoaded -= handler;
                    RefreshFieldListImages(designDockManager);
                };
            }
            RefreshFieldListImages(designDockManager);

            MenuCreationServiceContainer.Get(designMdiController).Add(new SummaryFieldsMenuCreationService(designMdiController, designDockManager));
        }
Esempio n. 13
0
        private void button1_Click(object sender, EventArgs e)
        {
            // Create a design form and get its MDI controller.
            XRDesignForm form = new XRDesignForm();

            mdiController = form.DesignMdiController;

            // Handle the DesignPanelLoaded event of the MDI controller,
            // to override the SaveCommandHandler for every loaded report.
            mdiController.DesignPanelLoaded +=
                new DesignerLoadedEventHandler(mdiController_DesignPanelLoaded);

            // Open an empty report in the form.
            mdiController.OpenReport(new XtraReport1());

            // Show the form.
            form.ShowDialog();
            if (mdiController.ActiveDesignPanel != null)
            {
                mdiController.ActiveDesignPanel.CloseReport();
            }
        }
 public SummaryFieldsMenuCreationService(XRDesignMdiController designMdiController, XRDesignDockManager designDockManager)
 {
     this.designMdiController = designMdiController;
     this.designDockManager   = designDockManager;
 }
 public SummaryFieldsMenuCreationService(XRDesignMdiController designMdiController, XRDesignDockManager designDockManager)
 {
     this.designMdiController = designMdiController;
     this.designDockManager = designDockManager;
     addSummaryFieldCommand = new CommandID(Guid.NewGuid(), 0);
 }
 public MyClosingReportCommandHandler(XRDesignMdiController controller)
 {
     this.controller = controller;
 }
Esempio n. 17
0
 public SummaryFieldsMenuCreationService(XRDesignMdiController designMdiController, XRDesignDockManager designDockManager)
 {
     this.designMdiController = designMdiController;
     this.designDockManager   = designDockManager;
     addSummaryFieldCommand   = new CommandID(Guid.NewGuid(), 0);
 }
 public TemplateUserControl(XRDesignMdiController mdiController)
     : this()
 {
     this.Controller = mdiController;
 }
 public ReportCommandHandler(XRDesignMdiController editor, DSModel db)
 {
     this.Editor    = editor;
     this.DbContext = db;
 }
 public OpenSubreportCommandHandler(XRDesignMdiController controller)
 {
     mdiController = controller;
 }
 public ReportCommandHandler(XRDesignMdiController editor, DSModel db)
 {
     this.Editor = editor;
     this.DbContext = db;
 }