コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the TvViewModel class.
 /// </summary>
 public TvViewModel(INavigationService navigationService, IConnectionManager connectionManager, IMessageBoxService messageBox)
     : base(navigationService, connectionManager)
 {
     _messageBox         = messageBox;
     RecentItems         = new ObservableCollection <BaseItemDto>();
     Episodes            = new List <BaseItemDto>();
     CanUpdateFavourites = true;
     if (IsInDesignMode)
     {
         SelectedTvSeries = new BaseItemDto
         {
             Name = "Scrubs"
         };
         SelectedSeason = new BaseItemDto
         {
             Name = "Season 1"
         };
         Episodes = new[]
         {
             new BaseItemDto
             {
                 Id       = "e252ea3059d140a0274282bc8cd194cc",
                 Name     = "1x01 - Pilot",
                 Overview =
                     "A Kindergarten teacher starts speaking gibberish and passed out in front of her class. What looks like a possible brain tumor does not respond to treatment and provides many more questions than answers for House and his team as they engage in a risky trial-and-error approach to her case. When the young teacher refuses any additional variations of treatment and her life starts slipping away, House must act against his code of conduct and make a personal visit to his patient to convince her to trust him one last time."
             }
         }.ToList();
         SelectedEpisode = Episodes[0];
     }
     else
     {
         WireCommands();
     }
 }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the ChooseProfileViewModel class.
 /// </summary>
 public ChooseProfileViewModel(IConnectionManager connectionManager, INavigationService navigationService)
     : base(navigationService, connectionManager)
 {
     Profiles = new ObservableCollection<UserDto>();
     if (IsInDesignMode)
     {
         Profiles = new ObservableCollection<UserDto>
         {
             new UserDto
             {
                 Id = new Guid("dd425709431649698e92d86b1f2b00fa").ToString(),
                 Name = "ScottIsAFool"
             },
             new UserDto
             {
                 Id = new Guid("dab28e40cfbc43658082f55a44cf139a").ToString(),
                 Name = "Redshirt",
                 LastLoginDate = DateTime.Now.AddHours(-1)
             }
         };
     }
     else
     {
         WireCommands();
     }
 }
コード例 #3
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(IConnectionManager connectionManager, INavigationService navigationService, IPlaybackManager playbackManager)
            : base(navigationService, connectionManager)
        {
            _playbackManager = playbackManager;
            Folders          = new ObservableCollection <BaseItemDto>();
            RecentItems      = new ObservableCollection <BaseItemDto>();
            FavouriteItems   = new ObservableCollection <BaseItemDto>();
            InProgressItems  = new ObservableCollection <BaseItemDto>();
            UserViews        = new ObservableCollection <BaseItemDto>();

            if (IsInDesignMode)
            {
                Folders.Add(new BaseItemDto {
                    Id = "78dbff5aa1c2101b98ebaf42b72a988d", Name = "Movies", UserData = new UserItemDataDto {
                        UnplayedItemCount = 6
                    }
                });
                RecentItems.Add(new BaseItemDto {
                    Id = "2fc6f321b5f8bbe842fcd0eed089561d", Name = "A Night To Remember"
                });
            }
            else
            {
                WireCommands();
                DummyFolder = new BaseItemDto
                {
                    Type = "folder",
                    Name = AppResources.LabelRecent.ToLower()
                };
            }
        }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the PushViewModel class.
        /// </summary>
        public SettingsViewModel(
            IConnectionManager connectionManager,
            INavigationService navigationService,
            IApplicationSettingsService applicationSettings,
            IMessageBoxService messageBox,
            IServerInfoService serverInfo)
            : base(navigationService, connectionManager)
        {
            _applicationSettings = applicationSettings.Legacy;
            _messageBox          = messageBox;
            _serverInfo          = serverInfo;

            if (IsInDesignMode)
            {
                FoundServers = new ObservableCollection <ServerInfo>
                {
                    new ServerInfo {
                        Id = Guid.NewGuid().ToString(), Name = "Home", LocalAddress = "http://192.168.0.2:8096"
                    }
                };
            }
            else
            {
                LoadingFromSettings = true;
                SendTileUpdates     = SendToastUpdates = true;
                RegisteredText      = AppResources.DeviceNotRegistered;
                LoadingFromSettings = false;

                SetStreamingQuality();

                _ignoreRunUnderLockChanged = true;
                RunUnderLock = App.SpecificSettings.PlayVideosUnderLock;
                _ignoreRunUnderLockChanged = false;
            }
        }
