Exemplo n.º 1
0
 public ControlServiceTests()
 {
     _container      = new TestsHelper().GetContainer();
     _fixture        = _container.Resolve <Fixture>();
     _controlService = _container.Resolve <IControlService>();
     _cacheService   = _container.Resolve <ICacheService>();
 }
Exemplo n.º 2
0
        /// <summary>
        /// Public constructor to initialize product service instance
        /// </summary>

        public DataController(
            IUnitOfWorkAsync unitOfWorkAsync,
            IControlService ControlService)
        {
            _unitOfWorkAsync = unitOfWorkAsync;
            _ControlService = ControlService;
        }
Exemplo n.º 3
0
 public void RefreshEpgData(ISchedulerService tvSchedulerAgent, IGuideService tvGuideAgent,
                            IControlService tvControlAgent, bool reloadData, Guid currentChannelGroupId, DateTime guideDateTime,
                            CancellationPendingDelegate cancellationPending)
 {
     if (reloadData)
     {
         _model.ProgramsByChannel.Clear();
         RefreshUpcomingPrograms(tvSchedulerAgent, tvControlAgent);
         if (cancellationPending != null &&
             cancellationPending())
         {
             return;
         }
     }
     if (guideDateTime != DateTime.MinValue)
     {
         SetChannelGroup(currentChannelGroupId);
         _model.GuideDateTime = guideDateTime;
         _model.Channels      = new List <Channel>(tvSchedulerAgent.GetChannelsInGroup(currentChannelGroupId, true));
         if (cancellationPending != null &&
             cancellationPending())
         {
             return;
         }
         RefreshChannelsEpgData(tvGuideAgent, _model.Channels, guideDateTime, guideDateTime.AddDays(1), cancellationPending);
     }
     else
     {
         _model.Channels = new List <Channel>();
     }
 }
Exemplo n.º 4
0
        public static async Task <Result> RebuildAsync(this IControlService controlService, string service)
        {
            var stopResult = await controlService.StopAsync(service).ConfigureAwait(false);

            if (stopResult.IsFail)
            {
                return(Result.Fail($"Rebuild fails on \"stop-stage\":\nError: {stopResult.Error}"));
            }

            var buildResult = await controlService.BuildAsync(service).ConfigureAwait(false);

            if (buildResult.IsFail)
            {
                return(Result.Fail($"Rebuild fails on \"build-stage\". Error: {buildResult.Error}"));
            }

            var runResult = await controlService.StartAsync(service).ConfigureAwait(false);

            if (runResult.IsFail)
            {
                return(Result.Fail($"Rebuild fails on \"run-stage\". Error: {runResult.Error}"));
            }

            return(Result.Ok());
        }
Exemplo n.º 5
0
 public void RefreshAllUpcomingPrograms(ISchedulerService tvSchedulerServiceAgent, IControlService tvControlServiceAgent)
 {
     UpcomingRecording[] upcomingRecordings = tvControlServiceAgent.GetAllUpcomingRecordings(UpcomingRecordingsFilter.All, true);
     UpcomingGuideProgram[] upcomingAlerts = tvSchedulerServiceAgent.GetUpcomingGuidePrograms(ScheduleType.Alert, true);
     UpcomingGuideProgram[] upcomingSuggestions = tvSchedulerServiceAgent.GetUpcomingGuidePrograms(ScheduleType.Suggestion, true);
     _model.AllUpcomingGuidePrograms = new UpcomingGuideProgramsDictionary(upcomingRecordings, upcomingAlerts, upcomingSuggestions);
 }
Exemplo n.º 6
0
        private static bool TryGetBindingOptionsControl(IBindingContainer bindingContainer, out BindingOptionsControl bindingOptionsControl)
        {
            bool result = false;

            bindingOptionsControl = null;

            Page page = bindingContainer as Page;

            if (page == null)
            {
                throw new InvalidOperationException("This method binding extension can only be used within the context of an asp.net page");
            }

            IBindingTarget  target                = new WebformControl(page);
            IControlService controlService        = GetControlService(bindingContainer);
            WebformControl  wrappedOptionsControl = controlService.FindControlRecursive(target, typeof(BindingOptionsControl)) as WebformControl;

            if (wrappedOptionsControl != null)
            {
                bindingOptionsControl = wrappedOptionsControl.Control as BindingOptionsControl;

                if (bindingOptionsControl != null)
                {
                    result = true;
                }
            }

            return(result);
        }
