private async Task ConfigureThePlayer()
        {
            var tcs = new TaskCompletionSource <bool>();

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                WPLogger.AppVersion = ApplicationManifest.Current.App.Version;
                WPLogger.LogConfiguration.LogType          = LogType.WriteToFile;
                WPLogger.LogConfiguration.LoggingIsEnabled = true;

                if (ApplicationSettings == null)
                {
                    ApplicationSettings = new ApplicationSettingsService().Legacy;
                }

                if (_logger == null)
                {
                    _logger = new WPLogger(GetType());
                }

                if (_playlistHelper == null)
                {
                    _playlistHelper = new PlaylistHelper(new StorageService());
                }

                if (_apiClient == null)
                {
                    CreateClient();
                }

                tcs.SetResult(true);
            });

            await tcs.Task;
        }
        private async Task ConfigureThePlayer()
        {
            var tcs = new TaskCompletionSource<bool>();

            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
                WPLogger.AppVersion = ApplicationManifest.Current.App.Version;
                WPLogger.LogConfiguration.LogType = LogType.WriteToFile;
                WPLogger.LogConfiguration.LoggingIsEnabled = true;

                if (ApplicationSettings == null)
                {
                    ApplicationSettings = new ApplicationSettingsService().Legacy;
                }

                if (_logger == null)
                {
                    _logger = new WPLogger(GetType());
                }

                if (_playlistHelper == null)
                {
                    _playlistHelper = new PlaylistHelper(new StorageService());
                }

                if (_apiClient == null) CreateClient();

                tcs.SetResult(true);
            });

            await tcs.Task;
        }
        /// <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;
            }
        }
        /// <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;
            }
        }
        public TrialHelper()
        {
            _settings = new ApplicationSettingsService().Legacy;
#if TRIAL
            IsTrial = true;
#else
            IsTrial = new LicenseInformation().IsTrial();
            _settings.Set(Constants.Settings.AppIsBought, !IsTrial);
#endif
        }
        public TrialHelper()
        {
            _settings = new ApplicationSettingsService().Legacy;
#if TRIAL
            IsTrial = true;
#else
            IsTrial = new LicenseInformation().IsTrial();
            _settings.Set(Constants.Settings.AppIsBought, !IsTrial);
#endif
        }
Example #7
0
        public static T GetS <T>(this IApplicationSettingsServiceHandler handler, string key)
        {
            if (!handler.Contains(key))
            {
                return(default(T));
            }

            var json = handler.Get <string>(key);
            var item = JsonConvert.DeserializeObject <T>(json);

            return(item);
        }
        //private readonly ApplicationDataContainer _roamingStorage;


        public AuthenticationService(
            IReadabilityClient readabilityClient,
            IPocketClient pocketClient,
            IInstapaperClient instapaperClient,
            IApplicationSettingsServiceHandler roamingSettings)
        {
            //_roamingStorage = ApplicationData.Current.RoamingSettings;
            _readabilityClient = readabilityClient;
            _pocketClient = pocketClient;
            _instapaperClient = instapaperClient;
            _roamingSettings = roamingSettings;
        }
Example #9
0
        //private readonly ApplicationDataContainer _roamingStorage;


        public AuthenticationService(
            IReadabilityClient readabilityClient,
            IPocketClient pocketClient,
            IInstapaperClient instapaperClient,
            IApplicationSettingsServiceHandler roamingSettings)
        {
            //_roamingStorage = ApplicationData.Current.RoamingSettings;
            _readabilityClient = readabilityClient;
            _pocketClient      = pocketClient;
            _instapaperClient  = instapaperClient;
            _roamingSettings   = roamingSettings;
        }
        public AuthenticationService(IConnectionManager connectionManager, IApplicationSettingsService settingsService)
        {
            _settingsService = settingsService.Legacy;
            _connectionManager = connectionManager;
            _logger = new WPLogger(typeof (AuthenticationService));
            Current = this;

            _connectionManager.ConnectUserSignIn += ConnectionManagerOnConnectUserSignIn;
            _connectionManager.ConnectUserSignOut += ConnectionManagerOnConnectUserSignOut;
            _connectionManager.LocalUserSignIn += ConnectionManagerOnLocalUserSignIn;
            _connectionManager.LocalUserSignOut += ConnectionManagerOnLocalUserSignOut;
        }
Example #11
0
        static ApplicationSettingsService()
        {
#if !WINDOWS_PHONE
            var applicationData = ApplicationData.Current;

            LocalSettingsServiceHandlerStatic   = new ApplicationSettingsServiceHandler(applicationData.LocalSettings);
            RoamingSettingsServiceHandlerStatic = new ApplicationSettingsServiceHandler(applicationData.RoamingSettings);
#endif

#if !WINDOWS_APP
            LegacySettingsServiceHandlerStatic = new LegacyApplicationSettingsServiceHandler();
#endif
        }
        static ApplicationSettingsService()
        {
#if !WINDOWS_PHONE
            var applicationData = ApplicationData.Current;

            LocalSettingsServiceHandlerStatic = new ApplicationSettingsServiceHandler(applicationData.LocalSettings);
            RoamingSettingsServiceHandlerStatic = new ApplicationSettingsServiceHandler(applicationData.RoamingSettings);
#endif

#if !WINDOWS_APP
            LegacySettingsServiceHandlerStatic = new LegacyApplicationSettingsServiceHandler();
#endif
        }
        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;
        }
        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;
        }
Example #15
0
 /// <summary>
 /// Initializes a new instance of the ReaderViewModel class.
 /// </summary>
 public ReaderViewModel(
     INavigationService navigationService,
     ISettingsService settingsService,
     IApplicationSettingsServiceHandler roamingSettings,
     ICacheService cacheService,
     IMessageBoxService messageBox,
     ILocalisationLoader loader,
     IReaderHelper readerHelper)
 {
     _navigationService = navigationService;
     _settingsService = settingsService;
     _roamingSettings = roamingSettings;
     _cacheService = cacheService;
     _messageBox = messageBox;
     _loader = loader;
     _readerHelper = readerHelper;
 }
