Example #1
0
        private void OnGoogleGantt(object sender, EventArgs args)
        {
            try
            {
                //todo: for linux should be default browse instead. Mono Howto OpenBrowser
                //http://www.mono-project.com/archived/howto_openbrowser/
                //Browser compatibility mode
                //https://blogs.msdn.microsoft.com/patricka/2015/01/12/controlling-webbrowser-control-compatibility/
                //https://stackoverflow.com/questions/6771258/what-does-meta-http-equiv-x-ua-compatible-content-ie-edge-do

                //for now browser on windows has error : libgluezilla not found. To have webbrowser support, you need libgluezilla installed

                //I think it is possible to check Cef.Glue for linux, it uses Chronium
                //Xilium.CefGlue
                //Xilium.CefGlue is a .NET/Mono binding for The Chromium Embedded Framework (CEF) by Marshall A. Greenblatt.
                //https://bitbucket.org/xilium/xilium.cefglue/wiki/Home
                //The Chromium Embedded Framework (CEF) is a simple framework for embedding Chromium-based browsers in other applications.

                var msForm = new BrowserForm
                {
                    StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen,
                    Width         = 800,
                    Height        = 600
                };

                msForm.Show();
            }
            catch (Exception ex)
            {
            }
        }
Example #2
0
 private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     instructionbrowser = new BrowserForm();
     instructionbrowser.LoadUrl("https://github.com/lbarbisan/LmnpExtraction/blob/master/README.md#create-the-new-google-spreadsheet-to-have-stats");
     instructionbrowser.WindowState = FormWindowState.Normal;
     instructionbrowser.ShowDialog();
 }
        public void webLoad(string item)
        {
            BrowserForm form = new BrowserForm();

            form.Target = item;
            //form.ShowDialog();
            LoadFormToPanel(form);
        }
Example #4
0
        public DownloadHandler(BrowserForm form, bool rejectDownloads = false, Dictionary <RequestIdentifier, string> beforeDownloadScripts = null, Dictionary <RequestIdentifier, string> progressDownloadScripts = null)
        {
            mainForm = form;

            _rejectDownloads         = rejectDownloads;
            _beforeDownloadScripts   = beforeDownloadScripts == null ? new Dictionary <RequestIdentifier, string>() : beforeDownloadScripts;
            _progressDownloadScripts = progressDownloadScripts == null ? new Dictionary <RequestIdentifier, string>() : progressDownloadScripts;
        }
        public LocationTension TensionMarket(BrowserForm form, string ville)
        {
            LocationTension tension = new LocationTension();
            var             name    = RemoveDiacritics(ville).ToUpper();

            if (name.StartsWith("PARIS") && name.EndsWith("EME"))
            {
                name = name.Replace("EME", "");
                if (name.Length == 7)
                {
                    name = name.Replace(" ", " 0");
                }
            }
            string codeInsee = null;

            if (villes.ContainsKey(name))
            {
                codeInsee = villes[name];
            }
            else if (villes.ContainsKey(name.Replace("-", " ")))
            {
                codeInsee = villes[name.Replace("-", " ")];
            }
            else if (villes.ContainsKey(name.Replace("SAINT ", "ST ")))
            {
                codeInsee = villes[name.Replace("SAINT ", "ST ")];
            }
            else if (villes.ContainsKey(name.Replace("SAINT-", "ST-").Replace("-", " ")))
            {
                codeInsee = villes[name.Replace("SAINT-", "ST-").Replace("-", " ")];
            }

            if (!string.IsNullOrEmpty(codeInsee))
            {
                var url = "https://www.locservice.fr/tensiometre/tensiometre-" + codeInsee + ".html";
                using (WebClient client = new WebClient())
                {
                    form.LoadUrl(url);
                    System.Threading.Thread.Sleep(1500);
                    ///images/tensiometre/fleche8.png
                    var easy   = WebUtils.retrieveData(form, "//div[@id='result0']/table/tbody/tr[1]/td[1]/div/img[2]/@src");
                    var budget = WebUtils.retrieveData(form, "//div[@id='result0']/table/tbody/tr[2]/td[1]/div/img[2]/@src");
                    if (!string.IsNullOrEmpty(easy))
                    {
                        tension.EasyLocation = long.Parse(easy[26].ToString());
                    }
                    if (!string.IsNullOrEmpty(budget))
                    {
                        tension.BudgetLocation = long.Parse(budget[26].ToString());
                    }
                }
            }
            else
            {
                //Debugger.Break();
            }
            return(tension);
        }