コード例 #5
0
        internal static async Task StartEverything(INavigationService navigationService, ILog logger, IApiClient apiClient)
        {
            LockScreenService.Current.Start();
            TileService.Current.UpdatePrimaryTile(App.SpecificSettings.DisplayBackdropOnTile, App.SpecificSettings.UseRichWideTile, App.SpecificSettings.UseTransparentTile).ConfigureAwait(false);

            if (LockScreenService.Current.IsProvidedByCurrentApplication)
            {
                LockScreenService.Current.SetLockScreen(App.SpecificSettings.LockScreenType).ConfigureAwait(false);
            }

            Task.Delay(1500).ContinueWith(task =>
            {
                SyncService.Current.StartService().ConfigureAwait(false);
            }).ConfigureAwait(false);

            try
            {
                logger.Info("Checking if live TV is supported");

                var liveTv = await apiClient.GetLiveTvInfoAsync();

                App.Settings.LiveTvInfo = liveTv;
            }
            catch (HttpException ex)
            {
                HandleHttpException(ex, "Live TV Check", navigationService, logger);
            }
        }
コード例 #6
0
        /// <summary>
        /// Initializes a new instance of the PlaylistViewModel class.
        /// </summary>
        public NowPlayingViewModel(INavigationService navigationService, IConnectionManager connectionManager, IStorageService storageService)
            :base (navigationService, connectionManager)
        {
            _playlistChecker = new DispatcherTimer { Interval = new TimeSpan(0, 0, 3) };
            _playlistChecker.Tick += PlaylistCheckerOnTick;

            Playlist = new ObservableCollection<PlaylistItem>();
            SelectedItems = new List<PlaylistItem>();
            if (IsInDesignMode)
            {
                Playlist = new ObservableCollection<PlaylistItem>
                {
                    new PlaylistItem {Artist = "John Williams", Album = "Jurassic Park OST", Id = 1, IsPlaying = true, TrackName = "Jurassic Park Theme"},
                    new PlaylistItem {Artist = "John Williams", Album = "Jurassic Park OST", Id = 2, IsPlaying = false, TrackName = "Journey to the Island"},
                    new PlaylistItem {Artist = "John Williams", Album = "Jurassic Park OST", Id = 10, IsPlaying = false, TrackName = "Incident at Isla Nublar"}
                };
                NowPlayingItem = Playlist[0];
            }
            else
            {
                _playlistHelper = new PlaylistHelper(storageService);
                BackgroundAudioPlayer.Instance.PlayStateChanged += OnPlayStateChanged;
                GetPlaylistItems();
                IsPlaying = BackgroundAudioPlayer.Instance.PlayerState == PlayState.Playing;
            }
        }
コード例 #7
0
        /// <summary>
        /// Initializes a new instance of the TvViewModel class.
        /// </summary>
        public TvViewModel(INavigationService navigationService, IConnectionManager connectionManager, IMessageBoxService messageBox) 
            : base(navigationService, connectionManager)
        {
            _messageBox = messageBox;
            RecentItems = new ObservableCollection<BaseItemDto>();
            Episodes = new List<BaseItemDto>();
            CanUpdateFavourites = true;
            if (IsInDesignMode)
            {
                SelectedTvSeries = new BaseItemDto
                {
                    Name = "Scrubs"
                };
                SelectedSeason = new BaseItemDto
                {
                    Name = "Season 1"
                };
                Episodes = new[]
                {
                    new BaseItemDto
                    {
                        Id = "e252ea3059d140a0274282bc8cd194cc",
                        Name = "1x01 - Pilot",
                        Overview =
                            "A Kindergarten teacher starts speaking gibberish and passed out in front of her class. What looks like a possible brain tumor does not respond to treatment and provides many more questions than answers for House and his team as they engage in a risky trial-and-error approach to her case. When the young teacher refuses any additional variations of treatment and her life starts slipping away, House must act against his code of conduct and make a personal visit to his patient to convince her to trust him one last time."
                    }
                }.ToList();
                SelectedEpisode = Episodes[0];

            }
            else
            {
                WireCommands();
            }
        }
