Example #1
0
        public ReportingActivitiesTasks StartReportingActivities(Topic topic, Discussion disc, 
                                                                 Session session, DiscCtx ctx)
        {
            _topic = topic;
            _disc = disc;
            _session = session;

            var moder = ctx.Person.Single(p => p.Name.StartsWith("moder"));
            _clienRt = new ClientRT(disc.Id,
                                     ConfigManager.ServiceServer,                 
                                     moder.Name,
                                     moder.Id,
                                     DeviceType.Wpf);
            
            _clienRt.onJoin += OnJoined;

            _hardReportTCS = new TaskCompletionSource<ReportCollector>();
            _remoteScreenshotTCS = new TaskCompletionSource<Dictionary<int, byte[]>>();

            Task.Factory.StartNew(async () =>
                {
                    while (_servicingPhotonClient)
                    {
                        _clienRt.Service();
                        await Utils.Delay(40);                        
                    }
                });

            return new ReportingActivitiesTasks
            {
                ReportTask = _hardReportTCS.Task,
                ScreenshotsTask = _remoteScreenshotTCS.Task
            };
        }
Example #2
0
                StartReportingActivities(Topic topic, Discussion disc, Session session)
        {
            _topic = topic;
            _disc = disc;
            _session = session;
            
            var moder = DbCtx.Get().Person.Single(p => p.Name.StartsWith("moder"));
            _clienRt = new ClientRT(disc.Id,
                                     ConfigManager.ServiceServer,                 
                                     moder.Name,
                                     moder.Id,
                                     DeviceType.Wpf);

            _clienRt.onJoin += OnJoined;

            _hardReportTCS = new TaskCompletionSource<ReportCollector>();
            _remoteScreenshotTCS = new TaskCompletionSource<Dictionary<int, byte[]>>();

            Task.Factory.StartNew(async () =>
                {
                    while (_servicingPhotonClient)
                    {
                        _clienRt.Service();
                        await Utils.Delay(80);                        
                    }
                }, 
                TaskCreationOptions.LongRunning);
         
            return new Tuple<Task<Dictionary<int, byte[]>>, 
                            Task<ReportCollector>>( _remoteScreenshotTCS.Task,  _hardReportTCS.Task);
        }
Example #3
0
        private static void Main(string[] args)
        {
            ClientRT c = new ClientRT(0, "localhost",
                                      "usr_" + (new Random()).Next(400),
                                      -1,
                                      DeviceType.Sticky);

            while (true)
            {
                c.Service();
                System.Threading.Thread.Sleep(300);
            }
        }
Example #4
0
        private static void Main(string[] args)
        {
            ClientRT c = new ClientRT(0, "localhost",
                                      "usr_" + (new Random()).Next(400),
                                      -1,
                                      DeviceType.Sticky);

            while (true)
            {
                c.Service();
                System.Threading.Thread.Sleep(300);
            }
        }
Example #5
0
        public void start(LoginResult login, string DbServer, DeviceType devType)
        {
            int discId;
            if (login.discussion != null)
                discId = login.discussion.Id;
            else
                discId = -1;

            var actorName = login.person != null ? login.person.Name : "moderator";
            var actorDbId = login.person != null ? login.person.Id : 0;

            clienRt = new ClientRT(discId,
                                   DbServer,
                                   actorName,
                                   actorDbId,
                                   devType);

            rtTimer = new DispatcherTimer();
            rtTimer.Tick += OnRtServiceTick;
            rtTimer.Interval = TimeSpan.FromMilliseconds(5);
            rtTimer.Start();
        }
Example #6
0
        public void Dispose()
        {
            _servicingPhotonClient = false;       

            if (_clienRt != null)
            {
                _clienRt.SendLiveRequest();
                _clienRt.Stop();
                _clienRt = null;
            }
        }