예제 #1
0
        public void Undo(int actionsCount)
        {
            int i = ActivePageIndex;

            if (i == 0)
            {
                Editor.Source.Undo();
                return;
            }

            Designer.Lock();
            Report.ScriptText = Script;
            UndoRedo.GetUndo(actionsCount);
            Script = Report.ScriptText;
            InitPages(i);
            Designer.Unlock();
        }
예제 #2
0
        public void Preview()
        {
            ActivePageDesigner.CancelPaste();
            int i = ActivePageIndex;

            Report.ScriptText = Script;
            Designer.MessagesWindow.ClearMessages();
            UndoRedo.AddUndo("Preview", "Report");
            Designer.Lock();

            bool saveProgress = Config.ReportSettings.ShowProgress;

            Config.ReportSettings.ShowProgress = true;
            ParameterCollection saveParams = new ParameterCollection(null);

            saveParams.Assign(Report.Parameters);

            try
            {
                if (Report.Prepare())
                {
                    Config.DesignerSettings.OnCustomPreviewReport(Report, EventArgs.Empty);
                }
            }
#if !DEBUG
            catch (Exception e)
            {
                if (!(e is CompilerException))
                {
                    using (ExceptionForm form = new ExceptionForm(e))
                    {
                        form.ShowDialog();
                    }
                }
                else
                {
                    Designer.MessagesWindow.Show();
                }
            }
#endif
            finally
            {
                Config.ReportSettings.ShowProgress = saveProgress;

                Image previewPicture = null;
                if (Report.ReportInfo.SavePreviewPicture)
                {
                    previewPicture            = Report.ReportInfo.Picture;
                    Report.ReportInfo.Picture = null;
                }
                UndoRedo.GetUndo(1);
                UndoRedo.ClearRedo();
                if (Report.ReportInfo.SavePreviewPicture)
                {
                    Report.ReportInfo.Picture = previewPicture;
                }
                Report.Parameters.Assign(saveParams);

                InitPages(i);
                Designer.Unlock();
            }
        }