コード例 #8
0
 /// <summary>
 /// Initializes a new instance of the ChooseProfileViewModel class.
 /// </summary>
 public ChooseProfileViewModel(IConnectionManager connectionManager, INavigationService navigationService)
     : base(navigationService, connectionManager)
 {
     Profiles = new ObservableCollection <UserDto>();
     if (IsInDesignMode)
     {
         Profiles = new ObservableCollection <UserDto>
         {
             new UserDto
             {
                 Id   = new Guid("dd425709431649698e92d86b1f2b00fa").ToString(),
                 Name = "ScottIsAFool"
             },
             new UserDto
             {
                 Id            = new Guid("dab28e40cfbc43658082f55a44cf139a").ToString(),
                 Name          = "Redshirt",
                 LastLoginDate = DateTime.Now.AddHours(-1)
             }
         };
     }
     else
     {
         WireCommands();
     }
 }
コード例 #9
0
        /// <summary>
        /// Initializes a new instance of the PushViewModel class.
        /// </summary>
        public SettingsViewModel(
            IConnectionManager connectionManager,
            INavigationService navigationService,
            IApplicationSettingsService applicationSettings, 
            IMessageBoxService messageBox,
            IServerInfoService serverInfo)
            : base(navigationService, connectionManager)
        {
            _applicationSettings = applicationSettings.Legacy;
            _messageBox = messageBox;
            _serverInfo = serverInfo;

            if (IsInDesignMode)
            {
                FoundServers = new ObservableCollection<ServerInfo>
                {
                    new ServerInfo{Id = Guid.NewGuid().ToString(), Name = "Home", LocalAddress = "http://192.168.0.2:8096"}
                };
            }
            else
            {
                LoadingFromSettings = true;
                SendTileUpdates = SendToastUpdates = true;
                RegisteredText = AppResources.DeviceNotRegistered;
                LoadingFromSettings = false;

                SetStreamingQuality();

                _ignoreRunUnderLockChanged = true;
                RunUnderLock = App.SpecificSettings.PlayVideosUnderLock;
                _ignoreRunUnderLockChanged = false;
            }
        }
コード例 #10
0
 /// <summary>
 /// Initializes a new instance of the MovieViewModel class.
 /// </summary>
 public MovieViewModel(INavigationService navigationService, IConnectionManager connectionManager)
     : base(navigationService, connectionManager)
 {
     CanUpdateFavourites = true;
     if (IsInDesignMode)
     {
         SelectedMovie = new BaseItemDto
         {
             Id       = "6536a66e10417d69105bae71d41a6e6f",
             Name     = "Jurassic Park",
             SortName = "Jurassic Park",
             Overview = "Lots of dinosaurs eating people!",
             People   = new[]
             {
                 new BaseItemPerson {
                     Name = "Steven Spielberg", Type = "Director"
                 },
                 new BaseItemPerson {
                     Name = "Sam Neill", Type = "Actor"
                 },
                 new BaseItemPerson {
                     Name = "Richard Attenborough", Type = "Actor"
                 },
                 new BaseItemPerson {
                     Name = "Laura Dern", Type = "Actor"
                 }
             }
         };
     }
     else
     {
         WireCommands();
     }
 }
コード例 #11
0
 /// <summary>
 /// Initializes a new instance of the MovieViewModel class.
 /// </summary>
 public MovieViewModel(INavigationService navigationService, IConnectionManager connectionManager)
     : base(navigationService, connectionManager)
 {
     CanUpdateFavourites = true;
     if (IsInDesignMode)
     {
         SelectedMovie = new BaseItemDto
         {
             Id = "6536a66e10417d69105bae71d41a6e6f",
             Name = "Jurassic Park",
             SortName = "Jurassic Park",
             Overview = "Lots of dinosaurs eating people!",
             People = new[]
             {
                 new BaseItemPerson {Name = "Steven Spielberg", Type = "Director"},
                 new BaseItemPerson {Name = "Sam Neill", Type = "Actor"},
                 new BaseItemPerson {Name = "Richard Attenborough", Type = "Actor"},
                 new BaseItemPerson {Name = "Laura Dern", Type = "Actor"}
             }
         };
     }
     else
     {
         WireCommands();
     }
 }
