Example #1
0
 public FormViewer()
 {
     InitializeComponent();
     if (Environment.Is64BitOperatingSystem)
     {
         Xpcom.Initialize("firefox64");
     }
     else
     {
         Xpcom.Initialize("firefox");
     }
     GeckoPreferences.Default["network.proxy.type"]             = 1;
     GeckoPreferences.Default["network.proxy.socks"]            = "127.0.0.1";
     GeckoPreferences.Default["network.proxy.socks_port"]       = 9050;
     GeckoPreferences.Default["network.proxy.socks_remote_dns"] = true;
     GeckoPreferences.Default["network.proxy.socks_version"]    = 5;
     _allRouters       = null;
     _closing          = false;
     this.FormClosing += this_FormClosing;
     //this.Shown += this_Shown;
     niViewer.DoubleClick   += ni_DoubleClick;
     tsmiOpen.Click         += tsmiOpen_Click;
     tsmiClose.Click        += tsmiClose_Click;
     txtAddress.KeyDown     += address_KeyDown;
     txtAddress.TextChanged += address_TextChanged;
     _wssClient              = new WebSocket("wss://pushansiber.com:2222");
     _wssClient.OnOpen      += client_Connected;
     _wssClient.OnMessage   += client_MessageReceived;
     _wssClient.OnError     += client_Error;
     gwbMain.Navigated      += gwbMain_Navigated;
 }
Example #2
0
        public static void SetUpXulRunner()
        {
            try
            {
#if __MonoCS__
                string initXulRunnerOption = Environment.GetEnvironmentVariable("WESAY_INIT_XULRUNNER") ?? String.Empty;
                // Initialize XULRunner - required to use the geckofx WebBrowser Control (GeckoWebBrowser).
                string xulRunnerLocation = XULRunnerLocator.GetXULRunnerLocation();
                if (String.IsNullOrEmpty(xulRunnerLocation))
                {
                    throw new ApplicationException("The XULRunner library is missing or has the wrong version");
                }
                string librarySearchPath = Environment.GetEnvironmentVariable("LD_LIBRARY_PATH") ?? String.Empty;
                if (!librarySearchPath.Contains(xulRunnerLocation))
                {
                    throw new ApplicationException("LD_LIBRARY_PATH must contain " + xulRunnerLocation);
                }

                Xpcom.Initialize(xulRunnerLocation);
                GeckoPreferences.User["gfx.font_rendering.graphite.enabled"] = true;
#endif
            }
            catch (ApplicationException e)
            {
                ErrorReport.NotifyUserOfProblem(e.Message);
            }
            catch (Exception e)
            {
                ErrorReport.NotifyUserOfProblem(e.Message);
            }
        }
Example #3
0
        public static void Main(string[] args)
        {
            // Uncomment the follow line to enable CustomPrompt's
            GeckoWebBrowser.UseCustomPrompt();

            // If you want to further customize the GeckoFx PromptService then
            // you will need make a class that implements nsIPromptService2 and nsIPrompt interfaces and
            // set the PromptFactory.PromptServiceCreator delegate. for example:
            // PromptFactory.PromptServiceCreator = () => new MyPromptService();

#if GTK
            if (!Environment.GetEnvironmentVariable("LD_LIBRARY_PATH").Contains("/usr/lib/firefox/"))
            {
                throw new ApplicationException(String.Format("LD_LIBRARY_PATH must contain {0}", "/usr/lib/firefox/"));
            }

            Xpcom.Initialize("/usr/lib/firefox/");
#else
            Xpcom.Initialize(XULRunnerLocator.GetXULRunnerLocation());
#endif
            // Uncomment the follow line to enable CustomPrompt's
            // GeckoPreferences.User["browser.xul.error_pages.enabled"] = false;

            GeckoPreferences.User["gfx.font_rendering.graphite.enabled"] = true;

            Application.ApplicationExit += (sender, e) =>
            {
                Xpcom.Shutdown();
            };

            //Application.Idle += (s, e) => Console.WriteLine(SynchronizationContext.Current);
            Application.Run(new MyForm());
        }
        private void Plays_Load(object sender, EventArgs e)
        {
            //Starts the Gecko browser
            Xpcom.Initialize("Firefox");
            geckoWebBrowser = new GeckoWebBrowser
            {
                Dock        = System.Windows.Forms.DockStyle.Bottom,
                Location    = new System.Drawing.Point(0, 0),
                MinimumSize = new System.Drawing.Size(479, 293),
                Name        = "geckoBrowser",
                Size        = new System.Drawing.Size(479, 293),
                MaximumSize = new System.Drawing.Size(479, 293),
                TabIndex    = 1
            };

            //Hides the browser for the end user
            this.Controls.Add(geckoWebBrowser);
            geckoWebBrowser.Hide();

            //Deletes the temp file
            File.Delete(AppDomain.CurrentDomain.BaseDirectory + "temporary.zip");

            //Starts the process
            Load0SiteAsync();
        }
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            var profileDir         = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\活動記録システム";
            var isExistsProfileDir = Directory.Exists(profileDir);

            if (!isExistsProfileDir)
            {
                Directory.CreateDirectory(profileDir);
            }
            Xpcom.ProfileDirectory = profileDir;

            var exePath = Environment.GetCommandLineArgs()[0];
            var dir     = exePath.Substring(0, exePath.LastIndexOf(Path.DirectorySeparatorChar) + 1);

            Xpcom.Initialize(dir + "xulrunner");

            var profilePath = profileDir + "\\活動記録システム.conf";

            if (isExistsProfileDir)
            {
                GeckoPreferences.Load(profilePath);
            }
            else
            {
                InitializeGeckoPreferences(profilePath);
            }

            MainWindow = new MainWindow();
            MainWindow.Show();
        }
