public VNCServerService()
 {
     t = new Timer();
     t.Interval = 100;
     //this.Text = "Support v" + Application.ProductVersion;
     remoteObject = new ScreenHost.ScreenObject();
     channel = new TcpChannel(8888);
     getIP(8888);
 }
Пример #2
0
        private void Server_Load(object sender, EventArgs e)
        {
            ScreenHost.ScreenObject remoteObject = new ScreenHost.ScreenObject();

            //************************************* TCP *************************************//
            channel = new TcpChannel(8082);
            ChannelServices.RegisterChannel(channel, false);
            RemotingConfiguration.RegisterWellKnownServiceType(typeof(ScreenHost.ScreenObject), "CastScreen", WellKnownObjectMode.SingleCall);
            //************************************* TCP *************************************//
        }
Пример #3
0
        private void btnDisconnect_Click(object sender, EventArgs e)
        {
            ChannelServices.UnregisterChannel(channel);

            btnConnect.Enabled = !btnConnect.Enabled;
            btnDisconnect.Enabled = !btnConnect.Enabled;
            timer1.Enabled = false;
            remoteObject = null;

            Application.Exit();
        }
Пример #4
0
        private void bgWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            //Setup the Host Instance
            try
            {
                hostInstance = (ScreenHost.ScreenObject)Activator.GetObject(typeof(ScreenHost.ScreenObject), "tcp://" + hostIP + ":8082/CastScreen", null);

                if (hostInstance != null)
                {
                    ms = hostInstance.CastScreen(imgFormat);
                    img = Image.FromStream(ms);
                    updatePictureBox(picCast, img);
                    updateText(lblMessage, "Screen Updated - " + DateTime.Now);
                }
            }
            catch (Exception exc)
            {
                if (bgWorker1.IsBusy)
                { bgWorker1.CancelAsync(); }
                updateText(lblMessage, exc.Message);
            }
        }
Пример #5
0
        public void Connect(string ip, int port)
        {
            //TODO change this ti lowercase.
            try {
                //Set the Host IP
                hostIP = ip;

                connectionStatus = status.connecting;

                //Register and Initialize the TCP Channel
                InitializeRemoteServer();
                hostInstance = new ScreenObject();

                castTimer.Enabled = true;
                connected = true;
                btnConnect.ImageIndex = 1;
                btnConnect.Text = "Disconnect";
                updatePanel(pnlBottom, true);
                updateText(lblMessage, "Connected to " + hostIP + " - " + DateTime.Now);
            } catch (Exception exc) {
                updateText(lblMessage, exc.Message);
            }
        }
        private void stop()
        {
            ChannelServices.UnregisterChannel(channel);
            t.Enabled = false;
            remoteObject = null;

            Application.Exit();
        }
Пример #7
0
        private void Connect()
        {
            try
            {
                //Set the Host IP
                hostIP = txtIPAddress.Text;

                //Register and Initialize the TCP Channel
                InitializeRemoteServer();
                hostInstance = new ScreenObject();

                castTimer.Enabled = true;
                connected = true;
                btnConnect.ImageIndex = 1;
                btnConnect.Text = "Disconnect";
                updatePanel(pnlBottom, true);
                updateText(lblMessage, "Connected to " + hostIP + " - " + DateTime.Now);
            }
            catch (Exception exc)
            {
                updateText(lblMessage, exc.Message);
            }
        }
Пример #8
0
 private void Server_Load(object sender, EventArgs e)
 {
     this.Text = "Support v" + Application.ProductVersion;
     remoteObject = new ScreenHost.ScreenObject();
     channel = new TcpChannel(8082);
     getIP(8082);
 }