Example #6
0
        public VilleIdealeResult TensionMarket(BrowserForm form, string ville)
        {
            VilleIdealeResult result = new VilleIdealeResult();
            var name = RemoveDiacritics(ville).ToUpper();

            if (name.StartsWith("PARIS") && name.EndsWith("EME"))
            {
                name = name.Replace("EME", "");
                if (name.Length == 7)
                {
                    name = name.Replace(" ", " 0");
                }
            }
            string codeInsee = null;

            if (villes.ContainsKey(name))
            {
                codeInsee = villes[name];
            }
            else if (villes.ContainsKey(name.Replace("-", " ")))
            {
                codeInsee = villes[name.Replace("-", " ")];
            }
            else if (villes.ContainsKey(name.Replace("SAINT ", "ST ")))
            {
                codeInsee = villes[name.Replace("SAINT ", "ST ")];
            }
            else if (villes.ContainsKey(name.Replace("SAINT-", "ST-").Replace("-", " ")))
            {
                codeInsee = villes[name.Replace("SAINT-", "ST-").Replace("-", " ")];
            }

            if (!string.IsNullOrEmpty(codeInsee))
            {
                /* var url = "https://www.ville-ideale.fr/" + name.Replace(" ", "_").ToLower() + "_" + codeInsee;
                 * using (WebClient client = new WebClient())
                 * {
                 *   form.LoadUrl(url);
                 *   System.Threading.Thread.Sleep(3000);
                 *   result.Environnement = WebUtils.retrieveData(form, "//table[@id='tablonotes']/tbody/tr[1]/td[1]").ParseNullableInt();
                 *   result.Transports = WebUtils.retrieveData(form, "//table[@id='tablonotes']/tbody/tr[2]/td[1]").ParseNullableInt();
                 *   result.Sécurite = WebUtils.retrieveData(form, "//table[@id='tablonotes']/tbody/tr[3]/td[1]").ParseNullableInt();
                 *   result.Sante = WebUtils.retrieveData(form, "//table[@id='tablonotes']/tbody/tr[4]/td[1]").ParseNullableInt();
                 *   result.SportsEtLoisirs = WebUtils.retrieveData(form, "//table[@id='tablonotes']/tbody/tr[5]/td[1]").ParseNullableInt();
                 *   result.Culture = WebUtils.retrieveData(form, "//table[@id='tablonotes']/tbody/tr[6]/td[1]").ParseNullableInt();
                 *   result.Enseignement = WebUtils.retrieveData(form, "//table[@id='tablonotes']/tbody/tr[7]/td[1]").ParseNullableInt();
                 *   result.Commerces = WebUtils.retrieveData(form, "//table[@id='tablonotes']/tbody/tr[8]/td[1]").ParseNullableInt();
                 *   result.QualiteDeVie = WebUtils.retrieveData(form, "//table[@id='tablonotes']/tbody/tr[9]/td[1]").ParseNullableInt();
                 * }*/
            }
            else
            {
                //Debugger.Break();
            }
            return(result);
        }
Example #7
0
        public static string retrieveData(BrowserForm form, string xpathExpression)
        {
            string result       = "";
            var    quartierTask = form.EvaluateScriptAsync(xpathExpression).ContinueWith(x =>
            {
                result = x.Result;
            });

            Task.WaitAll(quartierTask);
            return(result);
        }