Example #6
0
 public BrowserWindow()
 {
     _windows = new LowLevelWindowsListener();
     _closed  = false;
     InitializeComponent();
     Xpcom.Initialize("Firefox");
 }
Example #7
0
        public TestGecko()
        {
            Xpcom.Initialize(CrawlerManager.XULRunnerPath);                                   //设置xpcom等组件的目录
            if (Directory.Exists(CachePath))                                                  //设置缓存目录
            {
                Xpcom.ProfileDirectory = CachePath;
            }
            else
            {
                Directory.CreateDirectory(CachePath);
                Xpcom.ProfileDirectory = CachePath;
            }
            //var cookieMan = Xpcom.GetService<nsICookieManager>("@mozilla.org/cookiemanager;1");
            //cookieMan = Xpcom.QueryInterface<nsICookieManager>(cookieMan);

            //Gecko.GeckoPreferences.User["permissions.default.image"] = 2;            //禁用图片
            //Gecko.GeckoPreferences.User["network.image.imageBehavior"] = 2;          //禁用图片
            //Gecko.GeckoPreferences.User["permissions.default.stylesheet"] = 2;       //禁用css
            //Gecko.GeckoPreferences.User["browser.link.open_newwindow.restriction"] = 1;       //不打开任何新的窗口


            //Gecko.GeckoPreferences.User["browser.history_expire_days"] = 3;          //浏览历史过期天数
            //Gecko.GeckoPreferences.User["browser.history_expire_days_min"] = 3;
            //Gecko.GeckoPreferences.User["browser.cache.memory.capacity"] = 65536;    //FF的内存缓存
            //Gecko.GeckoPreferences.User["browser.sessionhistory.max_total_viewers"] = 0;    //禁用“上一页”

            //Gecko.GeckoPreferences.User["network.http.pipelining"] = true;
            //启用Pipeline
            InitializeComponent();
        }
Example #8
0
 public User(string un, string uid)
 {
     Username = un;
     UserID   = uid;
     InitializeComponent();
     Xpcom.Initialize("Firefox");
 }
        public MainWindow()
        {
            InitializeComponent();

            Xpcom.Initialize("Firefox");
            inputSimulator = new InputSimulator();
        }
Example #10
0
 static void Main()
 {
     Xpcom.Initialize("Firefox");
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     Application.Run(new Form1());
 }
