Exemplo n.º 1
0
        public static bool openWindow(FormLayout layout)
        {
            var popup = new BrowserPopupForm(layout.title, layout.targetUrl, layout.WindowType, layout);

            popup.Show();
            return(true);
        }
Exemplo n.º 2
0
        private void openNewToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //string targetUrl = Microsoft.VisualBasic.Interaction.InputBox("Title", "Prompt", "Default", 0, 0);
            string targetUrl = "http://localhost:8080";
            var    popup     = new BrowserPopupForm("dev window", targetUrl, WindowTypes.TraderBook, null);

            popup.Show();
        }
Exemplo n.º 3
0
        public static bool openWindow(string url, string args = null)
        {
            string windowId  = BrowserPopupForm.ParseWindowId(url);
            int    maxTrbNum = Program.Settings.MaximumNumberOfTRBScreens;
            int    trbCnt    = BrowserPopupForm.GetTraderBookCount();
            string title     = null;
            bool   single    = false;

            if (!String.IsNullOrEmpty(args))
            {
                JObject options = JObject.Parse(args);
                title  = options["title"].ToString();
                single = bool.Parse((options["single"] ?? "false").ToString());
            }



            if (windowId.StartsWith("traderBook") && trbCnt >= maxTrbNum)
            {
                (new Thread(() => MessageBox.Show(
                                "Number of opened Trader Book's screens are limited by " + maxTrbNum.ToString(),
                                "Warning",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning
                                ))).Start();
                return(false);
            }

            ChromiumWebBrowser browser = (ChromiumWebBrowser)Program.Windows.Items["landingPage"].Browser;

            string targetUrl = (url.StartsWith("http")) ? url : Program.Settings.BaseURL + url.Replace("../", "");

            browser.Invoke(new Action(() => {
                if (Program.Windows.Items.ContainsKey(windowId))
                {
                    if (single)
                    {
                        Program.Windows.Items[windowId].SetTopNoActive();
                    }
                    else
                    {
                        Program.Windows.Items[windowId].ShowNoActive();
                    }
                }
                else
                {
                    var windowTitle = String.IsNullOrEmpty(title) ? Program.Windows.Items["landingPage"].resolveWindowTitle(url) : title;
                    var popup       = new BrowserPopupForm(windowTitle, targetUrl, WindowTypes.TraderBook, null);
                    popup.Show();
                    if (single)
                    {
                        popup.SetTopNoActive();
                    }
                }
            }));
            return(true);
        }
Exemplo n.º 4
0
        public static void openCBW(string url, string title)
        {
            //string url = Program.Settings.CBW_URL + "#" + hash;
            string windowId = BrowserPopupForm.ParseWindowId(url);

            if (Program.Windows.Items.ContainsKey(windowId))
            {
                Program.Windows.Items[windowId].ShowNoActive();
            }
            else
            {
                var popup = new BrowserPopupForm(title, url, WindowTypes.CBW);
                popup.Show();
            }
        }
Exemplo n.º 5
0
 public void ShowAndReloadCBW(string url, string title)
 {
     this.form.Invoke(new Action(() => {
         string windowId = BrowserPopupForm.ParseWindowId(url);
         if (Program.Windows.Items.ContainsKey(windowId))
         {
             var w = Program.Windows.Items[windowId];
             w.ShowNoActive();
             w.Browser.GetBrowser().MainFrame.ExecuteJavaScriptAsync("window.location.reload();");
         }
         else
         {
             var popup = new BrowserPopupForm(title, url, WindowTypes.CBW);
             popup.Show();
         }
     }));
 }