public MainWindow() { InitializeComponent(); dict = new com.rhfung.P2PDictionary.P2PDictionary("Camera receiver", com.rhfung.P2PDictionary.P2PDictionary.GetFreePort( 2012), "cameratest"); dict.AddSubscription("frame"); dict.AddSubscription("time"); dict.Notification += new EventHandler<com.rhfung.P2PDictionary.NotificationEventArgs>(dict_Notification); }
public void SetServer(com.rhfung.P2PDictionary.P2PDictionary server) { this.server = server; this.Text = "P2P Client " + server.LocalID + " at" + server.LocalEndPoint.ToString(); server.Notification += new EventHandler<com.rhfung.P2PDictionary.NotificationEventArgs>(server_Notification); server.SubscriptionChanged += new EventHandler<com.rhfung.P2PDictionary.SubscriptionEventArgs>(server_SubscriptionChanged); }
public MainWindow() { InitializeComponent(); dict = new com.rhfung.P2PDictionary.P2PDictionary("Camera receiver", com.rhfung.P2PDictionary.P2PDictionary.GetFreePort(2012), "cameratest", peerDiscovery: new ZeroconfDiscovery()); dict.AddSubscription("frame"); dict.AddSubscription("time"); dict.Notification += new EventHandler <com.rhfung.P2PDictionary.NotificationEventArgs>(dict_Notification); }
private void Window_Loaded(object sender, RoutedEventArgs e) { // find webcams FilterInfoCollection devices = new FilterInfoCollection(FilterCategory.VideoInputDevice); if (devices.Count == 0) { MessageBox.Show("A webcam is required for this demo project"); Application.Current.Shutdown(); } // initialize the first webcam found -- not always true webcam = new VideoCaptureDevice(devices[0].MonikerString); webcam.DesiredFrameRate = 30; webcam.NewFrame += new NewFrameEventHandler(webcam_NewFrame); // useful feedback this.Title = devices[0].Name; // set up the dictionary dict = new com.rhfung.P2PDictionary.P2PDictionary("Camera source", com.rhfung.P2PDictionary.P2PDictionary.GetFreePort(2011), "cameratest"); // start 30 Hz source timer = new System.Windows.Threading.DispatcherTimer(); timer.Tick += new EventHandler(timer_Tick); timer.Interval = new TimeSpan(0, 0, 0, 0, 1000 / 30); timer.Start(); }