Example #1
0
        public SegmentReader(ISegment segment, IWebReader webReader, IWebMetadataFactory webMetadataFactory, IRetryManager retryManager, IPlatformServices platformServices)
        {
            if (null == segment)
                throw new ArgumentNullException(nameof(segment));
            if (null == webReader)
                throw new ArgumentNullException(nameof(webReader));
            if (null == webMetadataFactory)
                throw new ArgumentNullException(nameof(webMetadataFactory));
            if (null == retryManager)
                throw new ArgumentNullException(nameof(retryManager));
            if (null == platformServices)
                throw new ArgumentNullException(nameof(platformServices));

            _segment = segment;
            _webReader = webReader;
            _webMetadataFactory = webMetadataFactory;
            _retryManager = retryManager;
            _platformServices = platformServices;

            if ((segment.Offset >= 0) && (segment.Length > 0))
            {
                _startOffset = segment.Offset;
                _endOffset = segment.Offset + segment.Length - 1;
            }
        }
Example #2
0
        public RetryManager(IPlatformServices platformServices)
        {
            if (null == platformServices)
                throw new ArgumentNullException(nameof(platformServices));

            _platformServices = platformServices;
        }
Example #3
0
        public SystemRandomGenerator(IPlatformServices platformServices)
        {
            if (null == platformServices)
                throw new ArgumentNullException(nameof(platformServices));

            _platformServices = platformServices;

            Reseed();
        }
        public HlsPlaylistSegmentManagerFactory(IHlsPlaylistSegmentManagerPolicy hlsPlaylistSegmentManagerPolicy, IPlatformServices platformServices)
        {
            if (null == hlsPlaylistSegmentManagerPolicy)
                throw new ArgumentNullException(nameof(hlsPlaylistSegmentManagerPolicy));
            if (null == platformServices)
                throw new ArgumentNullException(nameof(platformServices));

            _hlsPlaylistSegmentManagerPolicy = hlsPlaylistSegmentManagerPolicy;
            _platformServices = platformServices;
        }
Example #5
0
		/// <summary>
		/// Creates the game.
		/// </summary>
		/// <returns>The game.</returns>
		/// <param name="platformServices">Platform services.</param>
		/// <param name="loggingService">Logging service. Can be NULL.</param>
		/// <param name="visualizationService">Instance of a service that allows the game state to be visualized.</param>
		/// <param name="continuePreviousGame">If set to <c>true</c> continue previous game.</param>
		/// <param name="progress">Progress.</param>
		public static async Task<PyramidGame> CreateGame(IPlatformServices platformServices, ILoggingService loggingService, IGameVisualizationService visualizationService, IPlayer localPlayer, IPlayer opponentPlayer, bool continuePreviousGame, IProgress<GameAction> progress = null)
		{
			if(platformServices == null)
			{
				throw new ArgumentNullException ("platformServices", "Platform services are required to perform platform specific tasks.");
			}

			if(progress != null)
			{
				progress.Report (GameAction.RegisteringServices);
			}
			// Register all required services.
			GameServiceRegistrar.RegisterServices (platformServices, loggingService);

			// Create a game state.
			GameState gameState = null;

			// Let the interaction service initialize the game state.
			var gameInteractionService = ServiceContainer.Resolve<IGameInteractionService>();

			if(continuePreviousGame)
			{
				var persistenceService = ServiceContainer.Resolve<IPersistenceService> ();
				if(progress != null)
				{
					progress.Report (GameAction.LoadingGameState);
				}
				gameState = await persistenceService.LoadGameStateAsync ();
			}

			// Init a new game?
			if(gameState == null)
			{
				gameState = new GameState ();
				gameInteractionService.InitGameState (gameState);
			}

			// Create an instance of the game itself.
			var game = new PyramidGame ()
 			{
				GameState = gameState,
				// This can be NULL. Then nothing will be displayed.
				VisualizationService = visualizationService,
				LocalPlayer = localPlayer,
				OpponentPlayer = opponentPlayer
			};

			return game;
		}
        public SegmentReaderManagerFactory(ISegmentManagerFactory segmentManagerFactory, IWebMetadataFactory webMetadataFactory, IRetryManager retryManager, IPlatformServices platformServices)
        {
            if (null == segmentManagerFactory)
                throw new ArgumentNullException(nameof(segmentManagerFactory));
            if (null == webMetadataFactory)
                throw new ArgumentNullException(nameof(webMetadataFactory));
            if (null == retryManager)
                throw new ArgumentNullException(nameof(retryManager));
            if (null == platformServices)
                throw new ArgumentNullException(nameof(platformServices));

            _segmentManagerFactory = segmentManagerFactory;
            _webMetadataFactory = webMetadataFactory;
            _retryManager = retryManager;
            _platformServices = platformServices;
        }