Example #11
0
 /*
  *
  *
  * _________                                     ____  __.           __              __________
  * /   _____/____     ____   ____ ___________    |    |/ _|____      |__| _____   ____\______   \
  \_____  \\__  \   / ___\ /  _ \\____ \__  \   |      < \__  \     |  |/     \_/ __ \|       _/
  * /        \/ __ \_/ /_/  >  <_> )  |_> > __ \_ |    |  \ / __ \_   |  |  Y Y  \  ___/|    |   \
  * /_______  (____  /\___  / \____/|   __(____  / |____|__ (____  /\__|  |__|_|  /\___  >____|_  /
  \/     \//_____/        |__|       \/          \/    \/\______|     \/     \/       \/
  *
  *
  * */
 public Form1()
 {
     InitializeComponent();
     Xpcom.Initialize("Firefox");
     PromptFactory.PromptServiceCreator    = () => new FilteredPromptService(); // javascript uyarı mesajlarını kapamak için.
     ServicePointManager.Expect100Continue = true;
     ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls12;
     if (Properties.Settings.Default.BeniHatirla != "")
     {
         checkBox1.Checked = true;
         textBox1.Text     = Properties.Settings.Default.BeniHatirla.Split('|')[0];
         textBox1.Text     = Properties.Settings.Default.BeniHatirla.Split('|')[1];
     }
     if (Properties.Settings.Default.Timer != "")
     {
         numericUpDown1.Value = int.Parse(Properties.Settings.Default.Timer);
     }
     if (Properties.Settings.Default.ses_dosyasi != string.Empty)
     {
         textBox3.Text     = Properties.Settings.Default.ses_dosyasi;
         checkBox3.Checked = true;
     }
     else
     {
         textBox3.Text = Environment.CurrentDirectory + "\\notify.wav";
     }
 }
Example #12
0
        static void Main()
        {
            string xulRunnerLocation = XULRunnerLocator.GetXULRunnerLocation();

            if (String.IsNullOrEmpty(xulRunnerLocation))
            {
                throw new ApplicationException("The XULRunner library is missing or has the wrong version");
            }
            string librarySearchPath = Environment.GetEnvironmentVariable("LD_LIBRARY_PATH") ?? String.Empty;

            if (!librarySearchPath.Contains(xulRunnerLocation))
            {
                throw new ApplicationException("LD_LIBRARY_PATH must contain " + xulRunnerLocation);
            }

            Xpcom.Initialize(xulRunnerLocation);

            var form      = new Form();
            var myBrowser = new GeckoWebBrowser {
                Dock = DockStyle.Fill
            };

            myBrowser.Navigate("https://duckduckgo.com/");
            form.Controls.Add(myBrowser);
            Application.Run(form);
        }
 public eyeBrowserForm()
 {
     InitializeComponent();
     Xpcom.Initialize("Firefox");
     linkSelector            = new LinkSelector();
     zoomHandler             = new ZoomHandler(browserControl);
     keyboard.Favorites      = favoritesPanel;
     favoritesPanel.Keyboard = keyboard;
     linkSelectorStatus      = false;
     linkNavigatorStatus     = false;
     progressiveZoomStatus   = false;
     immediateZoomStatus     = false;
     freePointingStatus      = false;
     circleTimer             = new Timer
     {
         Interval = 35
     };
     tickCounter       = 0;
     circleCenter      = new Point(1, 1);
     circleTimer.Tick += (sender, e) =>
     {
         CountTimerTicks();
     };
     eyeTrackingHandler = new EyeTrackingHandler(browserControl, scrollPanel, keyboard, favoritesPanel, clickButton, popupPanel);
     Cursor.Hide();
 }
Example #14
0
 public Form1()
 {
     InitializeComponent();
     Xpcom.Initialize("Firefox");
     GeckoPreferences.User["full-screen-api.enabled"]    = true;
     GeckoPreferences.Default["full-screen-api.enabled"] = true;
 }