コード例 #12
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(IConnectionManager connectionManager, INavigationService navigationService, IPlaybackManager playbackManager)
            : base(navigationService, connectionManager)
        {
            _playbackManager = playbackManager;
            Folders = new ObservableCollection<BaseItemDto>();
            RecentItems = new ObservableCollection<BaseItemDto>();
            FavouriteItems = new ObservableCollection<BaseItemDto>();
            InProgressItems = new ObservableCollection<BaseItemDto>();
            UserViews = new ObservableCollection<BaseItemDto>();

            if (IsInDesignMode)
            {
                Folders.Add(new BaseItemDto { Id = "78dbff5aa1c2101b98ebaf42b72a988d", Name = "Movies", UserData = new UserItemDataDto { UnplayedItemCount = 6 } });
                RecentItems.Add(new BaseItemDto { Id = "2fc6f321b5f8bbe842fcd0eed089561d", Name = "A Night To Remember" });
            }
            else
            {
                WireCommands();
                DummyFolder = new BaseItemDto
                {
                    Type = "folder",
                    Name = AppResources.LabelRecent.ToLower()
                };
            }
        }
コード例 #13
0
        /// <summary>
        /// Initializes a new instance of the PlaylistViewModel class.
        /// </summary>
        public NowPlayingViewModel(INavigationService navigationService, IConnectionManager connectionManager, IStorageService storageService)
            : base(navigationService, connectionManager)
        {
            _playlistChecker = new DispatcherTimer {
                Interval = new TimeSpan(0, 0, 3)
            };
            _playlistChecker.Tick += PlaylistCheckerOnTick;

            Playlist      = new ObservableCollection <PlaylistItem>();
            SelectedItems = new List <PlaylistItem>();
            if (IsInDesignMode)
            {
                Playlist = new ObservableCollection <PlaylistItem>
                {
                    new PlaylistItem {
                        Artist = "John Williams", Album = "Jurassic Park OST", Id = 1, IsPlaying = true, TrackName = "Jurassic Park Theme"
                    },
                    new PlaylistItem {
                        Artist = "John Williams", Album = "Jurassic Park OST", Id = 2, IsPlaying = false, TrackName = "Journey to the Island"
                    },
                    new PlaylistItem {
                        Artist = "John Williams", Album = "Jurassic Park OST", Id = 10, IsPlaying = false, TrackName = "Incident at Isla Nublar"
                    }
                };
                NowPlayingItem = Playlist[0];
            }
            else
            {
                _playlistHelper = new PlaylistHelper(storageService);
                BackgroundAudioPlayer.Instance.PlayStateChanged += OnPlayStateChanged;
                GetPlaylistItems();
                IsPlaying = BackgroundAudioPlayer.Instance.PlayerState == PlayState.Playing;
            }
        }
コード例 #14
0
        internal static async Task HandleConnectedState(
            ConnectionResult result,
            IApiClient apiClient,
            INavigationService navigationService,
            ILog log)
        {
            var page = TileService.Current.PinnedPage();

            switch (result.State)
            {
            case ConnectionState.Unavailable:
                App.ShowMessage(AppResources.ErrorCouldNotFindServer);
                navigationService.NavigateTo(Constants.Pages.FirstRun.MbConnectFirstRunView);
                break;

            case ConnectionState.ServerSelection:
                navigationService.NavigateTo(Constants.Pages.SettingsViews.FindServerView);
                break;

            case ConnectionState.ServerSignIn:
                if (AuthenticationService.Current.LoggedInUser == null)
                {
                    navigationService.NavigateTo(Constants.Pages.ChooseProfileView);
                }
                else
                {
                    AuthenticationService.Current.SetAuthenticationInfo();
                    navigationService.NavigateTo(page, true);
                }
                break;

            case ConnectionState.SignedIn:
                if (AuthenticationService.Current.LoggedInUser == null)
                {
                    var user = await apiClient.GetUserAsync(apiClient.CurrentUserId);

                    AuthenticationService.Current.SetUser(user);
                    AuthenticationService.Current.SetAccessToken(apiClient.AccessToken);
                }

                if (AuthenticationService.Current.AuthenticationResult == null)
                {
                    AuthenticationService.Current.SetAccessToken(apiClient.AccessToken);
                }

                await StartEverything(navigationService, log, apiClient);

                navigationService.NavigateTo(page, true);
                break;

            case ConnectionState.ConnectSignIn:
                navigationService.NavigateTo(Constants.Pages.FirstRun.MbConnectFirstRunView);
                break;
            }
        }
