public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            UIApplication.SharedApplication.IdleTimerDisabled = true;

            // Perform any additional setup after loading the view, typically from a nib.
            AsyncTcpServer.Initialize(IPAddress.Any, PORT);
            AsyncTcpServer.Instance.Start();

            CaptureService.Initialize(new ScreenCapture(), 1000);
            CaptureService.Instance.ScreenCaptured += (sender, args) =>
            {
                AsyncTcpServer.Instance.Write(JsonConvert.SerializeObject(args.Value));
            };
            CaptureService.Instance.Start();
            lblHelloWorld.Text = (IosExtensions.GetIPAddress() ?? IPAddress.Any).ToString();

            drawingView = new DrawingView();
            drawingView.BackgroundColor = UIColor.Clear;
            drawingView.Frame           = new RectangleF(0, 0, 1024, 768);
            drawingView.Bounds          = new RectangleF(0, 0, 1024, 768);

            this.View.AddSubview(drawingView);
        }
Пример #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById <Button>(Resource.Id.myButton);

            button.Text = GetIPAddress().ToString();

            button.Click += delegate
            {
                button.Text = string.Format("{0} clicks!", count++);
            };

            this.drawingView = new DrawingView(this.ApplicationContext);

            this.AddContentView(this.drawingView, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent));

            this.drawingView.Invalidate();

            AsyncTcpServer.Initialize(IPAddress.Any, PORT);
            AsyncTcpServer.Instance.Start();

            CaptureService.Initialize(new ScreenCapture(this.Window.DecorView.RootView), 1000);
            CaptureService.Instance.ScreenCaptured += (sender, args) =>
            {
                AsyncTcpServer.Instance.Write(JsonConvert.SerializeObject(args.Value));
            };
            CaptureService.Instance.Start();
        }
Пример #3
0
//        private static string[] GetIpAddresses()
//        {
//            return Dns.GetHostEntry(Dns.GetHostName()).AddressList.Where(x => x.AddressFamily == AddressFamily.InterNetwork).Select(x => x.ToString()).ToArray();
//        }

        public static void Main(string[] args)
        {
            AsyncTcpServer.Initialize(IPAddress.Any, PORT);
            AsyncTcpServer.Instance.DataReceived += (sender, e) => System.Console.WriteLine("Received data from client {0}, data: {1}", e.Value1.Client.LocalEndPoint.ToString(), e.Value2);
            AsyncTcpServer.Instance.Start();

            CaptureService.Initialize(new ScreenCapture(), 1000);
            CaptureService.Instance.ScreenCaptured += (sender, e) =>
            {
                var jsonString = "{" + string.Format("\"CursorX\":0,\"CursorY\":0,\"EncodedBitmap\":\"{0}\"", e.Value.EncodedBitmap) + "}";
                AsyncTcpServer.Instance.Write(jsonString);
            };
            CaptureService.Instance.Start();


            System.Console.WriteLine("Listening for incoming connections...");
            System.Console.ReadLine();

            CaptureService.Instance.Stop();
        }