Esempio n. 1
0
        public static void resetStatusBar()
        {
            BrowserPopupForm wnd = Program.Windows.Items["statusBar"];

            wnd.Left = 40;
            wnd.Top  = 40;
        }
Esempio n. 2
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);
             * }
             */
        }
Esempio n. 3
0
        public static bool openWindow(FormLayout layout)
        {
            var popup = new BrowserPopupForm(layout.title, layout.targetUrl, layout.WindowType, layout);

            popup.Show();
            return(true);
        }
Esempio n. 4
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();
        }
Esempio n. 5
0
 public void RegisterWindow(BrowserPopupForm form)
 {
     this.Items.Add(form.WindowId, form);
     if (Changed != null)
     {
         Changed(this, EventArgs.Empty);
     }
 }
Esempio n. 6
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);
        }
Esempio n. 7
0
        public static void Run()
        {
            var popup = new BrowserPopupForm("Caesar", Program.Settings.BaseURL + "web-sso/", WindowTypes.LandingPage);

            popup.ControlBox  = false;
            popup.MinimizeBox = false;
            popup.MaximizeBox = false;

            Application.Run(popup);
        }
Esempio n. 8
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();
            }));
        }
Esempio n. 9
0
        private void doZoom(BrowserPopupForm form, List <int> dims, string zoom)
        {
            double dZoom = Convert.ToDouble(zoom);
            double k     = dZoom < 2 ? 5.5 : 4.7;

            double zoomX = 1 + dZoom / k;
            double zoomY = 1 + dZoom / k;


            form.Width  = Convert.ToInt16(dims[0] * zoomX);
            form.Height = Convert.ToInt16((dims[1] + 24) * zoomY);
        }
Esempio n. 10
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();
            }
        }
Esempio n. 11
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();
                }));
            });
        }
Esempio n. 12
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();
         }
     }));
 }
Esempio n. 13
0
        private void launchDesktop()
        {
            Program.ZoomLevel = Program.Layouts.ZoomLevel;
            setCheckedZoomLevelItem(Program.ZoomLevel);
            foreach (FormLayout layout in Program.Layouts.Items.Values)
            {
                if (layout.inDesktop)
                {
                    JObject args = JObject.FromObject(layout);
                    BoundObject.openWindow(layout);
                }
            }
            BrowserPopupForm sb       = Program.Windows.Items["statusBar"];
            FormLayout       sbLayout = Program.Layouts.Items["statusBar"];

            if (sb != null)
            {
                sb.SetBounds(sbLayout.X, sbLayout.Y, sbLayout.Width, sbLayout.Height);
            }
        }
Esempio n. 14
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);
            }
        }