Example #16
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;
     }
 }
Example #17
0
 /// <summary>
 /// Initializes a new instance of the ReaderViewModel class.
 /// </summary>
 public ReaderViewModel(
     INavigationService navigationService,
     ISettingsService settingsService,
     IApplicationSettingsServiceHandler roamingSettings,
     ICacheService cacheService,
     IMessageBoxService messageBox,
     ILocalisationLoader loader,
     IReaderHelper readerHelper)
 {
     _navigationService = navigationService;
     _settingsService   = settingsService;
     _roamingSettings   = roamingSettings;
     _cacheService      = cacheService;
     _messageBox        = messageBox;
     _loader            = loader;
     _readerHelper      = readerHelper;
 }
 /// <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;
     }
 }
        static ApplicationSettingsService()
        {
            var applicationData = ApplicationData.Current;

#if WINDOWS_PHONE
            if (Version.Parse(Deployment.Current.RuntimeVersion).Major >= 6)
            {
                LocalSettingsServiceHandlerStatic = new ApplicationSettingsServiceHandler(applicationData.LocalSettings);
                RoamingSettingsServiceHandlerStatic = new ApplicationSettingsServiceHandler(applicationData.RoamingSettings);
            }
#else
            LocalSettingsServiceHandlerStatic = new ApplicationSettingsServiceHandler(applicationData.LocalSettings);
            RoamingSettingsServiceHandlerStatic = new ApplicationSettingsServiceHandler(applicationData.RoamingSettings);
#endif

#if !WINDOWS_APP
            LegacySettingsServiceHandlerStatic = new LegacyApplicationSettingsServiceHandler();
#endif
        }
        public AuthenticationService(
            IConnectionManager connectionManager,
            IApplicationSettingsService settingsService,
            IServerInfoService serverInfoService,
            IMessengerService messengerService)
        {
            _settingsService   = settingsService.Legacy;
            _connectionManager = connectionManager;
            _messengerService  = messengerService;
            _logger            = new WPLogger(typeof(AuthenticationService));
            Current            = this;

            _connectionManager.ConnectUserSignIn  += ConnectionManagerOnConnectUserSignIn;
            _connectionManager.ConnectUserSignOut += ConnectionManagerOnConnectUserSignOut;
            _connectionManager.LocalUserSignIn    += ConnectionManagerOnLocalUserSignIn;
            _connectionManager.LocalUserSignOut   += ConnectionManagerOnLocalUserSignOut;
            _connectionManager.Connected          += ConnectionManagerOnConnected;
            serverInfoService.ServerInfoChanged   += ServerInfoServiceOnServerInfoChanged;

            if (serverInfoService.HasServer)
            {
                SetUserUpdateHandler(serverInfoService.ServerInfo);
            }
        }
        public AuthenticationService(
            IConnectionManager connectionManager,
            IApplicationSettingsService settingsService,
            IServerInfoService serverInfoService,
            IMessengerService messengerService)
        {
            _settingsService = settingsService.Legacy;
            _connectionManager = connectionManager;
            _messengerService = messengerService;
            _logger = new WPLogger(typeof (AuthenticationService));
            Current = this;

            _connectionManager.ConnectUserSignIn += ConnectionManagerOnConnectUserSignIn;
            _connectionManager.ConnectUserSignOut += ConnectionManagerOnConnectUserSignOut;
            _connectionManager.LocalUserSignIn += ConnectionManagerOnLocalUserSignIn;
            _connectionManager.LocalUserSignOut += ConnectionManagerOnLocalUserSignOut;
            _connectionManager.Connected += ConnectionManagerOnConnected;
            serverInfoService.ServerInfoChanged += ServerInfoServiceOnServerInfoChanged;

            if (serverInfoService.HasServer)
            {
                SetUserUpdateHandler(serverInfoService.ServerInfo);
            }
        }
Example #22
0
        public static void SetS <T>(this IApplicationSettingsServiceHandler handler, string key, T value)
        {
            var json = JsonConvert.SerializeObject(value);

            handler.Set(key, json);
        }
 /// <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;
 }
 /// <summary>
 /// Initializes a new instance of the SplashscreenViewModel class.
 /// </summary>
 public SplashscreenViewModel(IConnectionManager connectionManager, INavigationService navigationService, IApplicationSettingsService applicationSettings)
     : base(navigationService, connectionManager)
 {
     _applicationSettings = applicationSettings.Legacy;
 }
Example #25
0
 public SettingsService()
 {
     _roamingSettings = SimpleIoc.Default.GetInstance <IApplicationSettingsServiceHandler>();
     WordsPerMin      = 200;
     WordsAtATime     = 1;
 }
Example #26
0
 public SettingsService()
 {
     _roamingSettings = SimpleIoc.Default.GetInstance<IApplicationSettingsServiceHandler>();
     WordsPerMin = 200;
     WordsAtATime = 1;
 }
Example #27
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;
 }
 /// <summary>
 /// Initializes a new instance of the MbConnectViewModel class.
 /// </summary>
 public MbConnectViewModel(INavigationService navigationService, IConnectionManager connectionManager, IApplicationSettingsService appSettings)
     : base(navigationService, connectionManager)
 {
     _appSettings = appSettings.Legacy;
 }
Example #29
0
 public static T GetS <T>(this IApplicationSettingsServiceHandler handler, string key, T defaultValue)
 {
     return(handler.Contains(key) ? handler.GetS <T>(key) : defaultValue);
 }