Exemplo n.º 7
0
        public RecordingSummary[] GetRecordingsForGroup(IControlService tvControlAgent, int groupIndex, bool includeNonExisting)
        {
            if (!_model.RecordingsByGroup.ContainsKey(groupIndex))
            {
                switch (_model.RecordingGroups[groupIndex].RecordingGroupMode)
                {
                case RecordingGroupMode.GroupBySchedule:
                    _model.RecordingsByGroup[groupIndex] = tvControlAgent.GetRecordingsForSchedule(_model.RecordingGroups[groupIndex].ScheduleId, includeNonExisting);
                    break;

                case RecordingGroupMode.GroupByChannel:
                    _model.RecordingsByGroup[groupIndex] = tvControlAgent.GetRecordingsOnChannel(_model.RecordingGroups[groupIndex].ChannelId, includeNonExisting);
                    break;

                case RecordingGroupMode.GroupByProgramTitle:
                    _model.RecordingsByGroup[groupIndex] = tvControlAgent.GetRecordingsForProgramTitle(_model.ChannelType, _model.RecordingGroups[groupIndex].ProgramTitle, includeNonExisting);
                    break;

                case RecordingGroupMode.GroupByRecordingDay:
                    _model.RecordingsByGroup[groupIndex] = tvControlAgent.GetRecordingsForOneDay(_model.ChannelType, _model.RecordingGroups[groupIndex].LatestProgramStartTime, includeNonExisting);
                    break;

                case RecordingGroupMode.GroupByCategory:
                    _model.RecordingsByGroup[groupIndex] = tvControlAgent.GetRecordingsForCategory(_model.ChannelType, _model.RecordingGroups[groupIndex].Category, includeNonExisting);
                    break;
                }
            }
            return(_model.RecordingsByGroup[groupIndex]);
        }
Exemplo n.º 8
0
        }                                             // I give up.

        public Provider(
            IAuthorizationService authorization,
            ILoggingService log,
            IControlService control,
            IDataService data,
            IBillingService billing,
            IInventoryService inventory,
            IOrderingService ordering,
            IStoreService store,
            IMailService mail,
            IPhysicalAccessService physicalAccess,
            ISchedulerService scheduler,
            IFeedbackService feedback,
            IReportingService reporting,
            IWorkerService worker,
            IProviderUtility utility,
            IDataAccessService dataAccess)
        {
            Authorization  = authorization;
            Log            = log;
            Control        = control;
            Data           = data;
            Billing        = billing;
            Inventory      = inventory;
            Ordering       = ordering;
            Store          = store;
            Mail           = mail;
            PhysicalAccess = physicalAccess;
            Scheduler      = scheduler;
            Feedback       = feedback;
            Reporting      = reporting;
            Worker         = worker;
            Utility        = utility;
            DataAccess     = dataAccess;
        }
Exemplo n.º 9
0
 public OperacionesController(IOperacionService operacionService, IControlService controlService,
                              ErrorResponseFactory errorResponseFactory)
 {
     this.operacionService     = operacionService;
     this.controlService       = controlService;
     this.errorResponseFactory = errorResponseFactory;
 }
Exemplo n.º 10
0
		public ProductsService(IObjectSerializationProvider serializationProvider, IControlService controlService,
			IProductManagementService productManagementService, IKeyManagementService keyManagementService)
		{
			_serializationProvider = serializationProvider;
			_controlService = controlService;
			_productManagementService = productManagementService;
			_keyManagementService = keyManagementService;
		}
Exemplo n.º 11
0
        public StatusService(IObjectSerializationProvider serializationProvider, IControlService controlService,
			IProductManagementService productManagementService, IMasterService masterService)
        {
            _serializationProvider = serializationProvider;
            _controlService = controlService;
            _productManagementService = productManagementService;
            _masterService = masterService;
        }
Exemplo n.º 12
0
        public BinderBase(IBindingContainer bindingContainer, IDataStorageService dataStorageService, IControlService controlService)
        {
            this.bindingContainer   = bindingContainer;
            this.dataStorageService = dataStorageService;
            this.controlService     = controlService;

            bindingContainer.Load += new EventHandler(bindingContainer_Load);
        }