Example #8
0
 private void btnDisplaySprite_Click(object sender, EventArgs e)
 {
     if (_browserForm != null)
     {
         _browserForm.Close();
     }
     _browserForm           = new BrowserForm(this);
     _browserForm.MdiParent = this.MdiParent;
     _browserForm.Text      = "Equipment - " + this.Text;
     _browserForm.Show();
 }
Example #9
0
        public static void Main(String[] args)
        {
            Application.EnableVisualStyles();

            IConfigService configService = new ConfigService();

            CefConfigUtil.InitCefConfig(configService);

            BrowserForm form = new BrowserForm(configService);

            Application.Run(form);
        }
 public override void Run()
 {
     if (form == null) {
         form =  new BrowserForm { BackColor = Color.Aqua };
     }
     if (form.Visible) {
         form.setFocus();
     }
     else {
         form.Show();
         form.setFocus();
     }
 }
Example #11
0
        private static int Main(string[] args)
        {
            BrowserForm browser;

            Starter.Initialize(args);
            if (args.Length == 0)
            {
                MainForm form = new MainForm();
                Application.Run(form);
            }
            else if (args.Length == 1)
            {
                browser = new BrowserForm();
                Thread thread = new Thread(() =>
                {
                    GmailService service = GmailAnnonceService.GetGmailService();
                    var gmailmessages    = GmailAnnonceService.GetMessages(service);
                    Thread.Sleep(2000);
                    foreach (var message in gmailmessages)
                    {
                        WebScraperService.RunScrapping(browser, args[0].Split('/')[5], message);
                    }
                    Application.Exit();
                });
                thread.Start();
                Application.Run(browser);
            }
            else
            {
                browser = new BrowserForm();
                Thread thread = new Thread(() =>
                {
                    Thread.Sleep(2000);
                    List <Annonce> lists = new List <Annonce>();
                    if (args.Length > 1)
                    {
                        lists.Add(new Annonce(DateTime.Now, args[0], long.Parse(args[1])));
                    }
                    else
                    {
                        lists.Add(new Annonce(DateTime.Now, args[0]));
                    }
                    WebScraperService.RunScrapping(browser, args[0].Split('/')[5], lists);
                    Application.Exit();
                });
                thread.Start();
                Application.Run(browser);
            }

            return(0);
        }
Example #12
0
        public WebWallpaperWindow(string uri, WallpaperType Type, int Width, int Height, int X, int Y) : base(Width, Height, X, Y)
        {
            string url;

            if (Type == WallpaperType.Website)
            {
                url = uri;
            }
            else
            {
                url = $"file://{uri}/index.html";
            }

            _browser = new BrowserForm(url);
        }
Example #13
0
        /// <summary>
        /// Initialise la grille.
        /// </summary>
        protected virtual void initializeGrid()
        {
            form = new BrowserForm();
            for (int i = 0; i < getColumnCount(); i++)
            {
                GridColumn column = getColumn(i);
                form.Grid.Columns.Add(column);
            }

            LayoutDocument page = new LayoutDocument();

            page.CanClose = false;
            page.CanFloat = false;
            page.Title    = getTitle();
            page.Content  = form;
            this.Children.Add(page);
        }
Example #14
0
        private static void InitCef()
        {
            var settings = new CefSettings();

            // Set BrowserSubProcessPath based on app bitness at runtime
            settings.BrowserSubprocessPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
                                                          Environment.Is64BitProcess ? "x64" : "x86",
                                                          "CefSharp.BrowserSubprocess.exe");

            // Make sure you set performDependencyCheck false
            Cef.Initialize(settings, performDependencyCheck: false, browserProcessHandler: null);

#if false
            var browser = new BrowserForm();
            Application.Run(browser);
#endif
        }
Example #15
0
        public WebWallpaperWindow(string uri, WallpaperType Type, int Width, int Height, int X, int Y) : base(Width, Height, X, Y)
        {
            var url = "";

            if (Type == WallpaperType.Website)
            {
                url = uri;
            }
            else
            {
                _port = new Random().Next(10000, 60000);
                // create webserver
                _uri  = uri;
                url   = $"http://localhost:{_port}/";
                _type = Type;
            }
            _browser = new BrowserForm(url);
        }