コード例 #15
0
        public TrialHelper(INavigationService navigationService, IApplicationSettingsService applicationSettings)
        {
            _navigationService = navigationService;
            _settings = applicationSettings.Legacy;
#if TRIAL
            IsTrial = true;
#else
            CheckLicences().ConfigureAwait(false);
#endif
            _logger = new WPLogger(GetType());

            Current = this;
        }
コード例 #16
0
        public TrialHelper(INavigationService navigationService, IApplicationSettingsService applicationSettings)
        {
            _navigationService = navigationService;
            _settings          = applicationSettings.Legacy;
#if TRIAL
            IsTrial = true;
#else
            CheckLicences().ConfigureAwait(false);
#endif
            _logger = new WPLogger(GetType());

            Current = this;
        }
コード例 #17
0
        /// <summary>
        /// Initializes a new instance of the MusicViewModel class.
        /// </summary>
        public MusicViewModel(IConnectionManager connectionManager, INavigationService navigationService, IPlaybackManager playbackManager)
            : base(navigationService, connectionManager)
        {
            _playbackManager    = playbackManager;
            SelectedTracks      = new List <BaseItemDto>();
            CanUpdateFavourites = true;
            if (IsInDesignMode)
            {
                SelectedArtist = new BaseItemDto
                {
                    Name = "Hans Zimmer",
                    Id   = "179d32421632781047c73c9bd501adea"
                };
                SelectedAlbum = new BaseItemDto
                {
                    Name = "The Dark Knight Rises",
                    Id   = "f8d5c8cbcbd39bc75c2ba7ada65d4319",
                };
                Albums = new ObservableCollection <BaseItemDto>
                {
                    new BaseItemDto {
                        Name = "The Dark Knight Rises", Id = "f8d5c8cbcbd39bc75c2ba7ada65d4319", ProductionYear = 2012
                    },
                    new BaseItemDto {
                        Name = "Batman Begins", Id = "03b6dbb15e4abcca6ee336a2edd79ba6", ProductionYear = 2005
                    },
                    new BaseItemDto {
                        Name = "Sherlock Holmes", Id = "6e2d519b958d440d034c3ba6eca008a4", ProductionYear = 2010
                    }
                };
                AlbumTracks = new List <BaseItemDto>
                {
                    new BaseItemDto {
                        Name = "Bombers Over Ibiza (Junkie XL Remix)", IndexNumber = 1, ParentIndexNumber = 2, RunTimeTicks = 3487920000, Id = "7589bfbe8b10d0191e305d92f127bd01"
                    },
                    new BaseItemDto {
                        Name = "A Storm Is Coming", Id = "1ea1fd991c70b33c596611dadf24defc", IndexNumber = 1, ParentIndexNumber = 1, RunTimeTicks = 369630000
                    },
                    new BaseItemDto {
                        Name = "On Thin Ice", Id = "2696da6a01f254fbd7e199a191bd5c4f", IndexNumber = 2, ParentIndexNumber = 1, RunTimeTicks = 1745500000
                    },
                }.OrderBy(x => x.ParentIndexNumber)
                .ThenBy(x => x.IndexNumber).ToList();

                SortedTracks = Utils.GroupItemsByName(AlbumTracks).Result;
            }
            else
            {
                WireCommands();
            }
        }
コード例 #18
0
 /// <summary>
 /// Initializes a new instance of the RemoteViewModel class.
 /// </summary>
 public RemoteViewModel(INavigationService navigationService, IConnectionManager connectionManager)
     : base(navigationService, connectionManager)
 {
     if (IsInDesignMode)
     {
         Clients = new List <SessionInfoDto>
         {
             new SessionInfoDto
             {
                 Client = "Dashboard"
             }
         };
     }
 }