Exemplo n.º 13
0
 public ProductsService(IObjectSerializationProvider serializationProvider, IControlService controlService,
                        IProductManagementService productManagementService, IKeyManagementService keyManagementService)
 {
     _serializationProvider    = serializationProvider;
     _controlService           = controlService;
     _productManagementService = productManagementService;
     _keyManagementService     = keyManagementService;
 }
Exemplo n.º 14
0
 public TaskService(IUnityContainer container)
 {
     _container        = container;
     _calculateService = container.Resolve <ICalculateService>();
     _controlService   = container.Resolve <IControlService>();
     _cacheService     = container.Resolve <ICacheService>();
     _eventAggregator  = container.Resolve <IEventAggregator>();
 }
Exemplo n.º 15
0
        public ControlServiceViewModel(IControlService service, Dispatcher dispatcher, string name)
        {
            Name = name;

            _dispatcher = dispatcher;

            _service = service;
            _service.StateChanged += service_StateChanged;
        }
Exemplo n.º 16
0
 public StatusService(IObjectSerializationProvider serializationProvider, IControlService controlService,
                      IProductManagementService productManagementService, IMasterService masterService, ICommonService commonService)
 {
     _serializationProvider    = serializationProvider;
     _controlService           = controlService;
     _productManagementService = productManagementService;
     _masterService            = masterService;
     _commonService            = commonService;
 }
Exemplo n.º 17
0
        /// <summary>
        /// Used to create a command binding
        /// </summary>
        /// <param name="sourceExpression"></param>
        /// <param name="targetExpression"></param>
        /// <param name="containerID"></param>
        public BindingDef(IBindingTarget targetControl, string targetPropertyName, Options bindingOptions, IControlService controlService)
        {
            this.controlService   = controlService;
            this.sourceExpression = new BindingPath(bindingOptions.Path);

            string targetExpression = string.Format("{0}.{1}", targetControl.UniqueID, targetPropertyName);

            this.targetExpression = new BindingPath(targetExpression);
        }
        public void SetupForTest()
        {
            mockContainer      = MockRepository.GenerateMock <IServiceProviderBindingContainer>();
            dataStorageService = new ViewStateStorageService(new StateBag());
            controlService     = MockRepository.GenerateMock <IControlService>();

            //object under test
            binder = new ViewStateBinder(mockContainer, dataStorageService, controlService);
        }
Exemplo n.º 19
0
 public void RefreshUpcomingPrograms(ISchedulerService tvSchedulerAgent, IControlService tvControlAgent)
 {
     _model.UpcomingProgramsByType.Clear();
     RefreshGuideUpcomingRecordings(tvControlAgent);
     _model.UpcomingProgramsByType[ScheduleType.Alert]      = GetGuideUpcomingPrograms(tvSchedulerAgent, ScheduleType.Alert);
     _model.UpcomingProgramsByType[ScheduleType.Suggestion] = GetGuideUpcomingPrograms(tvSchedulerAgent, ScheduleType.Suggestion);
     _model.UpcomingRecordingsById  = BuildUpcomingProgramsDictionary(ScheduleType.Recording);
     _model.UpcomingAlertsById      = BuildUpcomingProgramsDictionary(ScheduleType.Alert);
     _model.UpcomingSuggestionsById = BuildUpcomingProgramsDictionary(ScheduleType.Suggestion);
 }
Exemplo n.º 20
0
 public ReportingService(IObjectSerializationProvider serializationProvider, IControlService controlService,
                         IProductManagementService productManagementService, IMasterService masterService, IActivationLogService activationLogService, IKeyManagementService keyManagementService)
 {
     _serializationProvider    = serializationProvider;
     _controlService           = controlService;
     _productManagementService = productManagementService;
     _masterService            = masterService;
     _activationLogService     = activationLogService;
     _keyManagementService     = keyManagementService;
 }
