Exemplo n.º 1
0
 public void DeletePage()
 {
     Designer.Lock();
     Report.Pages.Remove(ActivePage);
     InitPages(Report.Pages.Count);
     Designer.Unlock();
     Designer.SetModified(this, "DeletePage");
 }
Exemplo n.º 2
0
        public void Redo(int actionsCount)
        {
            int i = ActivePageIndex;

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

            Designer.Lock();
            UndoRedo.GetRedo(actionsCount);
            Script = Report.ScriptText;
            InitPages(i);
            Designer.Unlock();
        }
Exemplo n.º 3
0
        public bool LoadFile(string fileName)
        {
            OpenSaveDialogEventArgs e = new OpenSaveDialogEventArgs(Designer);

            // empty fileName: user pressed "Open" button, show open dialog.
            // non-empty fileName: user choosed a report from recent file list, just load the specified report.
            if (String.IsNullOrEmpty(fileName))
            {
                Config.DesignerSettings.OnCustomOpenDialog(Designer, e);
                if (e.Cancel)
                {
                    return(false);
                }
                fileName = e.FileName;
            }

            bool result = SaveCurrentFile();

            if (result)
            {
                try
                {
                    Designer.Lock();
                    OpenSaveReportEventArgs e1 = new OpenSaveReportEventArgs(Report, fileName, e.Data, false);
                    Config.DesignerSettings.OnCustomOpenReport(Designer, e1);
                    Report.FileName = fileName;
                    Designer.cmdRecentFiles.Update(fileName);
                    Config.DesignerSettings.OnReportLoaded(this, new ReportLoadedEventArgs(Report));
                    result = true;
                }
#if !DEBUG
                catch (Exception ex)
                {
                    EmptyReport(false);
                    FRMessageBox.Error(String.Format(Res.Get("Messages,CantLoadReport") + "\r\n" + ex.Message, fileName));
                    result = false;
                }
#endif
                finally
                {
                    InitReport();
                    Designer.Unlock();
                }
            }

            return(result);
        }
Exemplo n.º 4
0
 internal bool EmptyReport(bool askSave)
 {
     if (askSave)
     {
         if (!SaveCurrentFile())
         {
             return(false);
         }
     }
     Designer.Lock();
     try
     {
         Report.FileName = "";
         Report.Clear();
         Report.Dictionary.ReRegisterData();
         Config.DesignerSettings.OnReportLoaded(this, new ReportLoadedEventArgs(Report));
     }
     finally
     {
         InitReport();
         Designer.Unlock();
     }
     return(true);
 }
Exemplo n.º 5
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();
            }
        }