コード例 #19
0
        internal static bool HandleHttpException(HttpException ex, string message, INavigationService navigationService, ILog log)
        {
            if (ex.StatusCode == HttpStatusCode.Unauthorized)
            {
                MessageBox.Show(AppResources.ErrorDisabledUser, AppResources.ErrorDisabledUserTitle, MessageBoxButton.OK);
                log.Error("UnauthorizedAccess for user [{0}]", AuthenticationService.Current.LoggedInUser.Name);
                navigationService.NavigateTo(Constants.Pages.ChooseProfileView);
                return(true);
            }

            log.ErrorException(message, ex);

            return(false);
        }
コード例 #20
0
 /// <summary>
 /// Initializes a new instance of the RemoteViewModel class.
 /// </summary>
 public RemoteViewModel(INavigationService navigationService, IConnectionManager connectionManager)
     : base(navigationService, connectionManager)
 {
     if (IsInDesignMode)
     {
         Clients = new List<SessionInfoDto>
         {
             new SessionInfoDto
             {
                 Client = "Dashboard"
             }
         };
     }
 }
コード例 #21
0
 /// <summary>
 /// Initializes a new instance of the PhotoUploadViewModel class.
 /// </summary>
 public PhotoUploadViewModel(INavigationService navigationService, IConnectionManager connectionManager, IApplicationSettingsService appSettingsService)
     : base(navigationService, connectionManager)
 {
     _appSettingsService = appSettingsService.Legacy;
     if (IsInDesignMode)
     {
         IsPhotoUploadsEnabled = true;
     }
     else
     {
         _ignoreChange = true;
         IsPhotoUploadsEnabled = App.UploadSettings.IsPhotoUploadsEnabled;
         UploadAll = App.UploadSettings.UploadAllPhotos;
         AfterDateTime = App.UploadSettings.UploadAfterDateTime;
         _ignoreChange = false;
     }
 }
コード例 #22
0
 /// <summary>
 /// Initializes a new instance of the PhotoUploadViewModel class.
 /// </summary>
 public PhotoUploadViewModel(INavigationService navigationService, IConnectionManager connectionManager, IApplicationSettingsService appSettingsService)
     : base(navigationService, connectionManager)
 {
     _appSettingsService = appSettingsService.Legacy;
     if (IsInDesignMode)
     {
         IsPhotoUploadsEnabled = true;
     }
     else
     {
         _ignoreChange         = true;
         IsPhotoUploadsEnabled = App.UploadSettings.IsPhotoUploadsEnabled;
         UploadAll             = App.UploadSettings.UploadAllPhotos;
         AfterDateTime         = App.UploadSettings.UploadAfterDateTime;
         _ignoreChange         = false;
     }
 }
コード例 #23
0
        /// <summary>
        /// Initializes a new instance of the MusicViewModel class.
        /// </summary>
        public MusicViewModel(IConnectionManager connectionManager, INavigationService navigationService, IPlaybackManager playbackManager)
            : base(navigationService, connectionManager)
        {
            _playbackManager = playbackManager;
            SelectedTracks = new List<BaseItemDto>();
            CanUpdateFavourites = true;
            if (IsInDesignMode)
            {
                SelectedArtist = new BaseItemDto
                {
                    Name = "Hans Zimmer",
                    Id = "179d32421632781047c73c9bd501adea"
                };
                SelectedAlbum = new BaseItemDto
                {
                    Name = "The Dark Knight Rises",
                    Id = "f8d5c8cbcbd39bc75c2ba7ada65d4319",
                };
                Albums = new ObservableCollection<BaseItemDto>
                {
                    new BaseItemDto {Name = "The Dark Knight Rises", Id = "f8d5c8cbcbd39bc75c2ba7ada65d4319", ProductionYear = 2012},
                    new BaseItemDto {Name = "Batman Begins", Id = "03b6dbb15e4abcca6ee336a2edd79ba6", ProductionYear = 2005},
                    new BaseItemDto {Name = "Sherlock Holmes", Id = "6e2d519b958d440d034c3ba6eca008a4", ProductionYear = 2010}
                };
                AlbumTracks = new List<BaseItemDto>
                {
                    new BaseItemDto {Name = "Bombers Over Ibiza (Junkie XL Remix)", IndexNumber = 1, ParentIndexNumber = 2, RunTimeTicks = 3487920000, Id = "7589bfbe8b10d0191e305d92f127bd01"},
                    new BaseItemDto {Name = "A Storm Is Coming", Id = "1ea1fd991c70b33c596611dadf24defc", IndexNumber = 1, ParentIndexNumber = 1, RunTimeTicks = 369630000},
                    new BaseItemDto {Name = "On Thin Ice", Id = "2696da6a01f254fbd7e199a191bd5c4f", IndexNumber = 2, ParentIndexNumber = 1, RunTimeTicks = 1745500000},
                }.OrderBy(x => x.ParentIndexNumber)
                    .ThenBy(x => x.IndexNumber).ToList();

                SortedTracks = Utils.GroupItemsByName(AlbumTracks).Result;
            }
            else
            {
                WireCommands();
            }
        }