Example #7
0
        public HlsStreamSegments(M3U8Parser parser, IWebReader webReader, IRetryManager retryManager, IPlatformServices platformServices)
        {
            if (null == parser)
                throw new ArgumentNullException(nameof(parser));
            if (null == webReader)
                throw new ArgumentNullException(nameof(webReader));
            if (null == retryManager)
                throw new ArgumentNullException(nameof(retryManager));
            if (null == platformServices)
                throw new ArgumentNullException(nameof(platformServices));

            _parser = parser;
            _webReader = webReader;
            _retryManager = retryManager;
            _platformServices = platformServices;

            _mediaSequence = M3U8Tags.ExtXMediaSequence.GetValue<long>(parser.GlobalTags);
        }
Example #8
0
        public HlsProgramStream(IWebReader webReader, ICollection<Uri> urls, ContentType contentType, ContentType streamContentType, IHlsSegmentsFactory segmentsFactory, IWebMetadataFactory webMetadataFactory, IPlatformServices platformServices, IRetryManager retryManager)
        {
            if (null == segmentsFactory)
                throw new ArgumentNullException(nameof(segmentsFactory));
            if (null == webMetadataFactory)
                throw new ArgumentNullException(nameof(webMetadataFactory));
            if (null == webReader)
                throw new ArgumentNullException(nameof(webReader));
            if (null == platformServices)
                throw new ArgumentNullException(nameof(platformServices));
            if (null == retryManager)
                throw new ArgumentNullException(nameof(retryManager));

            _webReader = webReader;
            _segmentsFactory = segmentsFactory;
            _webMetadataFactory = webMetadataFactory;
            Urls = urls;
            ContentType = contentType;
            StreamContentType = streamContentType;
        }
Example #9
0
        public ConsoleManager(Settings settings,
                              RecordingModel recordingModel,
                              MainModel mainModel,
                              ScreenShotModel screenShotModel,
                              VideoSourcesViewModel videoSourcesViewModel,
                              IEnumerable <IVideoSourceProvider> videoSourceProviders,
                              IWebCamProvider webCamProvider,
                              VideoWritersViewModel videoWritersViewModel,
                              IPlatformServices platformServices)
        {
            _settings              = settings;
            _recordingModel        = recordingModel;
            _mainModel             = mainModel;
            _screenShotModel       = screenShotModel;
            _videoSourcesViewModel = videoSourcesViewModel;
            _videoSourceProviders  = videoSourceProviders;
            _webCamProvider        = webCamProvider;
            _videoWritersViewModel = videoWritersViewModel;
            _platformServices      = platformServices;

            // Hide on Full Screen Screenshot doesn't work on Console
            settings.Ui.HideOnFullScreenShot = false;
        }
 public SegmentReaderEnumerable(ISegmentManager segmentManager, IWebMetadataFactory webMetadataFactory, IRetryManager retryManager, IPlatformServices platformServices)
 {
     if (null == segmentManager)
     {
         throw new ArgumentNullException("segmentManager");
     }
     if (null == webMetadataFactory)
     {
         throw new ArgumentNullException("webMetadataFactory");
     }
     if (null == platformServices)
     {
         throw new ArgumentNullException("platformServices");
     }
     if (null == retryManager)
     {
         throw new ArgumentNullException("retryManager");
     }
     this._segmentManager     = segmentManager;
     this._webMetadataFactory = webMetadataFactory;
     this._platformServices   = platformServices;
     this._retryManager       = retryManager;
 }
