public async Task Sync(IApiClient apiClient, ServerInfo serverInfo, IProgress<double> progress, CancellationToken cancellationToken = default(CancellationToken)) { _logger.Debug("Beginning media sync process with server Id: {0}", serverInfo.Id); // First report actions to the server that occurred while offline await ReportOfflineActions(apiClient, serverInfo, cancellationToken).ConfigureAwait(false); progress.Report(1); await SyncData(apiClient, serverInfo, false, cancellationToken).ConfigureAwait(false); progress.Report(3); var innerProgress = new DoubleProgress(); innerProgress.RegisterAction(pct => { var totalProgress = pct * .97; totalProgress += 1; progress.Report(totalProgress); }); await GetNewMedia(apiClient, serverInfo, innerProgress, cancellationToken); progress.Report(100); // Do the data sync twice so the server knows what was removed from the device await SyncData(apiClient, serverInfo, true, cancellationToken).ConfigureAwait(false); }
/// <summary> /// Gets the playable path. /// </summary> /// <param name="item">The item.</param> /// <param name="isoMount">The iso mount.</param> /// <param name="apiClient">The API client.</param> /// <param name="startTimeTicks">The start time ticks.</param> /// <returns>System.String.</returns> public static string GetPlayablePath(BaseItemDto item, IIsoMount isoMount, IApiClient apiClient, long? startTimeTicks, int? maxBitrate) { // Check the mounted path first if (isoMount != null) { if (item.IsoType.HasValue && item.IsoType.Value == IsoType.BluRay) { return GetBlurayPath(isoMount.MountedPath); } return isoMount.MountedPath; } if (item.LocationType == LocationType.FileSystem) { if (File.Exists(item.Path) || Directory.Exists(item.Path)) { if (item.VideoType.HasValue && item.VideoType.Value == VideoType.BluRay) { return GetBlurayPath(item.Path); } return item.Path; } } return GetStreamedPath(item, apiClient, startTimeTicks, maxBitrate); }
public PlaybackProgressReporter(IApiClient apiClient, IMediaPlayer mediaPlayer, ILogger logger, IPlaybackManager playback) { _apiClient = apiClient; _mediaPlayer = mediaPlayer; _logger = logger; _playback = playback; }
public ItemSpotlightViewModel(IImageManager imageManager, IApiClient apiClient) { _apiClient = apiClient; _urlsToItems = new Dictionary<string, BaseItemDto>(); Images = new ImageSlideshowViewModel(imageManager, Enumerable.Empty<string>()) { ImageStretch = Stretch.UniformToFill }; Images.PropertyChanged += (s, e) => { if (e.PropertyName == "CurrentImageUrl") { BaseItemDto item = CurrentItem; CurrentCaption = item != null ? item.Name : null; OnPropertyChanged("CurrentItem"); } }; ItemSelectedCommand = new RelayCommand(o => { BaseItemDto item = CurrentItem; Action<BaseItemDto> action = ItemSelectedAction; if (action != null && item != null) { action(item); } }); }
public ServerDetailsViewModel(ILogManager logManager, IApiClient apiClient, ITheaterConfigurationManager config) { _apiClient = apiClient; _config = config; IsSearchingForServer = true; HostName = _config.Configuration.ServerHostName ?? "127.0.0.1"; Port = _config.Configuration.ServerApiPort; Task.Run(async () => { try { var address = await new ServerLocator().FindServer(500, CancellationToken.None).ConfigureAwait(false); var parts = address.ToString().Split(':'); HostName = parts[0]; Port = address.Port; } catch (Exception e) { var log = logManager.GetLogger("SetupWizard.SeverDetails"); log.ErrorException("Failed to discover server", e); } finally { IsSearchingForServer = false; } }); }
public ScreensaverManager(IUserInputManager userInput, IPresentationManager presentationManager, IPlaybackManager playback, ISessionManager session, IApiClient apiClient, ITheaterConfigurationManager theaterConfigurationManager, ILogManager logManager, IServerEvents serverEvents) { _userInput = userInput; _presentationManager = presentationManager; _playback = playback; _session = session; _apiClient = apiClient; _theaterConfigurationManager = theaterConfigurationManager; _logger = logManager.GetLogger(GetType().Name); _serverEvents = serverEvents; _session.UserLoggedIn += session_UserChanged; _session.UserLoggedOut += session_UserChanged; _playback.PlaybackCompleted += _playback_PlaybackCompleted; _playback.PlaybackStarted += _playback_PlaybackStarted; _serverEvents.BrowseCommand += _serverEvents_BrowseCommand; _serverEvents.MessageCommand += _serverEvents_MessageCommand; _serverEvents.PlayCommand += _serverEvents_PlayCommand; _serverEvents.PlaystateCommand += _serverEvents_PlaystateCommand; _serverEvents.GeneralCommand += _serverEvents_GeneralCommand; SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged; StartTimer(); }
public CriticReviewListViewModel(IPresentationManager presentationManager, IApiClient apiClient, IImageManager imageManager, string itemId) { ImageManager = imageManager; _itemId = itemId; ApiClient = apiClient; PresentationManager = presentationManager; }
public void BeginNextRoundSetup(IApiClient client, SetupState setupState) { SetupState = setupState; SetupState.IsAttackerReady = false; SetupState.IsDefenderReady = false; client.SetupStarted(); }
public UserListViewModel(IPresentationManager presentationManager, IImageManager imageManager, ISessionManager sessionManager, IApiClient apiClient) { ApiClient = apiClient; SessionManager = sessionManager; ImageManager = imageManager; PresentationManager = presentationManager; }
/// <summary> /// Initializes a new instance of the <see cref="ImageManager" /> class. /// </summary> /// <param name="apiClient">The API client.</param> /// <param name="paths">The paths.</param> /// <param name="config"></param> public ImageManager(IApiClient apiClient, IApplicationPaths paths, ITheaterConfigurationManager config) { _apiClient = apiClient; _config = config; _remoteImageCache = new FileSystemRepository(Path.Combine(paths.CachePath, "remote-images")); }
public PoGoNavigation(IApiPlayer player, IApiClient client, ILogicSettings logicSettings, ISettings settings) { _player = player; _client = client; _logicSettings = logicSettings; _settings = settings; }
/// <summary> /// Initializes a new instance of the <see cref="MainWindow" /> class. /// </summary> public MainWindow(ILogger logger, IPlaybackManager playbackManager, IApiClient apiClient, IImageManager imageManager, IApplicationHost appHost, IPresentationManager appWindow, IUserInputManager userInput, ITheaterConfigurationManager config, INavigationService nav, IScreensaverManager screensaverManager) : base() { _logger = logger; _appHost = appHost; _appWindow = appWindow; _config = config; _playbackManager = playbackManager; UserInputManager = userInput; NavigationManager = nav; Loaded += MainWindow_Loaded; InitializeComponent(); RotatingBackdrops = new RotatingBackdropsViewModel(apiClient, _config, imageManager, playbackManager, logger, screensaverManager); _config.ConfigurationUpdated += _config_ConfigurationUpdated; _playbackManager.PlaybackStarted += _playbackManager_PlaybackStarted; _playbackManager.PlaybackCompleted += _playbackManager_PlaybackCompleted; //Timeline.DesiredFrameRateProperty.OverrideMetadata( // typeof(Timeline), // new FrameworkPropertyMetadata { DefaultValue = 30 } //); }
public UserProfileWindow(DefaultThemePageMasterCommandsViewModel masterCommands, ISessionManager session, IPresentationManager presentationManager, IImageManager imageManager, IApiClient apiClient, DisplayPreferences displayPreferences, ListPageConfig options) { _session = session; _options = options; _displayPreferencesViewModel = new DisplayPreferencesViewModel(displayPreferences, presentationManager); _previousFocus = ""; InitializeComponent(); Loaded += UserProfileWindow_Loaded; Unloaded += UserProfileWindow_Unloaded; masterCommands.PageNavigated += masterCommands_PageNavigated; BtnClose.Click += BtnClose_Click; //Display preferences RadioList.Click += radioList_Click; RadioPoster.Click += radioPoster_Click; RadioThumbstrip.Click += radioThumbstrip_Click; RadioPosterStrip.Click += radioPosterStrip_Click; //Sort preferences RadioSortAscending.Click += RadioSortAscending_Click; RadioSortDescending.Click += RadioSortDescending_Click; //Focus tracking BtnClose.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; HomeButton.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; DisplayPreferencesButton.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; SortButton.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; SettingsButton.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; LogoutButton.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; ShutdownAppButton.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; SleepButton.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; RestartButton.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; ShutdownButton.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; RadioList.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; RadioPosterStrip.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; RadioPoster.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; RadioThumbstrip.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; RadioSortAscending.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; RadioSortDescending.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; CheckBoxSortRemember.IsKeyboardFocusedChanged += Button_IsKeyboardFocusedChanged; ContentGrid.DataContext = new DefaultThemeUserDtoViewModel(masterCommands, apiClient, imageManager, session) { User = session.CurrentUser, ImageHeight = 54 }; MainGrid.DataContext = this; CheckBoxSortRemember.DataContext = _displayPreferencesViewModel; if (displayPreferences != null) { //Always set to false to begin with in case the user is just doing a quick sort and doesn't want it saved. _displayPreferencesViewModel.RememberSorting = false; } }
public OpenSideMenuMenuCommand(INavigator navigator, ISessionManager sessionManager,IImageManager imageManager, IApiClient apiClient) { _sessionManager = sessionManager; _imageManager = imageManager; _apiClient = apiClient; ExecuteCommand = new RelayCommand(arg => navigator.Navigate(Go.To.SideMenu())); }
public PoGoLogin(IApiLogin apiLogin, IApiClient client) { _apiLogin = apiLogin; _client = client; _apiLogin.GoogleDeviceCodeEvent += OnGoogleDeviceCode; }
internal static async Task<PlaylistItem> ToPlaylistItem(this BaseItemDto item, IApiClient apiClient, IPlaybackManager playbackManager) { var profile = VideoProfileHelper.GetWindowsPhoneProfile(); var options = new AudioOptions { Profile = profile, ItemId = item.Id, DeviceId = apiClient.DeviceId, MediaSources = item.MediaSources }; //var streamInfo = await playbackManager.GetAudioStreamInfo(App.ServerInfo.Id, options, true, apiClient); var streamBuilder = new StreamBuilder(new MBLogger()); var streamInfo = streamBuilder.BuildAudioItem(options); var streamUrl = streamInfo.ToUrl(apiClient.GetApiUrl("/"), apiClient.AccessToken); return new PlaylistItem { Album = item.Album, Artist = item.AlbumArtist, TrackName = item.Name, TrackUrl = streamUrl.Replace(App.ServerInfo.LocalAddress, !string.IsNullOrEmpty(App.ServerInfo.ManualAddress) ? App.ServerInfo.ManualAddress : App.ServerInfo.RemoteAddress), MediaBrowserId = item.Id, IsJustAdded = true, ImageUrl = (string) ImageConverter.Convert(item, typeof (string), null, null), BackgroundImageUrl = (string) ImageConverter.Convert(item, typeof (string), "backdrop", null), RunTimeTicks = item.RunTimeTicks ?? 0 }; }
private static void CreateClient() { try { _logger.Info("Creating API Client"); var device = new Device { DeviceId = SharedUtils.GetDeviceId(), DeviceName = SharedUtils.GetDeviceName() }; var server = ApplicationSettings.Get<ServerInfo>(Constants.Settings.DefaultServerConnection); if (server == null) { _logger.Info("No server details found"); return; } var serverAddress = server.LastConnectionMode.HasValue && server.LastConnectionMode.Value == ConnectionMode.Manual ? server.ManualAddress : server.RemoteAddress; var client = new ApiClient(MediaBrowserLogger, serverAddress, "Windows Phone 8", device, ApplicationManifest.Current.App.Version, new CryptographyProvider()); client.SetAuthenticationInfo(server.AccessToken, server.UserId); _logger.Info("Client created"); _apiClient = client; } catch (Exception ex) { _logger.FatalException("Error creating ApiClient", ex); } }
public async Task LoginToServer(IApiClient apiClient, string username, string password, bool rememberCredentials) { //Check just in case if (password == null) { password = string.Empty; } _connectionManager.SaveLocalCredentials = rememberCredentials; try { var result = await apiClient.AuthenticateUserAsync(username, password); CurrentUser = result.User; _config.Configuration.RememberLogin = rememberCredentials; _config.SaveConfiguration(); } catch (HttpException ex) { throw new UnauthorizedAccessException("Invalid username or password. Please try again."); } await AfterLogin(); }
public GistCreationViewModel( IRepositoryHost repositoryHost, ISelectedTextProvider selectedTextProvider, IGistPublishService gistPublishService, IUsageTracker usageTracker) { Title = Resources.CreateGistTitle; apiClient = repositoryHost.ApiClient; this.gistPublishService = gistPublishService; this.usageTracker = usageTracker; FileName = VisualStudio.Services.GetFileNameFromActiveDocument() ?? Resources.DefaultGistFileName; SelectedText = selectedTextProvider.GetSelectedText(); // This class is only instantiated after we are logged into to a github account, so we should be safe to grab the first one here as the defaut. account = repositoryHost.ModelService.GetAccounts() .FirstAsync() .Select(a => a.First()) .ObserveOn(RxApp.MainThreadScheduler) .ToProperty(this, vm => vm.Account); var canCreateGist = this.WhenAny( x => x.FileName, fileName => !String.IsNullOrEmpty(fileName.Value)); CreateGist = ReactiveCommand.CreateAsyncObservable(canCreateGist, OnCreateGist); }
private void AttackerMove(IApiClient client, SetupState setupState) { RoundState.AttackerInfo.PositionX += RoundState.AttackerInfo.Speed * setupState.AttackerUpgrades.Last().SpeedMultiplier; System.Console.Out.WriteLine("MOVING >:D (x:{0} y:{1})", RoundState.AttackerInfo.PositionX, RoundState.AttackerInfo.PositionY); client.AttackerMoved((int)RoundState.AttackerInfo.PositionX, (int)RoundState.AttackerInfo.PositionY); }
public PageContentViewModel(INavigationService navigationService, ISessionManager sessionManager, IPlaybackManager playbackManager, ILogger logger, ITheaterApplicationHost appHost, IApiClient apiClient, IPresentationManager presentationManager, IServerEvents serverEvents) { NavigationService = navigationService; SessionManager = sessionManager; PlaybackManager = playbackManager; Logger = logger; AppHost = appHost; ApiClient = apiClient; PresentationManager = presentationManager; ServerEvents = serverEvents; MasterCommands = new MasterCommandsViewModel(navigationService, sessionManager, presentationManager, apiClient, logger, appHost, serverEvents); NavigationService.Navigated += NavigationServiceNavigated; SessionManager.UserLoggedIn += SessionManagerUserLoggedIn; SessionManager.UserLoggedOut += SessionManagerUserLoggedOut; PlaybackManager.PlaybackStarted += PlaybackManager_PlaybackStarted; PlaybackManager.PlaybackCompleted += PlaybackManager_PlaybackCompleted; _dispatcher = Dispatcher.CurrentDispatcher; _clockTimer = new Timer(ClockTimerCallback, null, 0, 10000); IsLoggedIn = SessionManager.CurrentUser != null; var page = NavigationService.CurrentPage; IsOnHomePage = page is IHomePage; IsOnFullscreenVideo = page is IFullscreenVideoPage; }
public void StartGameLoop(IApiClient client, SetupState setupState, SetupController setupController) { if (RoundState != null && RoundState.IsRoundStarted) { System.Console.WriteLine("Game is already started"); client.ErrorOccured("Game is already started"); return; } RoundState = new RoundState(); RoundState.IsRoundStarted = true; client.RoundStarted(); //bool success = true; Task.Factory.StartNew(() => { InitializeAttackerInfo(setupState); while (!IsRoundOver(setupState)&&RoundState.IsRoundStarted) { IsAttackerInRange(client, setupState); AttackerMove(client, setupState); //AttackerRecievedDamage(client); Task.Delay(300).Wait(); } StopShooting(client); RoundState.IsRoundStarted = false; client.RoundFinished(); EndOfGame(client); }); }
public FavoritesViewModel(IPresentationManager presentation, IImageManager imageManager, IApiClient apiClient, ISessionManager session, INavigationService nav, IPlaybackManager playback, ILogger logger, double tileWidth, double tileHeight, IServerEvents serverEvents) : base(presentation, apiClient) { _sessionManager = session; _playbackManager = playback; _imageManager = imageManager; _navService = nav; _logger = logger; _serverEvents = serverEvents; TileWidth = tileWidth; TileHeight = tileHeight; var spotlightTileWidth = TileWidth * 2 + TilePadding; var spotlightTileHeight = spotlightTileWidth * 9 / 16; SpotlightViewModel = new ImageViewerViewModel(_imageManager, new List<ImageViewerImage>()) { Height = spotlightTileHeight, Width = spotlightTileWidth, CustomCommandAction = i => _navService.NavigateToItem(i.Item, ViewType.Tv) }; LoadViewModels(); NavigateToFavoriteMoviesCommand = new RelayCommand(o => NavigateToFavorites("Movie")); }
/// <summary> /// Gets the playable path. /// </summary> /// <param name="item">The item.</param> /// <param name="isoMount">The iso mount.</param> /// <param name="apiClient">The API client.</param> /// <param name="startTimeTicks">The start time ticks.</param> /// <returns>System.String.</returns> public static string GetPlayablePath(BaseItemDto item, IIsoMount isoMount, IApiClient apiClient, long? startTimeTicks) { // Check the mounted path first if (isoMount != null) { if (item.IsoType.HasValue && item.IsoType.Value == IsoType.BluRay) { return GetBlurayPath(isoMount.MountedPath); } return isoMount.MountedPath; } // Stream remote items through the api if (item.LocationType == LocationType.Remote) { return GetStreamedPath(item, apiClient, startTimeTicks); } // Stream if we can't access the file system if (!File.Exists(item.Path) && !Directory.Exists(item.Path)) { return GetStreamedPath(item, apiClient, startTimeTicks); } if (item.VideoType.HasValue && item.VideoType.Value == VideoType.BluRay) { return GetBlurayPath(item.Path); } return item.Path; }
public ThemeSongEntryPoint(INavigationService nav, IPlaybackManager playback, IApiClient apiClient, ISessionManager session) { _nav = nav; _playback = playback; _apiClient = apiClient; _session = session; }
public CreateController(IApiClient apiClient, IUserImagesService userImagesService, ICurrentUserSession currentUserSession) { _apiClient = apiClient; _userImagesService = userImagesService; _currentUserSession = currentUserSession; _imageCleanup = _userImagesService.ImageCleanup; }
public PlaybackManager(ITheaterConfigurationManager configurationManager, ILogger logger, IApiClient apiClient, INavigationService nav, IPresentationManager presentationManager) { _configurationManager = configurationManager; _logger = logger; _apiClient = apiClient; _nav = nav; _presentationManager = presentationManager; }
public NetworkSettingsPage(ITheaterConfigurationManager config, IApiClient apiClient, ISessionManager session, IPresentationManager presentationManager) { _config = config; _apiClient = apiClient; _session = session; _presentationManager = presentationManager; InitializeComponent(); }
public StartupWizardXyVsFilter(INavigationService nav, IPresentationManager presentation, IMediaFilters mediaFilters, IApiClient apiClient) { _nav = nav; _presentation = presentation; _mediaFilters = mediaFilters; _apiClient = apiClient; InitializeComponent(); }
private void UnbindEvents(IApiClient client) { client.BrowseCommand -= _serverEvents_BrowseCommand; client.MessageCommand -= _serverEvents_MessageCommand; client.PlayCommand -= _serverEvents_PlayCommand; client.PlaystateCommand -= _serverEvents_PlaystateCommand; client.GeneralCommand -= client_GeneralCommand; }
public IntegrationGateway(IApiClient client) => Client = client;
public TvMazeProxy(IApiClient client, IQueryBuilder queryBuilder, IMapper mapper) { _client = client; _queryBuilder = queryBuilder; _mapper = mapper; }
/// <summary> /// API helper for tests /// </summary> /// <param name="mockedClient">Mocked API client</param> internal ApiHelper(IApiClient mockedClient) { client = mockedClient; }
public Cart(IApiClient client) { _client = client; }
public TasksApi(TaskEndpoints endPoints, IApiClient apiClient, IJsonSerializer serializer, Credentials credentials) : base(apiClient, serializer, credentials) { this.endPoints = endPoints; }
/// <summary> /// Initializes a new instance of the AccountEndpoint class. /// </summary> /// <param name="apiClient">The type of client that will be used for authentication.</param> /// <param name="httpClient"> The class for sending HTTP requests and receiving HTTP responses from the endpoint methods.</param> internal AccountEndpoint(IApiClient apiClient, HttpClient httpClient) : base(apiClient, httpClient) { }
public IndexModel(ILogger <IndexModel> logger, IApiClient apiClient, UserManager <User> userManager) { _logger = logger; _apiClient = apiClient; _userManager = userManager; }
public NewBlogPostModel(IApiClient apiClient) { _apiClient = apiClient; }
public SearchModel(IApiClient apiClient) { _apiClient = apiClient; }
public NotesApi(IApiClient apiClient) { this.apiClient = apiClient; }
protected JobBase(ILogger <JobBase> logger, IApiClient client) { this.logger = logger; this.client = client; }
public CreateModel(IApiClient client) { this.client = client; }
public WelcomeModel(IApiClient apiClient) { _apiClient = apiClient; }
/// <summary> /// Initializes a new instance of the AccountEndpoint class. /// </summary> /// <param name="apiClient">The type of client that will be used for authentication.</param> public AccountEndpoint(IApiClient apiClient) : base(apiClient) { }
public SpeakerModel(IApiClient apiClient) { _apiClient = apiClient; }
public ItemViewModel(BaseItemDto item, IApiClient apiClient, IImageManager imageManager, IPlaybackManager playbackManager, IPresentationManager presentation, ILogger logger) : this(apiClient, imageManager, playbackManager, presentation, logger) { _item = item; }
public ImportCommand(IOptions <AppSettings> options, IApiClient apiClient) { _apiClient = apiClient; _settings = options.Value; }
public LogDNALogger(IApiClient logdna, string app) { this.logdna = logdna; this.app = app; }
/// <summary> /// API helper /// </summary> /// <param name="api">API url location</param> public ApiHelper(string api) { client = new ApiClient(api); }
public HomeController(IApiClient apiClient) { _apiClient = apiClient; }
public DeleteModel(IApiClient client) { _Client = client; }
public CountriesApi(Endpoints endPoints, IApiClient apiClient, IJsonSerializer serializer, Credentials credentials) : base(apiClient, serializer, credentials, endPoints.LoggedIn) { this.endPoints = endPoints.Countries; }
public GamesModel(IApiClient apiClient) { _apiClient = apiClient; }
public PartnerService(IApiClient client) { _apiClient = client ?? new ApiClient(); }
public ApiEncounter(IApiBaseRpc baseRpc, IApiClient client) { _baseRpc = baseRpc; _client = client; }
public AttendeesModel(IApiClient apiClient) { _apiClient = apiClient; }
public MenuCreateController(IApiClient client) : base(client) { }
public DefaultEventHandler(IApiClient client, Action <IApiClient, T> action) { _client = client; _action = action; }
public SessionModel(IApiClient apiClient) { _apiClient = apiClient; }
public IndexModel(IApiClient apiClient) { _apiClient = apiClient; }