Esempio n. 1
0
        private void LanguageSetCallback(bool result)
        {
            --BusyCount;
            if (result)
            {
                this.ServerPath = this.ServerPath.Trim();
                bool     isPathChanged       = IsServerPathChanged();
                bool     isResolutionChanged = IsResolutionChanged();
                Settings settings            = new Settings()
                {
                    IsGpsEnabled       = this.IsGpsEnabled,
                    CheckForNewSurveys = this.IsCheckForNewSurveysOnStart,
                    LanguageID         = this.CurrentLanguage.ID,
                    PhotoResolutionID  = this.SelectedResolution.ID,
                    ServerID           = currentSettings.Server.ID
                };

                if (IsServerPathChanged())
                {
                    Server newServer = serverRepository.TryGetServerByAddress(this.ServerPath);
                    if (newServer == null)
                    {
                        newServer = serverRepository.CreateServerByAddress(this.ServerPath);
                    }

                    settings.ServerID = newServer.ID;
                }

                this.ChangeSettings(settings, isPathChanged, isResolutionChanged);
                (Application.Current.Resources["LanguageStrings"] as LanguageStrings).RaiseAllPropertyChanged();
            }
            else
            {
                MessageBox.Show(UNABLE_DOWNLOAD_LANGUAGE);
            }

            this.SaveSettingsCommand.RaiseCanExecuteChanged();
        }