Example #11
0
        public ConsoleManager(Settings Settings,
                              RecordingModel RecordingModel,
                              ScreenShotModel ScreenShotModel,
                              IEnumerable <IVideoSourceProvider> VideoSourceProviders,
                              IEnumerable <IVideoWriterProvider> VideoWriterProviders,
                              IPlatformServices PlatformServices,
                              WebcamModel WebcamModel,
                              IMessageProvider MessageProvider,
                              IAudioSource AudioSource)
        {
            _settings             = Settings;
            _recordingModel       = RecordingModel;
            _screenShotModel      = ScreenShotModel;
            _videoSourceProviders = VideoSourceProviders;
            _videoWriterProviders = VideoWriterProviders;
            _platformServices     = PlatformServices;
            _webcamModel          = WebcamModel;
            _messageProvider      = MessageProvider;
            _audioSource          = AudioSource;

            // Hide on Full Screen Screenshot doesn't work on Console
            Settings.UI.HideOnFullScreenShot = false;
        }
Example #12
0
        public MyDeezerViewModel(IAuthenticationService authService,
                                 IMyDeezerDataController dataController,
                                 IPlatformServices platformServices)
            : base(platformServices)
        {
            this.authService    = authService;
            this.dataController = dataController;

            this.authService.OnAuthenticationStatusChanged += OnAuthenticationStatusChanged;

            this.favouriteTracks = new MainThreadObservableCollectionAdapter <ITrackViewModel>(this.dataController.FavouriteTracks,
                                                                                               PlatformServices.MainThreadDispatcher);

            this.favouriteAlbums = new MainThreadObservableCollectionAdapter <IAlbumViewModel>(this.dataController.FavouriteAlbums,
                                                                                               PlatformServices.MainThreadDispatcher);

            this.favouriteArtists = new MainThreadObservableCollectionAdapter <IArtistViewModel>(this.dataController.FavouriteArtists,
                                                                                                 PlatformServices.MainThreadDispatcher);

            this.dataController.OnFavouriteAlbumFetchStateChanged   += OnFavouriteAlbumsFetchStateChanged;
            this.dataController.OnFavouriteTracksFetchStateChanged  += OnFavouriteTracksFetchStateChanged;
            this.dataController.OnFavouriteArtistsFetchStateChanged += OnFavouriteArtistFetchStateChanged;
        }
Example #13
0
        public SegmentReaderManagerFactory(ISegmentManagerFactory segmentManagerFactory, IWebMetadataFactory webMetadataFactory, IRetryManager retryManager, IPlatformServices platformServices)
        {
            if (null == segmentManagerFactory)
            {
                throw new ArgumentNullException(nameof(segmentManagerFactory));
            }
            if (null == webMetadataFactory)
            {
                throw new ArgumentNullException(nameof(webMetadataFactory));
            }
            if (null == retryManager)
            {
                throw new ArgumentNullException(nameof(retryManager));
            }
            if (null == platformServices)
            {
                throw new ArgumentNullException(nameof(platformServices));
            }

            _segmentManagerFactory = segmentManagerFactory;
            _webMetadataFactory    = webMetadataFactory;
            _retryManager          = retryManager;
            _platformServices      = platformServices;
        }
 public HlsStreamSegments(M3U8Parser parser, IWebReader webReader, IRetryManager retryManager, IPlatformServices platformServices)
 {
     if (null == parser)
     {
         throw new ArgumentNullException("parser");
     }
     if (null == webReader)
     {
         throw new ArgumentNullException("webReader");
     }
     if (null == retryManager)
     {
         throw new ArgumentNullException("retryManager");
     }
     if (null == platformServices)
     {
         throw new ArgumentNullException("platformServices");
     }
     this._parser           = parser;
     this._webReader        = webReader;
     this._retryManager     = retryManager;
     this._platformServices = platformServices;
     this._mediaSequence    = M3U8Tags.ExtXMediaSequence.GetValue <long>(parser.GlobalTags);
 }