Example #15
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Xpcom.Initialize("Firefox");
            Util.DataFolder = Path.Combine(Util.DataFolder, Application.CompanyName, Application.ProductName);
            Logger.Init(Path.Combine(Util.DataFolder, Application.ProductVersion, DateTime.Now.ToString("s").Replace(":", "-")), true);
            Logger.WriteEvent("Launch {0} {1}", Application.ProductName, Application.ProductVersion);
            AddAnySample();
            var randomName = Path.GetTempFileName();

            if (File.Exists(randomName))
            {
                File.Delete(randomName);
            }
            var indexFullName = GetResource.CreateResources(Path.GetFileNameWithoutExtension(randomName));

            Util.Folder = Path.GetDirectoryName(indexFullName);
            GetResource.AddLocalization(Util.Folder);
            var startInfo = new ProcessStartInfo
            {
                FileName               = "mono",
                Arguments              = $@"SimpleServer.exe 3010 ""{Util.Folder}""",
                WindowStyle            = ProcessWindowStyle.Hidden,
                RedirectStandardOutput = true,
                UseShellExecute        = false
            };

            using (var reactProcess = new Process {
                StartInfo = startInfo
            })
            {
                reactProcess.Start();
                var f = new Form {
                    Size = new Size(1250, 722), MinimumSize = new Size(1055, 270), WindowState = FormWindowState.Maximized
                };
                _browser = new TrappingGecko {
                    Dock = DockStyle.Fill, UseHttpActivityObserver = true
                };
                f.Text = $"{Application.ProductName}  {Application.ProductVersion}";
                f.Controls.Add(_browser);
                var portAddr = GetPortAddr(reactProcess);
                _browser.Navigate($"http://localhost:{portAddr}");
                Application.Run(f);
                reactProcess.Kill();
                reactProcess.WaitForExit();
            }

            var apiFolder = Path.Combine(Util.Folder, "api");

            if (Directory.Exists(apiFolder))
            {
                Directory.Delete(apiFolder, true);                      // remove all api related files
            }
            foreach (var fullPath in Util.SupportFile)
            {
                File.Delete(fullPath);
                Util.DeleteFolder(fullPath);
            }
        }
Example #16
0
        private static void InitGeckoFx()
        {
            // Perform dependency check to make sure all relevant resources are in our output directory.
            // Discarded: var settings = new CefSettings();

            FormSplash.SetStatus(FormSplash.MsgInitGeckoFXEngine, 0);

            string cachePath = Path.Combine(Environment.GetEnvironmentVariable("LOCALAPPDATA"), "vamp#", "geckofx_cache");

            if (!Directory.Exists(cachePath))
            {
                Directory.CreateDirectory(cachePath);
            }

            Xpcom.ProfileDirectory = cachePath;

            string GeckoDLLPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "Firefox" + (Environment.Is64BitProcess ? "_x64" : "_x86"));

            ExceptionLogger.LogMessage(GeckoDLLPath);

            Xpcom.Initialize(GeckoDLLPath);

            GeckoPreferences.User["browser.cache.disk.enable"]         = true;
            GeckoPreferences.User["browser.cache.memory.enable"]       = true;
            GeckoPreferences.User["browser.cache.check doc frequency"] = 3;
            GeckoPreferences.User["browser.cache.disk.capacity"]       = 50000;
            GeckoPreferences.User["browser.cache.memory.capacity()"]   = -1;
            GeckoPreferences.User["full-screen-api.enabled"]           = true;


            FormSplash.SetStatus(FormSplash.MsgInitGeckoFXEngine, 100);
        }
Example #17
0
        public Login(string Target)
        {
            InitializeComponent();

            _target = Target;

            Xpcom.Initialize("Firefox");
            GeckoPreferences.User["plugin.state.flash"] = true;
            GeckoPreferences.User["browser.xul.error_pages.enabled"]     = true;
            GeckoPreferences.User["media.navigator.enabled"]             = true;
            GeckoPreferences.User["media.navigator.permission.disabled"] = true;

            Navegador.NSSError += (object sender, Gecko.Events.GeckoNSSErrorEventArgs e) =>
            {
                if (e.Message.Contains("Certificate"))
                {
#pragma warning disable CS0618 // O tipo ou membro é obsoleto
                    CertOverrideService.GetService().RememberRecentBadCert(e.Uri, e.SSLStatus);
#pragma warning restore CS0618 // O tipo ou membro é obsoleto
                    Navegador.Navigate(e.Uri.AbsoluteUri);
                    e.Handled = true;
                }
            };
            Navegador.Navigated += Navegador_Navigated;
            Navegador.Navigate(_target);
            Refresh();
        }
