Пример #1
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));
        }
Пример #2
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
            });
        }
Пример #3
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();
        }
Пример #4
0
        public void Dispose()
        {
            _servicingPhotonClient = false;

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