Example #16
0
        static void Main()
        {
            log.Info("Application started.");
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // Initializes Cef settings.
            BrowserController.Init();

            var browser = new BrowserForm();

            Application.Run(browser);

            log.Info("Application ended.");
            log.WarnFormat("Pages parsed: {0}, addresses checked: {1}, keys founds: {2}", BrowserCallbackForJs.pages, BrowserCallbackForJs.pages * 25, BrowserCallbackForJs.keyFound);

            BrowserController.Exit();
        }
Example #17
0
        private async void LoadingForm_Load(object sender, EventArgs e)
        {
            switch (loadingType)
            {
            case LoadingType.INITIAL_LOGIN:
                // Set the loading text
                loadingLabel.Text = "Logging in to Nintendo Switch Online...";

                // Log in to the user's Nintendo Account
                await mainForm.UseSessionTokenForAccount();

                // Log in to the Online Lounge
                await mainForm.LogIntoOnlineLounge();

                // Populate the form's web service list
                await mainForm.GetAllWebServices();

                // Add all the web services to the list view
                mainForm.PopulateListView();

                break;

            case LoadingType.WEB_SERVICE:
                // Set the loading text
                loadingLabel.Text = "Logging in to the game service...";

                // Log in to the web service
                Credential credential = await mainForm.LogInToWebService((WebService)argument);

                // Hide the form
                this.Hide();

                // Open it in the browser
                BrowserForm form = new BrowserForm((WebService)argument, credential);
                form.ShowDialog(this);

                break;

            default:
                throw new InvalidOperationException();
            }

            this.Close();
        }
Example #18
0
        private void button1_Click(object sender, EventArgs e)
        {
            var url = textBox1.Text;

            browser = new BrowserForm();
            browser.Show();
            Thread thread = new Thread(() =>
            {
                GmailService service = GmailAnnonceService.GetGmailService();
                var gmailmessages    = GmailAnnonceService.GetMessages(service);
                Thread.Sleep(2000);
                foreach (var message in gmailmessages)
                {
                    WebScraperService.RunScrapping(browser, url.Split('/')[5], message);
                }
            });

            thread.Start();
        }
        //覆盖原来的新开窗口行为,便于控制
        bool ILifeSpanHandler.OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser)
        {
            newBrowser = null;

            var chromiumWebBrowser = (ChromiumWebBrowser)browserControl;

            chromiumWebBrowser.Invoke(new Action(() =>
            {
                if (chromiumWebBrowser.FindForm() is BrowserForm owner)
                {
                    var popup = new BrowserForm(targetUrl, true, owner.Visible);
                    owner.AddOwnedForm(popup);
                    var rect = popup.ClientRectangle;
                    popup.CreateControl();
                    windowInfo.SetAsChild(popup.Handle, rect.Left, rect.Top, rect.Right, rect.Bottom);
                }
            }));

            return(false);
        }
 public void StartBrowser()
 {
     try
     {
         var form = new BrowserForm(App.HtmlDirPath)
         {
             App = App
         };
         Core.Application.BootingBrowserForms.Add(form);
         form.Show();
     }
     catch (System.IO.FileNotFoundException ex)
     {
         App.Logger.Error(ex);
         App.Logger.Error($"見つからなかったファイル: {ex.FileName}");
         App.Logger.Error($"FusionLog: {ex.FusionLog}");
         Util.ShowErrorMessage("必要なファイルが読み込めなかったため、ブラウザコントロールの初期化に失敗しました。");
         Core.Application.Quit();
     }
 }
 public CustomObject(ChromiumWebBrowser chromiumWebBrowser, BrowserForm browserForm)
 {
     _chromiumWebBrowser = chromiumWebBrowser;
     _browserForm        = browserForm;
 }
