예제 #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 OnRtServiceTick(object sender, EventArgs e)
        {
            if (DateTime.Now.Subtract(_recentServiceTick).TotalMilliseconds < 5)
            {
                return;
            }
            _recentServiceTick = DateTime.Now;

            if (rtTickHandler != null)
            {
                rtTickHandler();
            }

            //clienRt.Service();
            try
            {
                clienRt.Service();
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.StackTrace,
                                "Photon error",
                                MessageBoxButton.OK,
                                MessageBoxImage.Error);
                Application.Current.Shutdown();
            }
        }