Exemplo n.º 1
0
        public Language(List <Translation> prioritizedTranslationList, decimal percentTranslated)
        {
            translations      = prioritizedTranslationList;
            mainWindow        = null;
            setupWizardWindow = null;
            setupWizardProxySettingsWindowLocalizator = null;
            searchTab = null;
            nonFictionSearchResultsTab = null;
            fictionSearchResultsTab    = null;
            sciMagSearchResultsTab     = null;
            commonDetailsTab           = null;
            nonFictionDetailsTab       = null;
            fictionDetailsTab          = null;
            sciMagDetailsTab           = null;
            import             = null;
            exportPanel        = null;
            nonFictionExporter = null;
            fictionExporter    = null;
            sciMagExporter     = null;
            synchronization    = null;
            database           = null;
            databaseError      = null;
            sqlDebugger        = null;
            downloadManager    = null;
            applicationUpdate  = null;
            settings           = null;
            about       = null;
            messageBox  = null;
            errorWindow = null;
            Translation mainTranslation = prioritizedTranslationList.First();

            Name          = mainTranslation.General?.Name?.Trim() ?? String.Empty;
            LocalizedName = mainTranslation.General?.LocalizedName?.Trim() ?? String.Empty;
            if (!String.IsNullOrEmpty(Name) && !String.IsNullOrEmpty(LocalizedName))
            {
                DisplayName = $"{Name} ({LocalizedName})";
            }
            else
            {
                DisplayName = "Error";
            }
            CultureCode       = mainTranslation.General?.CultureCode?.Trim() ?? String.Empty;
            TranslatorName    = mainTranslation.General?.TranslatorName ?? "unknown";
            PercentTranslated = percentTranslated;
            Formatter         = new LanguageFormatter(prioritizedTranslationList);
        }
Exemplo n.º 2
0
        private void Synchronize()
        {
            SynchronizationWindowLocalizator synchronizationLocalizator = MainModel.Localization.CurrentLanguage.Synchronization;

            if (MainModel.DatabaseMetadata.NonFictionFirstImportComplete != true)
            {
                ShowMessage(synchronizationLocalizator.ErrorMessageTitle, synchronizationLocalizator.ImportRequired);
                return;
            }
            if (MainModel.AppSettings.Mirrors.NonFictionSynchronizationMirrorName == null)
            {
                ShowMessage(synchronizationLocalizator.ErrorMessageTitle, synchronizationLocalizator.NoSynchronizationMirror);
                return;
            }
            if (MainModel.AppSettings.Network.OfflineMode)
            {
                if (ShowPrompt(synchronizationLocalizator.OfflineModePromptTitle, synchronizationLocalizator.OfflineModePromptText))
                {
                    MainModel.AppSettings.Network.OfflineMode = false;
                    MainModel.SaveSettings();
                }
                else
                {
                    return;
                }
            }
            SynchronizationWindowViewModel synchronizationWindowViewModel = new SynchronizationWindowViewModel(MainModel);
            IWindowContext synchronizationWindowContext = WindowManager.CreateWindow(RegisteredWindows.WindowKey.SYNCHRONIZATION_WINDOW, synchronizationWindowViewModel, CurrentWindowContext);

            synchronizationWindowContext.ShowDialog();
            if (IsDefaultSearchTabVisible)
            {
                DefaultSearchTabViewModel.SetFocus();
            }
            else
            {
                if (SelectedTabViewModel is SearchTabViewModel searchTabViewModel)
                {
                    searchTabViewModel.SetFocus();
                }
            }
        }