Exemplo n.º 1
0
        private async Task LoadSettings()
        {
            RetryButtonIsVisible           = false;
            App.Settings.ConnectionDetails = new ConnectionDetails
            {
                PortNo = 8096
            };

            var doNotShowFirstRun = _applicationSettings.Get(Constants.Settings.DoNotShowFirstRun, false);

            if (!doNotShowFirstRun)
            {
                NavigationService.NavigateTo(Constants.Pages.FirstRun.WelcomeView);
                return;
            }

            SetProgressBar(AppResources.SysTrayLoadingSettings);

#if !DEBUG
            //try
            //{
            //    if (!ApplicationManifest.Current.App.Title.ToLower().Contains("beta"))
            //    {
            //        var marketPlace = new MarketplaceInformationService();
            //        var appInfo = await marketPlace.GetAppInformationAsync(ApplicationManifest.Current.App.ProductId);

            //        if (new Version(appInfo.Entry.Version) > new Version(ApplicationManifest.Current.App.Version) &&
            //            MessageBox.Show("There is a newer version, would you like to install it now?", "Update Available", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            //        {
            //            new MarketplaceDetailService().Show();
            //        }
            //    }
            //}
            //catch (Exception ex)
            //{
            //    Log.ErrorException("GetAppInformationAsync()", ex);
            //}
#endif
            // Get and set the app specific settings
            _specificSettings = _applicationSettings.Get <SpecificSettings>(Constants.Settings.SpecificSettings);
            if (_specificSettings != null)
            {
                SharedUtils.CopyItem(_specificSettings, App.SpecificSettings);
            }

            SetRunUnderLock();

            _uploadSettings = _applicationSettings.Get <UploadSettings>(Constants.Settings.PhotoUploadSettings);
            if (_uploadSettings != null)
            {
                SharedUtils.CopyItem(_uploadSettings, App.UploadSettings);
            }

            _connectionDetails = _applicationSettings.Get <ConnectionDetails>(Constants.Settings.ConnectionSettings);
            _savedServer       = _applicationSettings.Get <ServerInfo>(Constants.Settings.DefaultServerConnection);

            if (_savedServer != null)
            {
                _serverInfo.SetServerInfo(_savedServer);
            }
            else
            {
                NavigationService.NavigateTo(Constants.Pages.FirstRun.WelcomeView);
                return;
            }

            await ConnectToServer();
        }