Пример #1
0
        /// <summary>
        /// Navigate browser to an html popup form
        /// </summary>
        /// <param name="document">URI/UNC or document content</param>
        /// <param name="title">Title of document</param>

        public static void ShowHtmlPopupFormDocument(         // navigate browser to a document
            string htmlOrUrl,
            string title)
        {
            string uri;

            Progress.Hide();             // hide any progress so popup gets focus
            //Thread.Sleep(100); // small time delay helps to keep popup on top
            //Application.DoEvents();

            if (Lex.IsUri(htmlOrUrl) || htmlOrUrl.StartsWith(@"\\") ||
                (htmlOrUrl.Length > 3 && htmlOrUrl.Substring(1, 2) == @":\"))
            {
                uri = htmlOrUrl;                 // html is the reference
                SystemUtil.StartProcess(uri);
                return;
            }

            else             // write file to client & open
            {
                uri = ClientDirs.TempDir + @"\PopupHtml" + PopupCount + ".htm";

                StreamWriter sw = new StreamWriter(uri);
                sw.Write(htmlOrUrl);
                sw.Close();

                SS.I.BrowserPopup = new PopupHtml();
                PopupHtml bp = SS.I.BrowserPopup;
                PositionPopupForm(bp);

                bp.Text = title;
                bp.Show();

                bp.WebBrowser.Navigate(uri);
                return;
            }
        }
Пример #2
0
        /// <summary>
        /// Open a spotfire link or webplayer url
        /// Example: https://[server]/SpotfireWeb/ViewAnalysis.aspx?file=/Mobius/Visualizations/MdbAssay_MOBIUS&configurationBlock=CorpId_LIST={1,3,5};
        /// Example: https://[server]/SpotfireWeb/ViewAnalysis.aspx?file=/Mobius/Visualizations/SELECT_MOBIUS_DATA_Test&configurationBlock=SQLPARMS="1,3,5,7,9";
        /// </summary>
        /// <param name="link">Open a spotfire link or Webplayer URL </param>
        /// <param name="browserControl"></param>

        public static void OpenLink(
            string link,
            string title,
            WebBrowser browserControl)
        {
            SpotfireViewProps sl = null;
            UserObject        uo = null;
            UserObjectType    uoType;
            string            url;
            PopupHtml         form;
            int uoId;

            if (Lex.IsUndefined(title))
            {
                title = link;
            }

            if (Lex.IsUndefined(link))             // prompt for the link to open
            {
                string prompt = "Open Spotfire Link ";
                uo = UserObjectOpenDialog.ShowDialog(UserObjectType.SpotfireLink, prompt);
                if (uo == null)
                {
                    return;
                }
                link = uo.InternalName;
            }

            if (Lex.StartsWith(link, "SPOTFIRELINK_"))             // get the link user object
            {
                string internalName = link;
                bool   parseOk      = UserObject.ParseObjectTypeAndIdFromInternalName(link, out uoType, out uoId);
                uo = UserObjectDao.Read(uoId);
                if (uo == null)
                {
                    throw new Exception("User object not found " + internalName);
                }
                sl    = SpotfireViewProps.Deserialize(uo.Content);
                title = uo.Name;
                url   = BuildUrl(sl);
                if (Lex.IsUndefined(url))
                {
                    return;                                       // cancelled
                }
            }

            else
            {
                url = link;              // assume link is a complete url
            }
            if (browserControl == null)  // Open the link within a WebBrowser control
            {
                form = new PopupHtml();
                UIMisc.PositionPopupForm(form);
                form.Text = title;
                form.Show();
                browserControl = form.WebBrowser;
            }

            browserControl.Navigate(url);

            return;
        }