Exemplo n.º 21
0
		public ReportingService(IObjectSerializationProvider serializationProvider, IControlService controlService,
			IProductManagementService productManagementService, IMasterService masterService, IActivationLogService activationLogService, IKeyManagementService keyManagementService)
		{
			_serializationProvider = serializationProvider;
			_controlService = controlService;
			_productManagementService = productManagementService;
			_masterService = masterService;
			_activationLogService = activationLogService;
			_keyManagementService = keyManagementService;
		}
        public TelegramControlService(ITelegramBotClient client, IControlService controlService, ProphecySettings settings, ILog log)
        {
            this.client         = client;
            this.log            = log;
            this.settings       = settings;
            this.controlService = controlService;

            client.OnMessage += async(s, e) => await Task.Run(() => OnMessageAsync(e.Message)).ConfigureAwait(false);

            client.OnCallbackQuery += async(s, e) => await Task.Run(() => OnCallbackAsync(e.CallbackQuery)).ConfigureAwait(false);
        }
Exemplo n.º 23
0
        public ActivationService(IControlService controlService, IKeyManagementService keyService, IKeyPairService keyPairService,
			IObjectSerializationProvider serializationProvider, IAsymmetricEncryptionProvider asymmetricEncryptionProvider,
			IActivationLogService activationLogService, IMasterService masterService)
        {
            _controlService = controlService;
            _keyService = keyService;
            _keyPairService = keyPairService;
            _serializationProvider = serializationProvider;
            _asymmetricEncryptionProvider = asymmetricEncryptionProvider;
            _activationLogService = activationLogService;
            _masterService = masterService;
        }
Exemplo n.º 24
0
        /// <summary>
        /// Used to create a data binding
        /// </summary>
        /// <param name="targetControl">The control to which to bind</param>
        /// <param name="targetPropertyName">The property of the control to which to bind</param>
        /// <param name="bindingOptions">Options to control the binding</param>
        /// <param name="isSourceEnumerable">Is the datasource to which you are binidng a collection</param>
        /// <param name="controlService">Service required for binding</param>
        public BindingDef(IBindingTarget targetControl, string targetPropertyName, Options bindingOptions, bool isSourceEnumerable, IControlService controlService)
        {
            this.controlService   = controlService;
            this.Container        = targetControl;
            this.sourceExpression = new BindingPath(bindingOptions.Path);

            string targetExpression = string.Format("{0}.{1}", targetControl.UniqueID, targetPropertyName);

            this.targetExpression = new BindingPath(targetExpression);

            this.bindingOptions     = bindingOptions;
            this.IsSourceEnumerable = isSourceEnumerable;
        }
Exemplo n.º 25
0
        public TargetEvent ResolveAsTargetEvent(IBindingTarget container, IControlService controlService)
        {
            string[] targetExpressionSplit = this.Raw.Split('.');

            IBindingTarget control    = controlService.FindControlUnique(container, targetExpressionSplit[0]);
            object         rawControl = controlService.Unwrap(control);

            EventInfo info = rawControl.GetType().GetEvent(targetExpressionSplit[1]);

            return(new TargetEvent {
                OwningControl = rawControl, Descriptor = info
            });
        }
Exemplo n.º 26
0
        public void SetupForTest()
        {
            mockContainer      = MockRepository.GenerateMock <IServiceProviderBindingContainer>();
            dataStorageService = MockRepository.GenerateMock <IDataStorageService>();
            controlService     = MockRepository.GenerateMock <IControlService>();
            viewModel          = new SimpleViewModel();

            //object under test
            binder = new ViewStateBinder(mockContainer, dataStorageService, controlService);

            mockContainer.Expect(mc => mc.IsPostBack).IgnoreArguments().Return(true);
            mockContainer.Expect(mc => mc.DataContext).IgnoreArguments().Return(viewModel);
        }
Exemplo n.º 27
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            camera = new CameraComponent(this);
            collision = new CollisionComponent(this);
            control = new ControlComponent(this);

            actorObj = new Actor();

            cameraService = (ICameraService)this.Services.GetService(typeof(ICameraService));
            controlService = (IControlService)this.Services.GetService(typeof(IControlService));
        }