Example #15
0
        /// <summary>
        /// Registers the services.
        /// </summary>
        /// <param name="platformServices">Platform services to use.</param>
        /// <param name="loggingService">Logging service. Optional.</param>
        public static void RegisterServices(IPlatformServices platformServices, ILoggingService loggingService = null)
        {
            // Register view models.
            ServiceContainer.Register<NetworkBrowserModel> (() => new NetworkBrowserModel());

            // By default, save to a text file based storage.
            ServiceContainer.Register<IPersistenceService> (() => new DefaultPersistenceService ());
            // Use the default interaction service.
            ServiceContainer.Register<IGameInteractionService> (() => new DefaultGameInteractionService ());
            // Register the platform specific stuff.
            ServiceContainer.Register<IPlatformServices> (platformServices);
            // The game state is required globally.
            ServiceContainer.Register<GameState> ();
            // Register logging.
            if(loggingService == null)
            {
                // Register a logging servive that does nothing to avoid crashes.
                ServiceContainer.Register<ILoggingService> (() => new EmptyLoggingService());
            }
            else
            {
                ServiceContainer.Register<ILoggingService> (loggingService);
            }
        }
Example #16
0
        public ScreenShotModel(ISystemTray SystemTray,
                               IMainWindow MainWindow,
                               IVideoSourcePicker SourcePicker,
                               IAudioPlayer AudioPlayer,
                               IEnumerable <IImageWriterItem> ImageWriters,
                               Settings Settings,
                               ILocalizationProvider Loc,
                               IPlatformServices PlatformServices)
        {
            _systemTray       = SystemTray;
            _mainWindow       = MainWindow;
            _sourcePicker     = SourcePicker;
            _audioPlayer      = AudioPlayer;
            _settings         = Settings;
            _loc              = Loc;
            _platformServices = PlatformServices;

            AvailableImageWriters = ImageWriters.ToList();

            if (!AvailableImageWriters.Any(M => M.Active))
            {
                AvailableImageWriters[0].Active = true;
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ServiceAPIController"/> class.
 /// </summary>
 /// <param name="settings">The repository settings (set in Startup.cs).</param>
 /// <param name="generalSettings">The general settings (set in Startup.cs).</param>
 /// <param name="compilationService">The compilation service (set in Startup.cs).</param>
 /// <param name="authorizationService">The authorization service (set in Startup.cs).</param>
 /// <param name="logger">The logger (set in Startup.cs).</param>
 /// <param name="registerService">The register service (set in Startup.cs).</param>
 /// <param name="formService">The form service.</param>
 /// <param name="repositoryService">The repository service (set in Startup.cs).</param>
 /// <param name="executionService">The execution service (set in Startup.cs).</param>
 /// <param name="profileService">The profile service (set in Startup.cs).</param>
 /// <param name="httpContextAccessor">The http context accessor.</param>
 /// <param name="workflowSI">The workflow service.</param>
 /// <param name="instanceSI">The instance si</param>
 /// <param name="platformSI">The platform si</param>
 /// <param name="data">the data service</param>
 /// <param name="eventSI">the instance event service handler</param>
 public ServiceAPIController(
     IOptions <ServiceRepositorySettings> settings,
     IOptions <GeneralSettings> generalSettings,
     ICompilation compilationService,
     IAuthorization authorizationService,
     ILogger <ServiceAPIController> logger,
     IRegister registerService,
     IForm formService,
     IRepository repositoryService,
     IExecution executionService,
     IProfile profileService,
     IHttpContextAccessor httpContextAccessor,
     IWorkflow workflowSI,
     IInstance instanceSI,
     IPlatformServices platformSI,
     IData data,
     IInstanceEvent eventSI)
 {
     _settings            = settings.Value;
     _generalSettings     = generalSettings.Value;
     _compilation         = compilationService;
     _authorization       = authorizationService;
     _logger              = logger;
     _register            = registerService;
     _form                = formService;
     _repository          = repositoryService;
     _execution           = executionService;
     _profile             = profileService;
     _userHelper          = new UserHelper(_profile, _register, generalSettings);
     _httpContextAccessor = httpContextAccessor;
     _workflowSI          = workflowSI;
     _instance            = instanceSI;
     _platformSI          = platformSI;
     _data                = data;
     _event               = eventSI;
 }
Example #18
0
 public Client(ConnectionSettings settings, IPlatformServices platformServices)
 {
     PlatformServices = platformServices;
     Serializer       = new JsonSerializer();
     Serializer.Converters.Add(new StringEnumConverter());
     _settings    = settings;
     Addons       = new Methods.Addons(this);
     Application  = new Methods.Application(this);
     AudioLibrary = new Methods.AudioLibrary(this);
     Favourites   = new Methods.Favourites(this);
     Files        = new Methods.Files(this);
     GUI          = new Methods.GUI(this);
     Input        = new Methods.Input(this);
     JSONRPC      = new Methods.JSONRPC(this);
     Player       = new Methods.Player(this);
     Playlist     = new Methods.Playlist(this);
     Profiles     = new Methods.Profiles(this);
     PVR          = new Methods.PVR(this);
     Settings     = new Methods.Settings(this);
     System       = new Methods.System(this);
     Textures     = new Methods.Textures(this);
     VideoLibrary = new Methods.VideoLibrary(this);
     XBMC         = new Methods.XBMC(this);
 }
 public StatsPageViewModel(IPlatformServices services) : base(services)
 {
     _service = services;
 }
Example #20
0
 public FullScreenItem(IPlatformServices PlatformServices)
 {
     _platformServices = PlatformServices;
 }
 public SegmentReader(ISegment segment, IWebReader webReader, IWebMetadataFactory webMetadataFactory, IRetryManager retryManager, IPlatformServices platformServices)
 {
     if (null == segment)
     {
         throw new ArgumentNullException("segment");
     }
     if (null == webReader)
     {
         throw new ArgumentNullException("webReader");
     }
     if (null == webMetadataFactory)
     {
         throw new ArgumentNullException("webMetadataFactory");
     }
     if (null == retryManager)
     {
         throw new ArgumentNullException("retryManager");
     }
     if (null == platformServices)
     {
         throw new ArgumentNullException("platformServices");
     }
     this._segment            = segment;
     this._webReader          = webReader;
     this._webMetadataFactory = webMetadataFactory;
     this._retryManager       = retryManager;
     this._platformServices   = platformServices;
     if (segment.Offset < 0L || segment.Length <= 0L)
     {
         return;
     }
     this._startOffset = new long?(segment.Offset);
     this._endOffset   = new long?(segment.Offset + segment.Length - 1L);
 }
Example #22
0
 public PlatformsModel(IPlatformServices platformService)
 {
     _platformService = platformService;
 }
        public ClientMeetingViewModel(
            IClientConnection clientConnection,
            INavigationService navigation,
            ISharedDataService sharedDataService,
            IPlatformServices platformServices)
        {
            _sharedDataService = sharedDataService;
            _clientConnection = clientConnection;
            _navigation = navigation;

            // Combine the meeting details and IsActive to know when to go back
            // We should go back when we are the active screen (IsActive == true)
            // and the Meeting Details are cleared out - will be null.
            _navSub = _clientConnection.MeetingDetails
                .CombineLatest(this.WhenAnyValue(vm => vm.IsActive),
                                (det, act) => new { Details = det, IsActive = act }) // combine into anon type
                .Where(t => t.IsActive && t.Details == null)
                .Subscribe(c => _navigation.BackCommand.Execute(null));

        
            Title = "Welcome to White Label Insurance";

            // Listen for state changes from the shared model
            // and return the non-null ids
            var stateObs = sharedDataService.MeetingState
                .WhenAnyValue(s => s.State)
                .Where(s => s.HasValue) 
                .Select(s => s.Value); // de-Nullable<T> the value since we're not null

            // Get the latest non-null meeting
            var meetingObs = this.ObservableForProperty(vm => vm.Meeting, m => m)
                .Where(v => v != null);

            // Get the latest MeetingState and combine it with the current Meeting
            meetingObs
                .CombineLatest(stateObs, Tuple.Create) // store the latest in a tuple
                .ObserveOn(RxApp.MainThreadScheduler)
                .Subscribe(t =>
                    {
                        // for clarity, extract the tuple
                        var state = t.Item2; 
                        var meeting = t.Item1;

                        // Fet the specififed tool instance by id
                        var activeTool = meeting.Tools.First(tool => tool.ToolId == state.ToolId);

                        // Navigate to the current page within the tool
                        activeTool.GoToPage(state.PageNumber);

                        // Finally, set the tool to be the active one for the meeting
                        meeting.ActiveTool = activeTool;
                    }
                );


            var leaveMeetingCommand = new ReactiveCommand();
            leaveMeetingCommand.Subscribe(_ => _navigation.BackCommand.Execute(null));
            LeaveMeetingCommand = leaveMeetingCommand;

            _pdfAvailableSub = _clientConnection.PdfAvailable.ObserveOn(RxApp.MainThreadScheduler).Subscribe(async p =>
            {
                var result = await _clientConnection.GetIllustrationPdfAsync(p);
                await platformServices.SaveAndLaunchFile(new System.IO.MemoryStream(result), "pdf");
            });

        }
Example #24
0
 public HlsStreamSegmentsFactory(IRetryManager retryManager, IPlatformServices platformServices)
 {
     this._retryManager     = retryManager;
     this._platformServices = platformServices;
 }
Example #25
0
 /// <summary>
 /// Set theme with interface implementation.
 /// </summary>
 /// <param name="services">Platform services.</param>
 /// <param name="iTheme"><see cref="ITheme"/> interface implementation.</param>
 public static void Set(IPlatformServices services, ITheme iTheme)
 {
     Current = iTheme;
     ThemePlatformSpecific.SetColors(services, Current.AppStatusBarBackgroundColor);
 }
Example #26
0
 public SegmentReaderManager(IEnumerable <ISegmentManager> segmentManagers, IWebMetadataFactory webMetadataFactory, IRetryManager retryManager, IPlatformServices platformServices)
 {
     if (null == segmentManagers)
     {
         throw new ArgumentNullException("segmentManagers");
     }
     if (null == webMetadataFactory)
     {
         throw new ArgumentNullException("webMetadataFactory");
     }
     if (null == retryManager)
     {
         throw new ArgumentNullException("retryManager");
     }
     if (null == platformServices)
     {
         throw new ArgumentNullException("platformServices");
     }
     this._segmentManagers = Enumerable.ToArray <ISegmentManager>(segmentManagers);
     if (this._segmentManagers.Length < 1)
     {
         throw new ArgumentException("No segment managers provided");
     }
     this._segmentReaders = Enumerable.ToArray <SegmentReaderManager.ManagerReaders>(Enumerable.Select <ISegmentManager, SegmentReaderManager.ManagerReaders>((IEnumerable <ISegmentManager>) this._segmentManagers, (Func <ISegmentManager, SegmentReaderManager.ManagerReaders>)(sm => new SegmentReaderManager.ManagerReaders()
     {
         Manager = sm,
         Readers = (IAsyncEnumerable <ISegmentReader>) new SegmentReaderManager.SegmentReaderEnumerable(sm, webMetadataFactory, retryManager, platformServices)
     })));
 }
Example #27
0
 public AddPersonCommand(ObservableCollection <Person> people, IPlatformServices platformServices)
 {
     this.people           = people;
     this.platformServices = platformServices ?? throw new ArgumentNullException(nameof(platformServices));
 }
 public DeskDuplFullScreenImageProvider(bool IncludeCursor,
                                        IPreviewWindow PreviewWindow,
                                        IPlatformServices PlatformServices)
 {
     _dupl = new FullScreenDesktopDuplicator(IncludeCursor, PreviewWindow, PlatformServices);
 }
 public HlsStreamSegmentsFactory(IRetryManager retryManager, IPlatformServices platformServices)
 {
     _retryManager = retryManager;
     _platformServices = platformServices;
 }
Example #30
0
 public TsMediaManager(ISegmentReaderManagerFactory segmentReaderManagerFactory, IMediaElementManager mediaElementManager, IMediaStreamSource mediaStreamSource, Func<Buffering.IBufferingManager> bufferingManagerFactory, IMediaManagerParameters mediaManagerParameters, IMediaParserFactory mediaParserFactory, IPlatformServices platformServices);
Example #31
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="services"></param>
 public PlatformController(IPlatformServices services)
 {
     _service = services;
 }
		public DefaultPersistenceService ()
		{
			this.platformServices = ServiceContainer.Resolve<IPlatformServices> ();
		}
Example #33
0
 public HlsProgramStream(IWebReader webReader, ICollection <Uri> urls, IHlsSegmentsFactory segmentsFactory, IWebMetadataFactory webMetadataFactory, IPlatformServices platformServices, IRetryManager retryManager)
 {
     if (null == segmentsFactory)
     {
         throw new ArgumentNullException(nameof(segmentsFactory));
     }
     if (null == webMetadataFactory)
     {
         throw new ArgumentNullException(nameof(webMetadataFactory));
     }
     if (null == webReader)
     {
         throw new ArgumentNullException(nameof(webReader));
     }
     if (null == platformServices)
     {
         throw new ArgumentNullException(nameof(platformServices));
     }
     if (null == retryManager)
     {
         throw new ArgumentNullException(nameof(retryManager));
     }
     _webReader          = webReader;
     _segmentsFactory    = segmentsFactory;
     _webMetadataFactory = webMetadataFactory;
     Urls = urls;
 }
        public RecommendationsPageViewModel(IPlatformServices services) : base(services)
        {
            SubjectChanged += async(id, name) => await Update(true);

            Task.Run(async() => await Update(true));
        }
Example #35
0
 public ScreenItem(IScreen Screen, IPlatformServices PlatformServices)
 {
     this.Screen       = Screen;
     _platformServices = PlatformServices;
 }
 /// <summary>
 /// Login page ViewModel constructor.
 /// </summary>
 public LoginPageViewModel(IPlatformServices services)
 {
     _services          = services;
     IsLoadingCompleted = true;
     IsPasswordHidden   = true;
 }
Example #37
0
 public RegionItem(IRegionProvider RegionSelector, IPlatformServices PlatformServices)
 {
     _selector         = RegionSelector;
     _platformServices = PlatformServices;
 }
 public ParentalsStatsPageViewModel(IPlatformServices services, GroupInfo group) : base(services)
 {
     _service = services;
     Group    = group;
 }
Example #39
0
 public ParentalStudentsPageViewModel(IPlatformServices services, int subjectId, List <StatsStudentModel> studentsList, int pageIndex) : base(services, subjectId, studentsList, pageIndex)
 {
 }
 public void SetPlatformServices(IPlatformServices platformServices)
 {
     this.platformServices = platformServices;
 }
        public AgentMeetingViewModel(
            IAgentConnection agentConnection, 
            ISharedDataService sharedDataService,
            INavigationService navigation,
            IViewModelLocator locator,
            IPlatformServices platformServices)
        {
            _sharedDataService = sharedDataService;
            _agentConnection = agentConnection;
            NavigationPane = locator.NavigationPaneViewModel;

            var startcmd = new ReactiveCommand(this.WhenAnyValue(vm => vm.MeetingStarted, vm => vm.Meeting.VideoConf.VideoInitCompleted, vm => vm.Meeting, (started, video, mtg) => !started && mtg != null));
            _startMeetingSub = startcmd.RegisterAsyncTask(async _ =>
                                                                {
                                    MeetingStarted = true;
                                    Meeting.VideoConf.Config = await _agentConnection.StartMeeting(Meeting.Id);
                                }).Subscribe();

            var endcmd = new ReactiveCommand(this.WhenAnyValue(vm => vm.MeetingStarted, vm => vm.Meeting.VideoConf.VideoInitCompleted, (meetingStarted, videoStarted) => meetingStarted && videoStarted));
            _endMeetingSub = endcmd.RegisterAsyncAction(_ => navigation.BackCommand.Execute(null)).Subscribe();

            StartMeetingCommand = startcmd;
            EndMeetingCommand = endcmd;

            _agentConnection.ClientInMeeting.ToProperty(this, t => t.IsClientInMeeting, out _isClientInMeeting);

            
            var savePdfCmd = new ReactiveCommand(this.WhenAnyValue(vm => vm.MeetingStarted, vm => vm.Meeting.VideoConf.VideoInitCompleted, (meetingStarted, videoStarted) => meetingStarted && videoStarted));
            _pdfSub = savePdfCmd.RegisterAsyncTask(async _ =>
                                                         {
                                                            await _agentConnection.GenerateIllustration(Meeting.Id, _sharedDataService.Person);
                                               }).Subscribe();

            _pdfAvailableSub = _agentConnection.PdfAvailable.ObserveOn(RxApp.MainThreadScheduler).Subscribe(async p =>
                                                    {
                                                        var result = await _agentConnection.GetIllustrationPdfAsync(p);
                                                        await platformServices.SaveAndLaunchFile(new System.IO.MemoryStream(result), "pdf");
                                                    });

            SavePdfCommand = savePdfCmd;


            _titleSub = this.WhenAnyValue(
                vm => vm.Meeting.Client,
                (client) =>
                string.Format("Meeting with {0}",
                              client.FullName)
                )
                            .ObserveOn(RxApp.MainThreadScheduler)
                            .Subscribe(t => Title = t);

            MeetingStatus = GetMeetingStatusString(IsClientInMeeting, MeetingStarted);
            _meetingStatusSub = this.WhenAnyValue(
                         vm => vm.MeetingStarted,
                         vm => vm.IsClientInMeeting,
                         (started, clientIn) => GetMeetingStatusString(clientIn, started))
                         .ObserveOn(RxApp.MainThreadScheduler)
                         .Subscribe(t => MeetingStatus = t);

            //_titleSub = this.WhenAnyValue(
            //             vm => vm.Meeting.Client,
            //             vm => vm.MeetingStarted,
            //             vm => vm.IsClientInMeeting,
            //             (client, started, clientIn) =>
            //                 string.Format("Meeting with {0}. Started: {1} Client Joined: {2}",
            //                    client.FullName, started, clientIn)
            //             )
            //             .ObserveOn(RxApp.MainThreadScheduler)
            //             .Subscribe(t => Title = t);


            // When the meeting's active tool changes, set the Tool and page number
            // into the shared state so it'll be propagated.

            // Get an observable for the currently set tool
            var activeToolObs = this.WhenAnyValue(vm => vm.Meeting.ActiveTool)
                .Where(t => t != null);

            // Every time the tool changes, watch the new tool's CurrentPageNumber
            // for changes.
            //
            // When we get a change, convert that into a ToolIdAndPageNumber, bringing in
            // the owning tool id.
            var pageChangedObs = activeToolObs
                 .Select(t => t.WhenAnyValue(v => v.CurrentPageNumber, 
                                    p => new ToolIdAndPageNumber { ToolId = t.ToolId, PageNumber = p})
                        )
                 .Switch() // Only listen to the most recent sequence of property changes (active tool)
                 .Log(this, "Current Page Changed", t => string.Format("Tool: {0}, Page: {1}", t.ToolId, t.PageNumber));
         
            // Every time the tool changes, select the tool id and current page number
            var toolChangedObs = activeToolObs
                .Select(t => new ToolIdAndPageNumber { ToolId = t.ToolId, PageNumber = t.CurrentPageNumber })
                .Log(this, "Tool Changed", t => string.Format("Tool: {0}, Page: {1}", t.ToolId, t.PageNumber));

            
            // Merge them together - tool changes and current page of the tool
            _meetingStateSub = toolChangedObs
                .Merge(pageChangedObs)
                .Subscribe(t => sharedDataService.MeetingState.State = t);

        }
        private void PopulateViewBag(string org, string service, Guid instanceGuid, int?itemId, RequestContext requestContext, ServiceContext serviceContext, IPlatformServices platformServices)
        {
            ViewBag.RequestContext   = requestContext;
            ViewBag.ServiceContext   = serviceContext;
            ViewBag.Org              = org;
            ViewBag.Service          = service;
            ViewBag.FormID           = instanceGuid;
            ViewBag.PlatformServices = platformServices;

            if (itemId.HasValue)
            {
                ViewBag.ItemID = itemId.Value;
            }
        }
 public ForgotPasswordPageViewModel(IPlatformServices services)
 {
     _services        = services;
     IsPasswordHidden = true;
 }
Example #44
0
 /// <summary>
 /// FindGroup page ViewModel constructor.
 /// </summary>
 public FindGroupPageViewModel(IPlatformServices services)
 {
     _service           = services;
     IsLoadingCompleted = true;
 }