Esempio n. 1
0
 public MainForm()
 {
     ServerGUID = Guid.NewGuid();
     InitializeComponent();
     Server = new PlayerCommunicationServer(ServerGUID);
     Server.ServiceInstance.OnSyncSession          += ServiceInstanse_OnSyncSession;
     Server.ServiceInstance.OnClosingSession       += ServiceInstanse_OnClosingSession;
     Server.ServiceInstance.OnBrowserJobComplete   += ServiceInstanse_OnBrowserJobComplete;
     Server.ServiceInstance.OnFetchLogElement      += ServiceInstanse_OnFetchLogElement;
     Server.ServiceInstance.OnLogElementHistory    += ServiceInstance_OnLogElementHistory;
     Server.ServiceInstance.OnLogElementDifference += ServiceInstance_OnLogElementDifference;
 }
Esempio n. 2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            Guid?  startingPageGUID = null;
            string startingUrl      = null;

            if (Arguments.Length > 4)
            {
                Guid tmp;
                if (Guid.TryParse(Arguments[0], out tmp))
                {
                    ServerGUID = tmp;
                }
                if (Guid.TryParse(Arguments[1], out tmp))
                {
                    ProcessGUID = tmp;
                }
                if (Guid.TryParse(Arguments[2], out tmp))
                {
                    startingPageGUID = tmp;
                }
                BaseUrl     = Arguments[3];
                startingUrl = Arguments[4];
            }

            if (ServerGUID == null || ProcessGUID == null || startingPageGUID == null || BaseUrl == null || startingUrl == null)
            {
                MessageBox.Show("Invalid arguments");
                Close();
                return;
            }

            refreshTimer.Enabled = true;

            //Send back process id related to guid
            PlayerCommunicationHelper.SendSyncSession(ServerGUID.Value, ProcessGUID.Value, Process.GetCurrentProcess().Id);

            this.Text = $"Session: {ProcessGUID.Value} Page: {0}";

            //MessageBox.Show($"Starting session-server {ProcessGUID.Value}");
            Server = new PlayerCommunicationServer(ProcessGUID.Value);
            Server.ServiceInstance.OnBrowserJob += ServiceInstanse_OnBrowserJob;

            PerformURLRequest(startingPageGUID.Value, BaseUrl.TrimEnd('/') + '/' + startingUrl.TrimStart('/'), RequestMethod.GET);

            RefreshUI();
        }