Example #22
0
 public Others(BrowserForm form)
 {
     _browserForm = form;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="BrowserCallbackJs"/> class.
 /// </summary>
 /// <param name="caller">The parent caller.</param>
 public BrowserCallbackForJs(BrowserForm caller)
 {
     this.caller = caller;
 }
Example #24
0
 public DownloadHandler(BrowserForm form)
 {
     mainForm = form;
 }
        public static void RunScrapping(BrowserForm browserForm, string spreadsheet, IList <Annonce> annonces)
        {
            var tensiometre = LocServiceService.Instance;
            var villeIdeale = VilleIdealeService.Instance;

            foreach (var annonce in annonces)
            {
                System.Threading.Thread.Sleep(5200);
                //using for IDisposable.Dispose()
                using (WebClient client = new WebClient())
                {
                    browserForm.LoadUrl(annonce.url);
                    System.Threading.Thread.Sleep(3450);
                    dynamic data     = new System.Dynamic.ExpandoObject();
                    string  achatUrl = null;

                    data.quartier = WebUtils.retrieveData(browserForm, "//div[@class='Summarystyled__Address-tzuaot-5 jqlODu']/span");
                    data.prix     = WebUtils.retrieveData(browserForm, "(//span[@class='global-styles__TextNoWrap-sc-1aeotog-6 dVzJN'])[1]");
                    var ressult = WebUtils.retrieveData(browserForm, "//div[@class='Summarystyled__Address-tzuaot-5 jqlODu']");
                    if (ressult.Contains(','))
                    {
                        data.lieu = ressult.Split(',')[1].Trim();
                    }
                    else
                    {
                        data.lieu = ressult;
                    }
                    ressult      = WebUtils.retrieveData(browserForm, "concat((//div[@class='EstateSummary__SummaryText-sc-13fov8-0 bullet EstateSummary__SummaryTag-sc-13fov8-8 hOzXeX'])[0] , '_', (//div[@class='EstateSummary__SummaryText-sc-13fov8-0 bullet EstateSummary__SummaryTag-sc-13fov8-8 hOzXeX'])[1] , '_', (//div[@class='EstateSummary__SummaryText-sc-13fov8-0 bullet EstateSummary__SummaryTag-sc-13fov8-8 hOzXeX'])[2] , '_',  (//div[@class='EstateSummary__SummaryText-sc-13fov8-0 bullet EstateSummary__SummaryTag-sc-13fov8-8 hOzXeX'])[3])");
                    data.surface = ressult.Split('_').FirstOrDefault((x) => (x.Contains("²")));
                    data.type    = ressult.Split('_').FirstOrDefault((x) => (x.Contains("pi")));
                    achatUrl     = WebUtils.retrieveData(browserForm, "//a[@class='RealEstatePriceLink__Link-sc-1wcupem-0 wdjdG']/@href");
                    var locationUrl = achatUrl.Replace("/vente/", "/location/");

                    browserForm.LoadUrl(achatUrl);
                    System.Threading.Thread.Sleep(3450);
                    data.vendu          = WebUtils.retrieveData(browserForm, "//div[contains(@title,'vendus') and @class='sc-iBEsjs coLLbW']");
                    data.avendre        = WebUtils.retrieveData(browserForm, "//div[contains(@title,'marché') and @class='sc-iBEsjs coLLbW']");
                    data.ventem2        = WebUtils.retrieveData(browserForm, "//div[@class='sc-dvCyap llazGV']");
                    data.nombreLogement = WebUtils.retrieveData(browserForm, "//div[@data-testid='market.numbers-total-residence']").Replace(" ", "");

                    browserForm.LoadUrl(locationUrl);
                    System.Threading.Thread.Sleep(5049);
                    //data.locationm2 = WebUtils.retrieveData(browserForm, "//div[@class='sc-dvCyap llazGV']");
                    data.locationm2 = WebUtils.retrieveData(browserForm, "(//div[@class='sc-dxZgTM jDZMAf'])[2]/div").Replace("Prix bas : ", "").Replace(" ", "").Replace("€", "");
                    data.aloue      = WebUtils.retrieveData(browserForm, "//div[contains(@title,'marché') and @class='sc-iBEsjs coLLbW']");
                    data.recherche  = WebUtils.retrieveData(browserForm, "//div[@class='sc-cugefK eIAcnA']");

                    LmnpSimuatorResult result2515 = new LmnpSimuatorResult(), result2015 = new LmnpSimuatorResult(), result253000 = new LmnpSimuatorResult(), result203000 = new LmnpSimuatorResult();

                    if (!string.IsNullOrEmpty(data.prix) && !string.IsNullOrEmpty(data.locationm2) && !string.IsNullOrEmpty(data.surface))
                    {
                        var price    = decimal.Parse(((string)data.prix).Replace("€", "").Replace(" ", ""));
                        var location = decimal.Parse(((string)data.locationm2).Replace("€", "").Replace("m²", "").Replace(" ", ""));
                        var surface  = decimal.Parse(((string)data.surface).Replace("m²", "").Replace(" ", ""));

                        result2515 = LmnpSimulatorService.GetSimulatorResult(price, location * surface, surface, 25, 15000, 0);
                        System.Threading.Thread.Sleep(1000);
                        result2015 = LmnpSimulatorService.GetSimulatorResult(price, location * surface, surface, 20, 15000, 0);
                        System.Threading.Thread.Sleep(1000);
                        result253000 = LmnpSimulatorService.GetSimulatorResult(price, location * surface, surface, 25, 30000, 0);
                        System.Threading.Thread.Sleep(1000);
                        result203000 = LmnpSimulatorService.GetSimulatorResult(price, location * surface, surface, 20, 30000, 0);
                    }

                    var tension = tensiometre.TensionMarket(browserForm, data.lieu);
                    var notesVilles = villeIdeale.TensionMarket(browserForm, data.lieu);

                    web_scraper.Services.SheetService.Save(spreadsheet, annonce.Date, data.lieu, data.quartier, data.prix, data.surface, data.ventem2, data.locationm2,
                                                           annonce.url, data.vendu, data.avendre, data.aloue, data.type, data.recherche, data.nombreLogement,
                                                           result2015.BeneficeParMois, result2015.BeneficeSansRevente, result2015.BeneficeAvecRevente,
                                                           result2515.BeneficeParMois, result2515.BeneficeSansRevente, result2515.BeneficeAvecRevente,
                                                           result253000.BeneficeParMois, result253000.BeneficeSansRevente, result253000.BeneficeAvecRevente,
                                                           result203000.BeneficeParMois, result203000.BeneficeSansRevente, result203000.BeneficeAvecRevente,
                                                           tension.EasyLocation, tension.BudgetLocation,
                                                           notesVilles.Environnement,
                                                           notesVilles.Transports,
                                                           notesVilles.Sécurite,
                                                           notesVilles.Sante,
                                                           notesVilles.SportsEtLoisirs,
                                                           notesVilles.Culture,
                                                           notesVilles.Enseignement,
                                                           notesVilles.Commerces,
                                                           notesVilles.QualiteDeVie);
                }
            }
        }
Example #26
0
        public static void Main(string[] args)
        {
            Application.EnableVisualStyles();

            ILocalConfigManager configManager = new LocalConfigManager();

            configManager.AdjustPortValues();

            ICommunicationManager communicationManager = new CommunicationManager(configManager);

            ICommandParser commandParser = new CommandParser(configManager);

            communicationManager.OnMessage    += msg => Console.WriteLine($"Msg from app: {msg}");
            communicationManager.OnAppStarted += msg => _appLoaded = true;
            communicationManager.Start();

            ConsoleProcess consoleProcess = new ConsoleProcess(commandParser.ParseCommand(), bool.Parse(configManager.GetConfig(LocalConfigKeys.ShowCmd)));

            consoleProcess.ExecuteCommand();

            long connectionTimeout     = long.Parse(configManager.GetConfig(LocalConfigKeys.AppStartTimeout));
            long connectionElapsedTime = 0L;

            while (!_appLoaded)
            {
                connectionElapsedTime += 1;
                Thread.Sleep(1);

                if (connectionElapsedTime > connectionTimeout)
                {
                    MessageBox.Show("App was not started", "Error");
                    consoleProcess.Kill();
                    return;
                }
            }

            InitCef();
            //TODO: add utility class for this.
            BrowserForm form = new BrowserForm(commandParser.ParseBaseUrl())
            {
                Width       = int.Parse(configManager.GetConfig(LocalConfigKeys.WindowWidth)),
                Height      = int.Parse(configManager.GetConfig(LocalConfigKeys.WindowHeight)),
                WindowState = bool.Parse(configManager.GetConfig(LocalConfigKeys.WindowMaximizedState)) ? FormWindowState.Maximized : FormWindowState.Normal
            };

            form.SizeChanged += (sender, eventArgs) =>
            {
                configManager.SetConfig(LocalConfigKeys.WindowWidth, form.Width.ToString());
                configManager.SetConfig(LocalConfigKeys.WindowHeight, form.Height.ToString());
            };

            form.FormClosing += (sender, eventArgs) =>
            {
                configManager.SetConfig(LocalConfigKeys.WindowMaximizedState, (form.WindowState == FormWindowState.Maximized).ToString());
                configManager.Save();
                communicationManager.SendStopMessage();
                consoleProcess.Kill();
                Environment.Exit(0);
            };

            Application.Run(form);
        }
Example #27
0
 public ExposedClass(ChromiumWebBrowser browser, BrowserForm form)
 {
     //Add asserts
     _browser = browser;
     _form    = form;
 }
Example #28
0
 public PlusHubs(BrowserForm form)
 {
     _browserForm = form;
 }
Example #29
0
        private void EnsureShowAndPlaceNonChartWindow(NonChartWindowSettings wndSets)
        {
            var wnd = MdiChildren.FirstOrDefault(c => c is IMdiNonChartWindow &&
                                                 ((IMdiNonChartWindow)c).WindowCode == wndSets.Window);

            if (wnd == null)
            {
                // создать окно
                if (wndSets.Window == NonChartWindowSettings.WindowCode.Account)
                {
                    wnd = new AccountMonitorForm {
                        MdiParent = this
                    }
                }
                ;

                else if (wndSets.Window == NonChartWindowSettings.WindowCode.RobotTest)
                {
                    wnd = new RoboTesterForm();
                    ((RoboTesterForm)wnd).OnRobotResultsBoundToCharts += OnRobotResultsBoundToCharts;
                }

                else if (wndSets.Window == NonChartWindowSettings.WindowCode.Profit)
                {
                    wnd = new AccountTradeResultsForm {
                        InstantCalculation = false
                    }
                }
                ;

                else if (wndSets.Window == NonChartWindowSettings.WindowCode.Chat)
                {
                    wnd = new ChatForm();
                }

                else if (wndSets.Window == NonChartWindowSettings.WindowCode.Quotes)
                {
                    wnd = new QuoteTableForm();
                }

                else if (wndSets.Window == NonChartWindowSettings.WindowCode.Subscription)
                {
                    wnd = new SubscriptionForm();
                }

                else if (wndSets.Window == NonChartWindowSettings.WindowCode.WebBrowser)
                {
                    wnd = new BrowserForm();
                }

                else if (wndSets.Window == NonChartWindowSettings.WindowCode.RiskForm)
                {
                    wnd = new RiskSetupForm();
                }

                else if (wndSets.Window == NonChartWindowSettings.WindowCode.WalletForm)
                {
                    wnd = new WalletForm();
                }

                SetupNonMdiForm((IMdiNonChartWindow)wnd);
                wnd.Show();
            }
            else
            {
                wnd.Focus();
            }

            // установить окну положенные размеры
            wnd.Location    = wndSets.WindowPos;
            wnd.Size        = wndSets.WindowSize;
            wnd.WindowState = (FormWindowState)Enum.Parse(typeof(FormWindowState), wndSets.WindowState);
            ((IMdiNonChartWindow)wnd).WindowInnerTabPageIndex = wndSets.CurrentTabIndex;
        }