Пример #1
0
        public void DoPublish()
        {
            var _publisherDelegate = new PublisherDelegate (this);
            _publisher = new OTPublisher(_publisherDelegate);

            OTError error;

            _session.Publish(_publisher, out error);

            if (error != null)
            {
                this.RaiseOnError(error.Description);
            }

            var pubView = _publisher.View;
            pubView.TranslatesAutoresizingMaskIntoConstraints = false;
            pubView.Frame = new RectangleF(0, 0, 100, 100);
            pubView.Layer.CornerRadius = 50;
            pubView.Layer.MasksToBounds = true;

            this.AddSubview (pubView);
            this.BringSubviewToFront (pubView);

            this.AddConstraints (new NSLayoutConstraint[] {
                NSLayoutConstraint.Create (pubView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, this, NSLayoutAttribute.Bottom, 1f, 0),
                NSLayoutConstraint.Create (pubView, NSLayoutAttribute.Right, NSLayoutRelation.Equal, this, NSLayoutAttribute.Right, 1f, 0),
                NSLayoutConstraint.Create (pubView, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1f, pubView.Frame.Height),
                NSLayoutConstraint.Create (pubView, NSLayoutAttribute.Width, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1f, pubView.Frame.Width)
            });
        }
Пример #2
0
        public void DoPublish()
        {
            var _publisherDelegate = new PublisherDelegate(this);

            _publisher = new OTPublisher(_publisherDelegate);

            OTError error;

            _session.Publish(_publisher, out error);

            if (error != null)
            {
                this.RaiseOnError(error.Description);
            }

            var pubView = _publisher.View;

            pubView.TranslatesAutoresizingMaskIntoConstraints = false;
            pubView.Frame = new RectangleF(0, 0, 100, 100);
            pubView.Layer.CornerRadius  = 50;
            pubView.Layer.MasksToBounds = true;

            this.AddSubview(pubView);
            this.BringSubviewToFront(pubView);

            this.AddConstraints(new NSLayoutConstraint[] {
                NSLayoutConstraint.Create(pubView, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, this, NSLayoutAttribute.Bottom, 1f, 0),
                NSLayoutConstraint.Create(pubView, NSLayoutAttribute.Right, NSLayoutRelation.Equal, this, NSLayoutAttribute.Right, 1f, 0),
                NSLayoutConstraint.Create(pubView, NSLayoutAttribute.Height, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1f, pubView.Frame.Height),
                NSLayoutConstraint.Create(pubView, NSLayoutAttribute.Width, NSLayoutRelation.Equal, null, NSLayoutAttribute.NoAttribute, 1f, pubView.Frame.Width)
            });
        }
Пример #3
0
        public void AddPublisher(string pName, string pFromFolder, PublisherDelegate pDelegate)
        {
            var _publisher = new R_Publisher(pName, pFromFolder, pDelegate);

            publishers.Add(_publisher);
            _publisher.Start();
        }
Пример #4
0
 private void CleanupPublisher()
 {
     if (_publisher != null)
     {
         _publisher.View.RemoveFromSuperview();
         _publisher.Delegate = null;
         _publisher.Dispose();
         _publisher         = null;
         _publisherDelegate = null;
     }
 }
Пример #5
0
        public R_Publisher(string pName, string pFromFolder, PublisherDelegate pDelegate)
        {
            if (pDelegate == null)
            {
                throw new Exception("R_Publisher.Ctor | Invalid PublisherDelegate! ");
            }

            name               = pName;
            fromFolder         = pFromFolder;
            pendingFilesFilter = "*." + name + AppConstants.PendingExtension;
            publisherDelegate  = pDelegate;
            stop               = false;

            TimokLogger.Instance.LogRbr(LogSeverity.Status, "R_Publisher.Ctor", string.Format("Replication Publisher started for={0}, FileFilter={1}", name, pendingFilesFilter));
        }
        public void DoPublish()
        {
            _publisherDelegate = new PublisherDelegate(this);
            _publisher         = new OTPublisher(_publisherDelegate);

            OTError error;

            _session.Publish(_publisher, out error);

            if (error != null)
            {
                this.RaiseOnError(error.Description);
            }

            // Show the Video in the View In Round Mode
            _publisher.View.Frame = new RectangleF(0, 0, 100, 100);
            _publisher.View.Layer.CornerRadius  = 50;
            _publisher.View.Layer.MasksToBounds = true;

            this.PublisherView.AddSubview(_publisher.View);

            // Schedule a periodic task to send a broadcast signal to all
            // peers on the session
            Task.Run(() => {
                while (true)
                {
                    InvokeOnMainThread(() => {
                        OTError signalerror;
                        _session.SignalWithType("BroadcastSignal",
                                                DateTime.Now.ToString(),
                                                null, // This is the connection of the peer you are sending the signal
                                                      // Leave it null and it will send to all members of the session.
                                                out signalerror);
                    });
                    Thread.Sleep(10000);
                }
            });
        }
Пример #7
0
        public void DoPublish()
        {
            _publisherDelegate = new PublisherDelegate (this);
            _publisher = new OTPublisher(_publisherDelegate);

            OTError error;

            _session.Publish(_publisher, out error);

            if (error != null)
            {
                this.RaiseOnError(error.Description);
            }

            // Show the Video in the View In Round Mode
            _publisher.View.Frame = new RectangleF(0, 0, 100, 100);
            _publisher.View.Layer.CornerRadius = 50;
            _publisher.View.Layer.MasksToBounds = true;

            this.PublisherView.AddSubview (_publisher.View);

            // Schedule a periodic task to send a broadcast signal to all
            // peers on the session
            Task.Run (() => {
                while(true) {
                    InvokeOnMainThread( () => {
                        OTError signalerror;
                        _session.SignalWithType("BroadcastSignal",
                            DateTime.Now.ToString(),
                            null, // This is the connection of the peer you are sending the signal
                                  // Leave it null and it will send to all members of the session.
                            out signalerror);
                    });
                    Thread.Sleep(10000);
                }
            });
        }
Пример #8
0
 private void CleanupPublisher()
 {
     if (_publisher != null)
     {
         _publisher.View.RemoveFromSuperview();
         _publisher.Delegate = null;
         _publisher.Dispose();
         _publisher = null;
         _publisherDelegate = null;
     }
 }