private void SetupRequest(string collectionId)
 {
     Session.LocalSpace.GetAll("Frame", typeof(int), typeof(FramePayload));
     _lastCollection = collectionId;
     SlideShower.NewCollection(NumberOfPages);
     foreach (var page in Enumerable.Range(1, NumberOfPages))
     {
         Space.Put("FramePayloadRequest", collectionId, Session.Username, page);
     }
 }
Esempio n. 2
0
        private void AssumeControl()
        {
            var tuple = ConcealedSpace.Get("ControlLock", typeof(string), typeof(int));

            CollectionIdentifier  = tuple.Get <string>(1);
            NumberOfPages         = tuple.Get <int>(2);
            _controlling          = true;
            SlideShower.InControl = true;
            SlideShower.NewCollection(NumberOfPages);
        }
        public SlideShowerViewModel()
        {
            SlideShower = new SlideShower(new DirectoryInfo(defaultDir));
            SlideShower.Shuffle();
            InitCommands();

            SlideShower.ImageChanged += () =>
            {
                OnPropertyChanged("CurrentFilePath");
                OnPropertyChanged("Placement");
            };
            SlideShower.StatusChanged += () => OnPropertyChanged("CurrentStatus");
        }
Esempio n. 4
0
        private void SetupSlides(IEnumerable <byte[]> imageBitstreams)
        {
            FlushFrames();
            CollectionIdentifier = Guid.NewGuid().ToString();
            ConcealedSpace.Put("ControlLock", CollectionIdentifier, imageBitstreams.Count());
            ConcealedSpace.Put("ActiveCollection", CollectionIdentifier, imageBitstreams.Count());
            SlideShower.NewCollection(imageBitstreams.Count());
            var i = 1;

            foreach (var bs in imageBitstreams)
            {
                ConcealedSpace.Put("Frame", i, new FramePayload {
                    PageNumber = i++, Bitstream = bs
                });
            }
            Running = true;
        }
        private void SyncWithHost()
        {
            SendToken();
            //("SlideSync", collectionId, rtoken.ResponseToken, identifier, _lastPage, pages)
            var tuple = Space.Get("SlideSync", typeof(string), _lastToken.ResponseToken, Session.Username, typeof(int), typeof(int));

            NumberOfPages = tuple.Get <int>(5);
            var page         = tuple.Get <int>(4);
            var collectionId = tuple.Get <string>(1);

            if (string.IsNullOrEmpty(_lastCollection) || collectionId != _lastCollection)
            {
                SetupRequest(collectionId);
            }
            var ftuple  = Session.LocalSpace.Query("Frame", page, typeof(FramePayload));
            var payload = ftuple.Get <FramePayload>(2);

            SlideShower.UpdateSlide(payload);
        }
        private void Consumer()
        {
            SyncWithHost();
            while (true)
            {
                SendToken();
                var tuple = Space.Get("SlideChange", typeof(string), _lastToken.ResponseToken, Session.Username, typeof(int), typeof(int));
                var page  = tuple.Get <int>(4);
                NumberOfPages = tuple.Get <int>(5);
                var collectionId = tuple.Get <string>(1);

                if (_lastCollection != collectionId)
                {
                    SetupRequest(collectionId);
                }

                var ftuple  = Session.LocalSpace.Query("Frame", page, typeof(FramePayload));
                var payload = ftuple.Get <FramePayload>(2);
                SlideShower.UpdateSlide(payload);
            }
        }