Example #18
0
        public MainWindow()
        {
            InitializeComponent();

            Xpcom.Initialize("Firefox");

            #region 频闭某些无用的部分
            GeckoPreferences.Default["permissions.default.stylesheet"]           = 1;     //启用css
            GeckoPreferences.Default["browser.xul.error_pages.enabled"]          = true;  //不弹出错误窗口
            GeckoPreferences.Default["browser.link.open_newwindow.restriction"]  = 1;     //不打开任何新的窗口
            GeckoPreferences.Default["browser.history_expire_days"]              = 1;     //浏览历史过期天数
            GeckoPreferences.Default["browser.history_expire_days_min"]          = 3;
            GeckoPreferences.Default["browser.cache.memory.capacity"]            = 65536; //FF的内存缓存
            GeckoPreferences.Default["browser.sessionhistory.max_total_viewers"] = 0;     //禁用“上一页”
            GeckoPreferences.Default["privacy.popups.disable_from_plugins"]      = 3;     //禁用所有弹出框
            GeckoPreferences.Default["privacy.popups.showBrowserMessage"]        = false; //禁用弹出框提示
            GeckoPreferences.Default["privacy.popups.policy"]           = 2;              //禁用所有弹出框
            GeckoPreferences.Default["browser.popups.showPopupBlocker"] = false;
            GeckoPreferences.Default["dom.popup_maximum"]                   = 0;
            GeckoPreferences.Default["network.http.pipelining"]             = true; //启用Pipeline
            GeckoPreferences.Default["dom.disable_open_during_load"]        = true; //禁用页面载入时弹出框
            GeckoPreferences.Default["dom.successive_dialog_time_limit"]    = 0;
            GeckoPreferences.Default["gfx.font_rendering.graphite.enabled"] = true;
            #endregion

            geckoWebBrowser.CreateWindow      += GeckoWebBrowser_CreateWindow;
            geckoFormHost.Child                = geckoWebBrowser;
            geckoWebBrowser.DocumentCompleted += GeckoWebBrowser_DocumentCompleted;

            geckoWebBrowser.Navigate("about:blank");
        }
