Ejemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();

            UserInterface userInterface = new UserInterface(c_buttonUnicorns, c_buttonRainbows, c_labelCount);
            m_configuration = new Configuration();
            m_configuration.SearchRoot = "http://www.bing.com/images/search?q=";
            m_browserNavigator = new BrowserNavigator();

            Manager manager = new Manager(userInterface, m_configuration, m_browserNavigator);
        }
Ejemplo n.º 2
0
        public Form1()
        {
            InitializeComponent();

            UserInterface userInterface = new UserInterface(c_buttonUnicorns, c_buttonRainbows, c_labelCount);

            m_configuration            = new Configuration();
            m_configuration.SearchRoot = "http://www.bing.com/images/search?q=";
            m_browserNavigator         = new BrowserNavigator();


            Manager manager = new Manager(userInterface, m_configuration, m_browserNavigator);
        }
        public void Initialize()
        {
            if (!r_Initialized)
            {
                if (!LoadLayoutEngines())
                {
                    NoInstalledLayoutEngines = true;
                    r_Initialized            = true;
                    return;
                }

                InitializeCommunicator();

                var rStartInfo = new ProcessStartInfo()
                {
                    FileName               = typeof(BrowserService).Assembly.Location,
                    Arguments              = $"browser {Preference.Instance.Browser.CurrentLayoutEngine} {HostProcessID}",
                    UseShellExecute        = false,
                    RedirectStandardOutput = true,
                };
                r_BrowserProcess = Process.Start(rStartInfo);
                r_BrowserProcess.BeginOutputReadLine();
                r_BrowserProcess.OutputDataReceived += (s, e) => Trace.WriteLine(e.Data);

                Messages.Subscribe(CommunicatorMessages.Ready, _ => Communicator.Write(CommunicatorMessages.SetPort + ":" + Preference.Instance.Network.Port));
                Messages.SubscribeOnDispatcher(CommunicatorMessages.Attach, rpHandle => Attach((IntPtr)int.Parse(rpHandle)));

                r_Initialized = true;

                Messages.Subscribe(CommunicatorMessages.LoadCompleted, delegate
                {
                    var rZoom = DpiUtil.ScaleX + Preference.Instance.Browser.Zoom - 1.0;
                    Communicator.Write(CommunicatorMessages.SetZoom + ":" + rZoom);
                });
                Messages.Subscribe(CommunicatorMessages.LoadGamePageCompleted, _ => ResizeBrowserToFitGame());

                Navigator      = new BrowserNavigator(this);
                GameController = new GameController(this);
            }
        }
Ejemplo n.º 4
0
 public static void BeforeAllTests()
 {
     navigator = new BrowserNavigator();
     navigator.Start();
 }