public LiveServer(TcpClient client, RealtimeDisplay.Presenter host)
 {
     this.client = client;
     this.host = host;
     host.ImageCaptured += new EventHandler<ImageCapturedEventArgs>(host_ImageCaptured);
     formatter = new BinaryFormatter();
 }
 public LiveServer(TcpClient client, RealtimeDisplay.Presenter host)
 {
     this.client         = client;
     this.host           = host;
     host.ImageCaptured += new EventHandler <ImageCapturedEventArgs>(host_ImageCaptured);
     formatter           = new BinaryFormatter();
 }
Exemple #3
0
        private void MainForm_Shown(object sender, EventArgs e)
        {
            IIconExtractor extractor = IconExtractor.Default;

            ImageUploadWatcher watcher =
                new ImageUploadWatcher() { PathToWatch = Properties.Settings.Default.ImageUploadPool, };

            Presenter p = new Presenter(this, watcher, extractor);
            p.Start();
        }
Exemple #4
0
        private void StartCamera(Camera cam)
        {
            ICamera Icam = null;

            if (string.IsNullOrEmpty(Program.directory))
            {

                SanyoNetCamera camera = new SanyoNetCamera();
                camera.IPAddress = cam.IpAddress;
                camera.UserName = "******";
                camera.Password = "******";

                try
                {
                    camera.Connect();
                }
                catch (System.Net.Sockets.SocketException)
                {
                    MessageBox.Show("无法连接摄像头,请检查摄像头后重新连接");
                    return;
                }
                catch (System.Net.WebException)
                {
                    MessageBox.Show("无法连接摄像头,请检查摄像头后重新连接");
                    return;
                }

                Icam = camera;

                StartRecord(cam);

                Properties.Settings.Default.LastSelCamID = cam.ID;

            }
            else
            {
                MockCamera mc = new MockCamera(Program.directory);
                mc.Repeat = true;
                Icam = mc;
            }

            presenter = new Presenter(this, Icam);

            presenter.Start();
        }
Exemple #5
0
        private void StartCamera(Camera cam)
        {
            SynchronizationContext context = SynchronizationContext.Current;

            ICamera Icam = null;

            if (string.IsNullOrEmpty(Program.directory))
            {
                var camera = new SanyoNetCamera();
                camera.IPAddress = cam.IpAddress;
                camera.UserName = "******";
                camera.Password = "******";

                Icam = camera;
                this.StartRecord(cam);
            }
            else
            {
                MockCamera mc = new MockCamera(Program.directory);
                mc.Repeat = true;
                Icam = mc;
            }

            if (presenter == null)
                presenter = new Presenter(this, Icam);

            System.Threading.ThreadPool.QueueUserWorkItem((object o) =>
                {
                    System.Exception error = null;
                    try
                    {
                        Icam.Connect();
                    }
                    catch (System.Net.Sockets.SocketException ex)
                    {
                        error = ex;
                    }
                    catch (System.Net.WebException ex)
                    {
                        error = ex;
                    }

                    context.Post(OnConnectionFinished, error);

                    if (error == null)
                    {
                        Properties.Settings.Default.LastSelCamID = cam.ID;
                    }

                });
        }