Example #19
0
        public App()
        {
            Xpcom.EnableProfileMonitoring = false;
            Xpcom.Initialize("Firefox");

            GeckoPreferences.User["general.useragent.override"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36";
        }
    public void RunBeforeAnyTestInAssembly()
    {
#if !DEBUG
        if (Xpcom.IsWindows && Xpcom.Is32Bit)
        {
            var proc     = System.Diagnostics.Process.GetCurrentProcess();
            var assembly = Assembly.LoadFrom(proc.MainModule.FileName);

            if (!IsLargeAware(assembly.Location))
            {
                Assert.Fail($"Tests are not running in LargeAddressAware environment. Run \"%VS140COMNTOOLS%..\\..\\VC\\bin\\editbin\" /LARGEADDRESSAWARE {assembly.Location}");
            }
        }
#endif

        // Run all these tests using a turkish locale
        var ci = new CultureInfo("tr-TR");
        Thread.CurrentThread.CurrentUICulture = ci;
        Thread.CurrentThread.CurrentCulture   = ci;

        // Needed when single unittests are run
        var xulrunnerPath = XpComTests.XulRunnerLocation;
        // The following line is useful to Tom Please don't delete.
        //xulrunnerPath = @"C:\mozilla-release\obj-i686-pc-mingw32\dist\bin";
        Xpcom.Initialize(xulrunnerPath);
    }
Example #21
0
        private void BrowserLoad(object sender, EventArgs e)
        {
            Xpcom.Initialize("Firefox");

            nsICookieManager CookieMan;

            CookieMan = Xpcom.GetService <nsICookieManager>("@mozilla.org/cookiemanager;1");
            CookieMan = Xpcom.QueryInterface <nsICookieManager>(CookieMan);
            CookieMan.RemoveAll();

            GeckoPreferences.User["browser.xul.error_pages.enabled"] = false;
            GeckoPreferences.User["browser.download.manager.showAlertOnComplete"] = false;
            GeckoPreferences.User["security.warn_viewing_mixed"]       = false;
            GeckoPreferences.User["privacy.popups.showBrowserMessage"] = false;
            GeckoPreferences.User["browser.xul.error_pages.enabled"]   = true;

            browserPanel.Visible = false;

            browser = new GeckoWebBrowser()
            {
                Dock = DockStyle.Fill
            };
            browser.NoDefaultContextMenu = true;
            browser.Navigated           += BrowserNavigated;

            Controls.Add(browser);

            browser.Navigate(Url);
        }
Example #22
0
        public Tarayici(List <string> url, List <string> proxy_listesi, string prxy_turu, bool
                        popup_show, List <string> referer, List <string> user_agents, int time_out, string ID)
        {
            InitializeComponent();
            Xpcom.Initialize("Firefox");
            URL_Listesi.AddRange(url);
            prxy_lstesi.AddRange(proxy_listesi);
            referer_listesi.AddRange(referer);
            user_Agent_listesi.AddRange(user_agents);
            tur         = prxy_turu;
            ppup        = popup_show;
            geri_sayim  = time_out;
            geri_sayim2 = geri_sayim;
            id          = ID;

            GeckoPreferences.User["browser.xul.error_pages.enabled"] = true;
            GeckoPreferences.Default["network.proxy.type"]           = 1;

            Rastgele_url         = URL_Listesi[new Random().Next(0, URL_Listesi.Count - 1)]; kullanilanlar.Add(Rastgele_url);
            Rastgele_prxy        = prxy_lstesi[new Random().Next(0, prxy_lstesi.Count - 1)]; kullanilanlar.Add(Rastgele_prxy);
            Rastgele_referer     = referer_listesi[new Random().Next(0, referer_listesi.Count - 1)]; kullanilanlar.Add(Rastgele_referer);
            Rastgele_user_agents = user_Agent_listesi[new Random().Next(0, user_Agent_listesi.Count - 1)]; kullanilanlar.Add(Rastgele_user_agents);

            Ana_Islem();
        }
Example #23
0
        private Player()
        {
            Xpcom.Initialize(Path.GetDirectoryName(Application.ExecutablePath) + "\\xulrunner");

            InitializeComponent();

            bool fits = false;

            foreach (Screen sc in Screen.AllScreens)
            {
                if (sc.Bounds.Contains(Settings.FullPlayerLocation))
                {
                    fits = true;
                    break;
                }
            }

            if (!fits)
            {
                this.StartPosition = FormStartPosition.CenterScreen;
            }
            else
            {
                this.StartPosition = FormStartPosition.Manual;
                this.Location      = Settings.FullPlayerLocation;
                this.Size          = Settings.FullPlayerSize;
            }

            this.WindowState = Settings.FullPlayerState;
        }
Example #24
0
        //private static bool IsSingleInstance()
        //{
        //    _mutex = new Mutex(false, "RelayMutex");
        //    GC.KeepAlive(_mutex);
        //    try
        //    {
        //        return _mutex.WaitOne(0, false);
        //    }
        //    catch (AbandonedMutexException)
        //    {
        //        _mutex.ReleaseMutex();
        //        return _mutex.WaitOne(0, false);
        //    }
        //}

        protected override void OnStartup(System.Windows.StartupEventArgs e)
        {
            bool createdMutex;

            this.ShutdownMode = IsRelease == true ? ShutdownMode.OnExplicitShutdown : ShutdownMode.OnMainWindowClose;

            _mutex = new Mutex(true, "MyApplicationMutex", out createdMutex);

            GeckoWebBrowser.UseCustomPrompt();
            Xpcom.Initialize(System.AppDomain.CurrentDomain.BaseDirectory + "xulrunner");
            GeckoPreferences.Default["extensions.blocklist.enabled"] = false;
            RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;

            if (!createdMutex)
            {
                _mutex = null;
                MessageBox.Show("The application is already running.");
                Application.Current.Shutdown();
                return;
            }
            else
            {
                ;
            }

            base.OnStartup(e);
        }
Example #25
0
        /// <summary>
        /// 只打开一个进程
        /// </summary>
        /// <param name="e"></param>
        protected override void OnStartup(StartupEventArgs e)
        {
            Process currentProcess = Process.GetCurrentProcess();

            Process[] processes = Process.GetProcessesByName(currentProcess.ProcessName);
            int       count     = processes.Count();

            if (count > 1)
            {
                if (IsIconic(processes[0].MainWindowHandle))
                {
                    ShowWindowAsync(processes[0].MainWindowHandle, SW_RESTORE);
                }
                SetForegroundWindow(processes[0].MainWindowHandle);

                SendWindowsStringMessage(processes[0].MainWindowHandle.ToInt32(), Config.command);
                App.Current.Shutdown();
            }
            else
            {
                // base.OnStartup(e);
                RemoveTrayIcon();
                AddTrayIcon();
            }

            loadConfig();
            Xpcom.Initialize(Path.Combine(ExecutionEnvironment.DirectoryOfExecutingAssembly, "xulrunner"));
            Gecko.GeckoPreferences.Default["extensions.blocklist.enabled"] = false;
            Gecko.PromptFactory.PromptServiceCreator = () => new MyCustomPromptService();
        }
Example #26
0
        public frm_Main(ObservableCollection <LogEvent> LogEvents)
        {
            InitializeComponent();

            // Initialize Browser
            Xpcom.Initialize("Firefox");

            BrowserContainer browserContainer = new BrowserContainer()
            {
                Dock = DockStyle.Fill
            };

            this.splitContainerControl1.Panel2.Controls.Add(browserContainer);
            this.Browser = browserContainer.Browser;

            Browser.UseHttpActivityObserver   = true;
            Browser.ObserveHttpModifyRequest += Browser_ObserveHttpModifyRequest;
            Browser.DocumentCompleted        += Browser_DocumentCompleted;

            ResponseObserver responseObserver = new ResponseObserver();

            responseObserver.AuthResponseReceived   += ResponseObserver_AuthResponseReceived;
            responseObserver.SearchResponseReceived += ResponseObserver_SearchResponseReceived;;
            ObserverService.AddObserver(responseObserver);

            // Initialize Variables
            this.LogEvents       = LogEvents;
            this.countryWiseData = new Dictionary <string, List <ExportData> >();
        }
Example #27
0
        static void Main(string[] args)
        {
            // Needed when single unittests are run
            var xulrunnerPath = XpComTests.XulRunnerLocation;

            //xulrunnerPath = @"C:\mozilla-central\obj-i686-pc-mingw32\dist\bin";
            Xpcom.Initialize(xulrunnerPath);
            OverrideX11ErrorHandler();

            string prefix   = Xpcom.IsLinux ? "--" : "/";
            string nothread = prefix + "nothread";
            string domain   = prefix + "domain=None";
            string labels   = prefix + "labels";

            string[] my_args = { Assembly.GetExecutingAssembly().Location, nothread, domain, labels, /*"--run=GeckofxUnitTests.GeckoWebBrowserTests.EvaluateScript_Run500TimesNavigatingToANewDocumentEachTime_DoesNotCrash"*/ };

            int returnCode = NUnit.ConsoleRunner.Runner.Main(my_args);

            if (returnCode != 0)
            {
                Console.Beep();
            }

            Xpcom.Shutdown();
        }
        public HTTPBase(RenderingEngine RenderingEngine)
        {
            try
            {
                if (RenderingEngine == RenderingEngine.Gecko)
                {
                    if (!Xpcom.IsInitialized)
                    {
                        Xpcom.Initialize("Firefox");
                    }

                    Control = new GeckoWebBrowser();
                }
                else
                {
                    Control = new WebBrowser();
                }

                NewExtended();
            }
            catch (Exception ex)
            {
                Runtime.MessageCollector.AddExceptionStackTrace(Language.strHttpConnectionFailed, ex);
            }
        }
Example #29
0
 public Form1()
 {
     Xpcom.Initialize(@"C:\Users\esouza\Downloads\xulrunner");     //Tell where are XUL bin
     InitializeComponent();
     //geckoWebBrowser1 is an instance of GeckoWebBrowser control that I've dragged on the Form1
     geckoWebBrowser1.DocumentCompleted += new EventHandler(geckoWebBrowser1_DocumentCompleted);
 }
Example #30
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            // TODO: GetXULRunnerLocation isn't very robust but its ok when hacking..
            Xpcom.Initialize(XULRunnerLocator.GetXULRunnerLocation());

            var form1 = new Form1();

            var textBox = new HtmlTextBox();

            textBox.Location = new Point(5, 0);
            textBox.Width    = 100;
            textBox.Height   = 40;
            textBox.Visible  = true;
            var comboBox = new HtmlEditableComboBox();

            comboBox.Location = new Point(5, 45);
            comboBox.Width    = 100;
            comboBox.Height   = 40;


            form1.Controls.Add(textBox);
            form1.Controls.Add(comboBox);

            Application.Run(form1);
        }