コード例 #24
0
 /// <summary>
 /// Initializes a new instance of the LiveTvViewModel class.
 /// </summary>
 public LiveTvViewModel(INavigationService navigationService, IConnectionManager connectionManager)
     : base(navigationService, connectionManager)
 {
 }
コード例 #25
0
 /// <summary>
 /// Initializes a new instance of the SplashscreenViewModel class.
 /// </summary>
 public SplashscreenViewModel(IConnectionManager connectionManager, INavigationService navigationService, IApplicationSettingsService applicationSettings, IServerInfoService serverInfo)
     : base(navigationService, connectionManager)
 {
     _serverInfo          = serverInfo;
     _applicationSettings = applicationSettings.Legacy;
 }
コード例 #26
0
 /// <summary>
 /// Initializes a new instance of the LiveTvViewModel class.
 /// </summary>
 public LiveTvViewModel(INavigationService navigationService, IConnectionManager connectionManager)
     : base (navigationService, connectionManager)
 {
 }
コード例 #27
0
        public static async Task MarkAsWatched(BaseItemDto item, ILog log, IApiClient apiClient, INavigationService navigationService)
        {
            if (!navigationService.IsNetworkAvailable)
            {
                return;
            }

            try
            {
                item.UserData = item.UserData.Played
                    ? await apiClient.MarkUnplayedAsync(item.Id, AuthenticationService.Current.LoggedInUserId)
                    : await apiClient.MarkPlayedAsync(item.Id, AuthenticationService.Current.LoggedInUserId, DateTime.Now);

                item.UserData.Played = !item.UserData.Played;

                if (item.UserData.Played)
                {
                    item.UserData.PlayedPercentage      = 0;
                    item.UserData.PlaybackPositionTicks = 0;
                }
            }
            catch (HttpException ex)
            {
                MessageBox.Show(AppResources.ErrorProblemUpdatingItem, AppResources.ErrorTitle, MessageBoxButton.OK);
                Utils.HandleHttpException("MarkAsWatchedCommand", ex, navigationService, log);
            }
        }
コード例 #28
0
 internal static bool HandleHttpException(string message, HttpException ex, INavigationService navigationService, ILog log)
 {
     return(HandleHttpException(ex, message, navigationService, log));
 }
コード例 #29
0
 public ConnectSignUpViewModel(INavigationService navigationService, IConnectionManager connectionManager, IMessageBoxService messageBox)
     : base(navigationService, connectionManager)
 {
     _messageBox = messageBox;
 }
コード例 #30
0
 public ConnectSignUpViewModel(INavigationService navigationService, IConnectionManager connectionManager, IMessageBoxService messageBox)
     : base(navigationService, connectionManager)
 {
     _messageBox = messageBox;
 }
コード例 #31
0
 /// <summary>
 /// Initializes a new instance of the MbConnectViewModel class.
 /// </summary>
 public MbConnectViewModel(INavigationService navigationService, IConnectionManager connectionManager, IApplicationSettingsService appSettings, IServerInfoService serverInfo)
     : base(navigationService, connectionManager)
 {
     _serverInfo = serverInfo;
     _appSettings = appSettings.Legacy;
 }