Exemplo n.º 28
0
        private void RefreshGuideUpcomingRecordings(IControlService tvControlAgent)
        {
            _model.UpcomingRecordings = new UpcomingOrActiveProgramsList(tvControlAgent.GetAllUpcomingRecordings(UpcomingRecordingsFilter.All, true));
            List <GuideUpcomingProgram> result = new List <GuideUpcomingProgram>();

            foreach (UpcomingOrActiveProgramView upcoming in _model.UpcomingRecordings)
            {
                if (upcoming.UpcomingProgram.GuideProgramId.HasValue)
                {
                    result.Add(new GuideUpcomingProgram(upcoming.UpcomingRecording));
                }
            }
            _model.UpcomingProgramsByType[ScheduleType.Recording] = result;
        }
Exemplo n.º 29
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            camera    = new CameraComponent(this);
            collision = new CollisionComponent(this);
            control   = new ControlComponent(this);

            actorObj = new Actor();

            cameraService  = (ICameraService)this.Services.GetService(typeof(ICameraService));
            controlService = (IControlService)this.Services.GetService(typeof(IControlService));
        }
Exemplo n.º 30
0
 public ActivationService(IControlService controlService, IKeyManagementService keyService, IKeyPairService keyPairService,
                          IObjectSerializationProvider serializationProvider, IAsymmetricEncryptionProvider asymmetricEncryptionProvider,
                          IActivationLogService activationLogService, IMasterService masterService, ICommonService commonService, IProductManagementService productManagementService)
 {
     _controlService               = controlService;
     _keyService                   = keyService;
     _keyPairService               = keyPairService;
     _serializationProvider        = serializationProvider;
     _asymmetricEncryptionProvider = asymmetricEncryptionProvider;
     _activationLogService         = activationLogService;
     _masterService                = masterService;
     _commonService                = commonService;
     _productManagementService     = productManagementService;
 }
Exemplo n.º 31
0
        /// <summary>
        /// Used to create a nested data binding
        /// </summary>
        /// <param name="targetControl">The control to which to bind</param>
        /// <param name="targetPropertyName">The property of the control to which to bind</param>
        /// <param name="dataItemIndex">If the parent binding is a collection, the index is the data item for this binding. Else zerp</param>
        /// <param name="owningCollection">The collection of current bindings</param>
        /// <param name="bindingOptions">Options to control the binding</param>
        /// <param name="isSourceEnumerable">Is the datasource to which you are binidng a collection</param>
        /// <param name="controlService">Service required for binding</param>
        public BindingDef(IBindingTarget targetControl, string targetPropertyName, int dataItemIndex, BindingCollection owningCollection, Options bindingOptions, bool isSourceEnumerable, IControlService controlService)
        {
            this.controlService = controlService;
            this.Container      = targetControl;
            this.TrySetParent(owningCollection);
            this.sourceExpression = new BindingPath(bindingOptions.Path, dataItemIndex, GetParentExpression(), bindingOptions.PathMode);

            string targetExpression = string.Format("{0}.{1}", targetControl.UniqueID, targetPropertyName);

            this.targetExpression = new BindingPath(targetExpression);

            this.DataItemIndex      = dataItemIndex;
            this.bindingOptions     = bindingOptions;
            this.IsSourceEnumerable = isSourceEnumerable;
        }
Exemplo n.º 32
0
        private static IControlService GetControlService(IBindingContainer bindingContainer)
        {
            IControlService          controlService  = null;
            IBindingServicesProvider serviceProvider = bindingContainer as IBindingServicesProvider;

            if (serviceProvider != null)
            {
                controlService = serviceProvider.ControlService;
            }
            else
            {
                controlService = new WebformsControlService();
            }

            return(controlService);
        }
Exemplo n.º 33
0
        public void SetupForTest()
        {
            mockContainer      = MockRepository.GenerateMock <IServiceProviderBindingContainer>();
            dataStorageService = MockRepository.GenerateMock <IDataStorageService>();
            controlService     = MockRepository.GenerateMock <IControlService>();
            viewModel          = MockRepository.GenerateMock <ISimpleViewModel>();
            mockContainer.Expect(c => c.DataContext).IgnoreArguments().Return(viewModel);

            //object under test
            binder = new ViewStateBinder(mockContainer, dataStorageService, controlService);

            //setup mock services
            collection = new Binding.BindingCollection();
            dataStorageService.Expect(ds => ds.RetrieveOrCreate <Binding.BindingCollection>(null)).IgnoreArguments().Return(collection);

            //dataStorageService.Expect(ds => ds.Retrieve<object>(null)).IgnoreArguments()Return(viewModel);
        }
