Ejemplo n.º 1
0
        /// <summary>
        /// Add a new empty results page
        /// </summary>

        void AddPage()
        {
            DialogResult = DialogResult.OK;             // close the selection menu
            Hide();
            SessionManager.ActivateShell();

            ResultsPage page = ResultsPages.AddNewPage(Qm.Query);

            Qrc.AddResultsPageTabPage(page);            // add tab for page
            Qrc.ConfigureResultsPage(page);             // render the empty page

            return;
        }
Ejemplo n.º 2
0
/// <summary>
/// Show the specified query in a new PopupResults form
/// </summary>
/// <param name="qm"></param>
/// <param name="html"></param>
/// <param name="title"></param>

        public static void ShowHtml(         // navigate browser to a document
            QueryManager qm,
            string html,
            string title)
        {
            string uri;
            int    pi;

            Progress.Hide();             // hide any progress so popup gets focus

            uri = ClientDirs.TempDir + @"\PopupResults" + "1" + ".htm";

            StreamWriter sw = new StreamWriter(uri);

            sw.Write(html);
            sw.Close();

            PopupResults pr = new PopupResults();

            UIMisc.PositionPopupForm(pr);
            pr.Text = title;

            QueryResultsControl qrc = pr.QueryResultsControl;

            qm.LinkMember(qrc);
            Query q = qm.Query;

            qrc.BuildResultsPagesTabs(q);

            for (pi = 0; pi < q.ResultsPages.Pages.Count; pi++)
            {
                ResultsPage page = q.ResultsPages.Pages[pi];
                for (int vi = 0; vi < page.Views.Count; vi++)
                {
                    ResultsViewProps view = page.Views[vi];
                    if (view.ViewType == ResultsViewType.HtmlTable)
                    {
                        view.Title      = title;
                        view.ContentUri = uri;                         // plug in file name for uri
                    }
                }
            }

            pr.Show();
            qrc.ConfigureResultsPage(0);             // render the first page

            UIMisc.BringFormToFront(pr);
            return;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Tentatively add a new view of the specified type to the current page
        /// </summary>
        /// <param name="viewType"></param>
        /// <param name="query"></param>
        /// <param name="qrc"></param>
        /// <returns></returns>

        private static ResultsViewProps AddTentativeNewView(
            ResultsViewModel rvm)
        {
            ResultsPage  rp;
            DialogResult dr;
            int          intVal, max;

            ResultsViewType     viewType    = rvm.ViewType;
            string              viewSubtype = rvm.ViewSubtype;
            string              viewTitle   = rvm.Title;
            Query               query       = rvm.Query;
            QueryResultsControl qrc         = rvm.QueryResultsControl as QueryResultsControl;

            LastAddedViewType = viewType;

            int pi = qrc.CurrentPageIndex;

            if (pi < 0 ||                                          // add a page if no pages
                query.Root.ResultsPages.Pages[pi].Views.Count > 0) // or (for now) already a view on the current page
            {
                rp = ResultsPages.AddNewPage(query);
                pi = query.Root.ResultsPages.Pages.Count - 1;
                qrc.AddResultsPageTabPage(rp);
            }

            ResultsPage      page = query.ResultsPages[pi];
            ResultsViewProps view = page.AddNewView(rvm);

            if (view == null)
            {
                throw new Exception("Failed to add new view: " + viewType);
            }

            //view.CustomViewTypeImageName = rvm.CustomViewTypeImageName; // (should already be set)

            if (Lex.IsDefined(viewTitle) && Lex.Ne(viewTitle, viewType.ToString()))
            {
                view.Title = page.AddSequentialSuffixToTitle(viewTitle, query.ResultsPages);                 // set custom title (sequentially-numbered) if defined
            }
            qrc.SetCurrentPageTabTitleAndImage();

            dr = view.ShowInitialViewSetupDialog();

            if (dr != DialogResult.OK)
            {
                RemoveTentativeView(view, qrc);
                return(null);                // not added
            }

            qrc.ConfigureResultsPage(page);             // render the default view in the current page

            dr = view.ShowInitialViewPropertiesDialog();
            if (dr == DialogResult.OK)
            {
                //view.ConfigureRenderingControl(); // be sure it's configured (not a good idea, adds overhead)

                qrc.SetCurrentPageTabTitleAndImage();                 // update tab title & image accordingly

                return(view);
            }

            else             // cancelled, remove view
            {
                RemoveTentativeView(view, qrc);
                return(null);                // not added
            }
        }