Ejemplo n.º 1
0
        public static void openStatusBar()
        {
            if (!Program.Windows.Items.ContainsKey("statusBar"))
            {
                var popup = new BrowserPopupForm("statusbar-frame", Program.Settings.BaseURL + "tradersbook-ui/#statusBar", WindowTypes.StatusBar);
                //var popup = new BrowserPopupForm("statusbar-frame", "http://localhost:8080/dev.app#statusBar", WindowTypes.StatusBar);

                popup.ShowInTaskbar   = false;
                popup.FormBorderStyle = FormBorderStyle.FixedToolWindow;
                popup.Text            = String.Empty;
                popup.ControlBox      = false;
                popup.Width           = 720;
                popup.Height          = 96;
                popup.SetTopNoActive();
            }

            /*
             * else
             * {
             *  BrowserPopupForm sbWnd = Program.Windows.Items["statusBar"];
             *  sbWnd.Left = 40;
             *  sbWnd.Top = 40;
             *  sbWnd.SetTopNoActive(false);
             * }
             */
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
        public void onLogout()
        {
            BrowserPopupForm f = Program.Windows.Items["landingPage"];

            f.Invoke(new Action(() => {
                Program.CloseAllButLandingPage();
                f.clearContextMenu();
                f.SetTopNoActive();
                CefSharp.Cef.GetGlobalCookieManager().DeleteCookiesAsync("", "").Wait();
            }));
        }
Ejemplo n.º 4
0
        public static int showWindow(String windowId)
        {
            if (!Program.Windows.Items.ContainsKey(windowId))
            {
                return(0);
            }
            else
            {
                BrowserPopupForm form = Program.Windows.Items[windowId];
                if (form.InvokeRequired)
                {
                    form.Invoke(new Action(() => {
                        form.SetTopNoActive();
                    }));
                }
                else
                {
                    form.SetTopNoActive();
                }

                return(1);
            }
        }
Ejemplo n.º 5
0
        public void closeAndLogout()
        {
            BrowserPopupForm f = Program.Windows.Items["landingPage"];

            Task.Run(async() => {
                await Task.Delay(100);
                f.Invoke(new Action(() => {
                    Program.CloseAllButLandingPage();
                    CefSharp.Cef.GetGlobalCookieManager().DeleteCookiesAsync("", "").Wait();
                    f.Browser.GetBrowser().MainFrame.ExecuteJavaScriptAsync("window.location.reload();");
                    f.clearContextMenu();
                    f.SetTopNoActive();
                }));
            });
        }