Exemplo n.º 34
0
        public HomeController(IConfigService configService, IBannerService bannerService,
            IBannerMappingService bannerMappingService, IGroupControlService groupControlService, IControlService controlService,
            IProjectService projectService, INewsService newsService, INewsCategoryService newsCategoryService,
            IOtherPageSEOService otherPageSeoService)
        {
            this._configService = configService;
            this._bannerService = bannerService;
            this._bannerMappingService = bannerMappingService;
            this._groupControlService = groupControlService;
            this._controlService = controlService;
            this.configModel = _configService.GetAll().SingleOrDefault();
            this._projectService = projectService.GetAll();
            this._newsService = newsService;
            this._newsCategoryService = newsCategoryService;
            this._otherPageSeoService = otherPageSeoService;

            this.LanguageId = int.Parse(Cookies.ReadCookie("PenDesign:Language", "129"));
        }
Exemplo n.º 35
0
        public HomeController(IConfigService configService, IBannerService bannerService,
                              IBannerMappingService bannerMappingService, IGroupControlService groupControlService, IControlService controlService,
                              IProjectService projectService, INewsService newsService, INewsCategoryService newsCategoryService,
                              IOtherPageSEOService otherPageSeoService)
        {
            this._configService        = configService;
            this._bannerService        = bannerService;
            this._bannerMappingService = bannerMappingService;
            this._groupControlService  = groupControlService;
            this._controlService       = controlService;
            this.configModel           = _configService.GetAll().SingleOrDefault();
            this._projectService       = projectService.GetAll();
            this._newsService          = newsService;
            this._newsCategoryService  = newsCategoryService;
            this._otherPageSeoService  = otherPageSeoService;

            this.LanguageId = int.Parse(Cookies.ReadCookie("PenDesign:Language", "129"));
        }
Exemplo n.º 36
0
        public void CancelOrUncancelUpcomingProgram(ISchedulerService tvSchedulerAgent, IGuideService tvGuideAgent,
                                                    IControlService tvControlAgent, Guid scheduleId, Guid channelId, Guid guideProgramId, bool cancel)
        {
            GuideProgram guideProgram = tvGuideAgent.GetProgramById(guideProgramId);

            if (guideProgram != null)
            {
                if (cancel)
                {
                    tvSchedulerAgent.CancelUpcomingProgram(scheduleId, guideProgramId, channelId, guideProgram.StartTime);
                }
                else
                {
                    tvSchedulerAgent.UncancelUpcomingProgram(scheduleId, guideProgramId, channelId, guideProgram.StartTime);
                }
                RefreshUpcomingPrograms(tvSchedulerAgent, tvControlAgent);
            }
        }
Exemplo n.º 37
0
        public TargetProperty ResolveAsTarget(IBindingTarget container, IControlService controlService)
        {
            string[] targetExpressionSplit = this.Raw.Split('.');

            IBindingTarget control    = controlService.FindControlUnique(container, targetExpressionSplit[0]);
            object         rawControl = controlService.Unwrap(control);

            PropertyDescriptor descriptor = TypeDescriptor.GetProperties(rawControl).Find(targetExpressionSplit[1], true);

            object value = null;

            if (descriptor != null)
            {
                value = descriptor.GetValue(rawControl);
            }

            return(new TargetProperty {
                Descriptor = descriptor, OwningControlRaw = rawControl, OwningControl = control, Value = value
            });
        }
Exemplo n.º 38
0
 public ViewStateBinder(IBindingContainer bindingContainer, IDataStorageService dataStorageService, IControlService controlService)
     : base(bindingContainer, dataStorageService, controlService)
 {
 }
Exemplo n.º 39
0
 public void GetProgramsForTitle(ISchedulerService tvSchedulerServiceAgent, IControlService tvControlServiceAgent, string title)
 {
     _model.CurrentTitle = title;
     RefreshAllUpcomingPrograms(tvSchedulerServiceAgent, tvControlServiceAgent);
     _model.CurrentTitlePrograms = new ChannelProgramsList(tvSchedulerServiceAgent.SearchGuideByTitle(_model.ChannelType, _model.CurrentTitle, false));
 }
