Exemplo n.º 1
0
        private void OpenDesign(string designName)
        {
            string error = null;

            SetMenus(enabled: false);

            webBrowser.Visible = false;

            editor.SetDesign(designName, ReloadBrowser);

            if (validator.Parse(editor.GetDesignText(), SetProgress, out error))
            {
                DesignParser designParser = new DesignParser();

                this.design = designParser.Parse(editor.GetDesignText(), SetProgress, out error);
            }

            if (!string.IsNullOrEmpty(error))
            {
                if (MessageBox.Show(string.Format("Invalid design '{0}': {1}\n\nDo you want to edit the design?", designName, error), App.GetName() + " · Validating Design", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
                {
                    editor.Show();
                    editor.SetError(error);
                }
            }
            else
            {
                webBrowser.DocumentText = HtmlHelper.GetDesignInHtml(design);

                SetMenus(enabled: true);

                webBrowser.Visible = true;
            }
        }
Exemplo n.º 2
0
        private void ReloadBrowser()
        {
            DesignParser designParser = new DesignParser();

            this.design = designParser.Parse(editor.GetDesignText(), SetProgress, out string error);

            webBrowser.DocumentText = HtmlHelper.GetDesignInHtml(design);

            SetMenus(enabled: true);

            webBrowser.Visible = true;
        }
Exemplo n.º 3
0
        private void PreviewDesign()
        {
            if (designMaster.SelectionStart <= 0)
            {
                return;
            }

            DesignParser designParser = new DesignParser();

            Design design = designParser.Parse(designMaster.Text, null, out string error);

            if (!string.IsNullOrEmpty(error))
            {
                SetStatus(error, failure: true);
            }
            else
            {
                int pageNumber = 1;

                int pageFeedIndex = designMaster.Text.LastIndexOf("PageFeed", designMaster.SelectionStart);

                if (pageFeedIndex >= 0)
                {
                    string pageFeed = designMaster.GetLineText(designMaster.PositionToPlace(pageFeedIndex).iLine);

                    string[] split = pageFeed.Split("PageNumber=");

                    if (split.Length > 1)
                    {
                        string albumNumber = split[1].Split(' ')[0];

                        DesignEntry entry = design.FindAlbumNumber(albumNumber);

                        if (entry != null)
                        {
                            pageNumber = entry.PageNumber;
                        }
                    }
                }

                preview.ShowPreview(design, pageNumber: pageNumber, albumNumber: design.GetPagefeed(pageNumber).AlbumNumber, printMode: PrintMode.ToScreen, screenMode: ScreenMode.MatchScreenHeight);
                preview.Show();

                this.Focus();
            }
        }