Exemplo n.º 40
0
 public void CancelOrUncancelUpcomingProgram(ISchedulerService tvSchedulerAgent, IGuideService tvGuideAgent,
     IControlService tvControlAgent, Guid scheduleId, Guid channelId, Guid guideProgramId, bool cancel)
 {
     GuideProgram guideProgram = tvGuideAgent.GetProgramById(guideProgramId);
     if (guideProgram != null)
     {
         if (cancel)
         {
             tvSchedulerAgent.CancelUpcomingProgram(scheduleId, guideProgramId, channelId, guideProgram.StartTime);
         }
         else
         {
             tvSchedulerAgent.UncancelUpcomingProgram(scheduleId, guideProgramId, channelId, guideProgram.StartTime);
         }
         RefreshUpcomingPrograms(tvSchedulerAgent, tvControlAgent);
     }
 }
Exemplo n.º 41
0
 public void AddRemoveHistoryUpcomingProgram(ISchedulerService tvSchedulerAgent, IControlService tvControlAgent,
     UpcomingProgram upcomingProgram, bool addToHistory)
 {
     if (addToHistory)
     {
         tvControlAgent.AddToPreviouslyRecordedHistory(upcomingProgram);
     }
     else
     {
         tvControlAgent.RemoveFromPreviouslyRecordedHistory(upcomingProgram);
     }
     RefreshUpcomingPrograms(tvSchedulerAgent, tvControlAgent);
 }
Exemplo n.º 42
0
 public void ReloadRecordingGroups(IControlService tvControlAgent, RecordingGroupMode groupMode)
 {
     _model.RecordingGroups = new List<RecordingGroup>(tvControlAgent.GetAllRecordingGroups(_model.ChannelType, groupMode));
     _model.RecordingsByGroup.Clear();
 }
Exemplo n.º 43
0
 public void RefreshEpgData(ISchedulerService tvSchedulerAgent, IGuideService tvGuideAgent,
     IControlService tvControlAgent, bool reloadData, Guid currentChannelGroupId, DateTime guideDateTime)
 {
     RefreshEpgData(tvSchedulerAgent, tvGuideAgent, tvControlAgent, reloadData, currentChannelGroupId, guideDateTime, null);
 }
Exemplo n.º 44
0
 public void RefreshEpgData(ISchedulerService tvSchedulerAgent, IGuideService tvGuideAgent,
     IControlService tvControlAgent, bool reloadData, Guid currentChannelGroupId, DateTime guideDateTime,
     CancellationPendingDelegate cancellationPending)
 {
     if (reloadData)
     {
         _model.ProgramsByChannel.Clear();
         RefreshUpcomingPrograms(tvSchedulerAgent, tvControlAgent);
         if (cancellationPending != null
             && cancellationPending())
         {
             return;
         }
     }
     if (guideDateTime != DateTime.MinValue)
     {
         SetChannelGroup(currentChannelGroupId);
         _model.GuideDateTime = guideDateTime;
         _model.Channels = new List<Channel>(tvSchedulerAgent.GetChannelsInGroup(currentChannelGroupId, true));
         if (cancellationPending != null
             && cancellationPending())
         {
             return;
         }
         RefreshChannelsEpgData(tvGuideAgent, _model.Channels, guideDateTime, guideDateTime.AddDays(1), cancellationPending);
     }
     else
     {
         _model.Channels = new List<Channel>();
     }
 }
Exemplo n.º 45
0
 public RecordingSummary[] GetRecordingsForGroup(IControlService tvControlAgent, int groupIndex, bool includeNonExisting)
 {
     if (!_model.RecordingsByGroup.ContainsKey(groupIndex))
     {
         switch (_model.RecordingGroups[groupIndex].RecordingGroupMode)
         {
             case RecordingGroupMode.GroupBySchedule:
                 _model.RecordingsByGroup[groupIndex] = tvControlAgent.GetRecordingsForSchedule(_model.RecordingGroups[groupIndex].ScheduleId, includeNonExisting);
                 break;
             case RecordingGroupMode.GroupByChannel:
                 _model.RecordingsByGroup[groupIndex] = tvControlAgent.GetRecordingsOnChannel(_model.RecordingGroups[groupIndex].ChannelId, includeNonExisting);
                 break;
             case RecordingGroupMode.GroupByProgramTitle:
                 _model.RecordingsByGroup[groupIndex] = tvControlAgent.GetRecordingsForProgramTitle(_model.ChannelType, _model.RecordingGroups[groupIndex].ProgramTitle, includeNonExisting);
                 break;
             case RecordingGroupMode.GroupByRecordingDay:
                 _model.RecordingsByGroup[groupIndex] = tvControlAgent.GetRecordingsForOneDay(_model.ChannelType, _model.RecordingGroups[groupIndex].LatestProgramStartTime, includeNonExisting);
                 break;
             case RecordingGroupMode.GroupByCategory:
                 _model.RecordingsByGroup[groupIndex] = tvControlAgent.GetRecordingsForCategory(_model.ChannelType, _model.RecordingGroups[groupIndex].Category, includeNonExisting);
                 break;
         }
     }
     return _model.RecordingsByGroup[groupIndex];
 }
Exemplo n.º 46
0
 public ControlController(IControlService controlService)
 {
     this.ControlService = controlService;
     this.AddDisposableObject(controlService);
 }
Exemplo n.º 47
0
 public void RefreshUpcomingPrograms(ISchedulerService tvSchedulerAgent, IControlService tvControlAgent)
 {
     _model.UpcomingProgramsByType.Clear();
     RefreshGuideUpcomingRecordings(tvControlAgent);
     _model.UpcomingProgramsByType[ScheduleType.Alert] = GetGuideUpcomingPrograms(tvSchedulerAgent, ScheduleType.Alert);
     _model.UpcomingProgramsByType[ScheduleType.Suggestion] = GetGuideUpcomingPrograms(tvSchedulerAgent, ScheduleType.Suggestion);
     _model.UpcomingRecordingsById = BuildUpcomingProgramsDictionary(ScheduleType.Recording);
     _model.UpcomingAlertsById = BuildUpcomingProgramsDictionary(ScheduleType.Alert);
     _model.UpcomingSuggestionsById = BuildUpcomingProgramsDictionary(ScheduleType.Suggestion);
 }
Exemplo n.º 48
0
 private void RefreshGuideUpcomingRecordings(IControlService tvControlAgent)
 {
     _model.UpcomingRecordings = new UpcomingOrActiveProgramsList(tvControlAgent.GetAllUpcomingRecordings(UpcomingRecordingsFilter.All, true));
     List<GuideUpcomingProgram> result = new List<GuideUpcomingProgram>();
     foreach (UpcomingOrActiveProgramView upcoming in _model.UpcomingRecordings)
     {
         if (upcoming.UpcomingProgram.GuideProgramId.HasValue)
         {
             result.Add(new GuideUpcomingProgram(upcoming.UpcomingRecording));
         }
     }
     _model.UpcomingProgramsByType[ScheduleType.Recording] = result;
 }
Exemplo n.º 49
0
        public static string GetRecordingThumb(RecordingSummary recording,bool createNewThumbIfNotFound ,int size ,IControlService tvControlAgent)
        {
            string thumb = string.Format("{0}\\{1}{2}", Thumbs.TVRecorded,recording.RecordingId,".jpg");
            if (Utils.FileExistsInCache(thumb))
            {
                //local thumb
                return thumb;
            }
            else if (createNewThumbIfNotFound)
            {
                //no local thumb found, ask one from the server and save it
                if (size < 0)
                {
                    size = 0;
                }

                byte[] jpegData = tvControlAgent.GetRecordingThumbnail(recording.RecordingId, size, size, null, recording.RecordingStartTime);
                if (jpegData != null)
                {
                    try
                    {
                        using (System.Drawing.Image img = System.Drawing.Image.FromStream(new MemoryStream(jpegData)))
                        {
                            img.Save(thumb, System.Drawing.Imaging.ImageFormat.Jpeg);
                        }
                    }
                    catch { }
                    jpegData = null;

                    if (Utils.FileExistsInCache(thumb))
                    {
                        return thumb;
                    }
                }
            }
            return string.Empty;
        }
 public ControlRestController(IControlService controlService)
 {
     _controlService = controlService;
 }