mirror of
https://github.com/greenshot/greenshot
synced 2025-08-22 22:34:27 -07:00
Fixed language selection.
This commit is contained in:
parent
99da26b41b
commit
669dce1b12
5 changed files with 26 additions and 18 deletions
|
@ -359,6 +359,7 @@ namespace Greenshot.Forms
|
|||
case Keys.E:
|
||||
var info = new StringBuilder(EnvironmentInfo.EnvironmentToString(true));
|
||||
var screenboundsSize = DisplayInfo.ScreenBounds.Size;
|
||||
info.AppendLine();
|
||||
info.AppendFormat("Screen: {0} at {1}%", $"{screenboundsSize.Width} x {screenboundsSize.Height}", FormDpiHandler.ScaleWithCurrentDpi(100));
|
||||
MessageBox.Show(info.ToString(), "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
break;
|
||||
|
|
|
@ -819,12 +819,17 @@ namespace Greenshot.Forms
|
|||
/// </summary>
|
||||
public void ShowSetting()
|
||||
{
|
||||
using(var ownedConfigViewModel = _configViewModelFactory())
|
||||
var lang = _coreConfiguration.Language;
|
||||
using (var ownedConfigViewModel = _configViewModelFactory())
|
||||
{
|
||||
_windowManager.ShowDialog(ownedConfigViewModel.Value);
|
||||
}
|
||||
if (!Equals(lang, _coreConfiguration.Language))
|
||||
{
|
||||
ApplyLanguage();
|
||||
InitializeQuickSettingsMenu();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The "About Greenshot" entry is clicked
|
||||
|
|
|
@ -156,13 +156,6 @@ namespace Greenshot.Helpers
|
|||
{
|
||||
environment.AppendLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
environment.Append(", ");
|
||||
}
|
||||
// TODO: Is this needed?
|
||||
// environment.AppendFormat("Surface count: {0}", Surface.Count);
|
||||
|
||||
return environment.ToString();
|
||||
}
|
||||
|
||||
|
|
|
@ -20,13 +20,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Autofac.Features.OwnedInstances;
|
||||
using Dapplo.CaliburnMicro;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Dapplo.CaliburnMicro.Extensions;
|
||||
using Dapplo.Config.Language;
|
||||
using Greenshot.Addons;
|
||||
using Greenshot.Addons.Core;
|
||||
using Greenshot.Configuration;
|
||||
using Greenshot.Ui.Notifications.ViewModels;
|
||||
using MahApps.Metro.IconPacks;
|
||||
|
@ -60,9 +63,11 @@ namespace Greenshot.Ui.Configuration.ViewModels
|
|||
public IConfigTranslations ConfigTranslations { get; }
|
||||
|
||||
public ConfigViewModel(
|
||||
ICoreConfiguration coreConfiguration,
|
||||
IEnumerable<Lazy<IConfigScreen>> configScreens,
|
||||
IGreenshotLanguage greenshotLanguage,
|
||||
IConfigTranslations configTranslations,
|
||||
LanguageContainer languageContainer,
|
||||
Func<Owned<UpdateNotificationViewModel>> updateNotificationViewModelFactory
|
||||
)
|
||||
{
|
||||
|
@ -73,9 +78,8 @@ namespace Greenshot.Ui.Configuration.ViewModels
|
|||
// automatically update the DisplayName
|
||||
GreenshotLanguage.CreateDisplayNameBinding(this, nameof(IGreenshotLanguage.SettingsTitle));
|
||||
|
||||
// TODO: Check if we need to set the current language (this should update all registered OnPropertyChanged anyway, so it can run in the background
|
||||
//var lang = demoConfiguration.Language;
|
||||
//Task.Run(async () => await LanguageLoader.Current.ChangeLanguageAsync(lang).ConfigureAwait(false));
|
||||
var lang = coreConfiguration.Language;
|
||||
Task.Run(async () => await languageContainer.ChangeLanguageAsync(lang).ConfigureAwait(false));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -21,10 +21,12 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Reactive.Disposables;
|
||||
using Caliburn.Micro;
|
||||
using Dapplo.CaliburnMicro.Configuration;
|
||||
using Dapplo.CaliburnMicro.Extensions;
|
||||
using Dapplo.CaliburnMicro.Metro;
|
||||
using Dapplo.Config.Intercepting;
|
||||
using Dapplo.Config.Language;
|
||||
using Dapplo.Utils.Extensions;
|
||||
using Greenshot.Addons;
|
||||
using Greenshot.Addons.Core;
|
||||
|
@ -36,6 +38,7 @@ namespace Greenshot.Ui.Configuration.ViewModels
|
|||
public sealed class UiConfigViewModel : SimpleConfigScreen
|
||||
{
|
||||
private readonly MetroThemeManager _metroThemeManager;
|
||||
private readonly LanguageContainer _languageContainer;
|
||||
|
||||
/// <summary>
|
||||
/// Here all disposables are registered, so we can clean the up
|
||||
|
@ -57,17 +60,16 @@ namespace Greenshot.Ui.Configuration.ViewModels
|
|||
/// </summary>
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
// TODO: Fix
|
||||
public IDictionary<string, string> AvailableLanguages => new Dictionary<string, string>();//LanguageLoader.Current.AvailableLanguages;
|
||||
public IDictionary<string, string> AvailableLanguages { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Can the login button be pressed?
|
||||
/// </summary>
|
||||
// TODO: Fix
|
||||
public bool CanChangeLanguage
|
||||
=> !string.IsNullOrWhiteSpace(CoreConfiguration.Language); // && CoreConfiguration.Language != LanguageLoader.Current.CurrentLanguage;
|
||||
=> !string.IsNullOrWhiteSpace(CoreConfiguration.Language) && CoreConfiguration.Language != _languageContainer.CurrentLanguage;
|
||||
|
||||
public IMetroConfiguration MetroConfiguration { get; }
|
||||
|
||||
public IConfigTranslations ConfigTranslations { get; }
|
||||
|
||||
public ICoreConfiguration CoreConfiguration { get; }
|
||||
|
@ -87,10 +89,13 @@ namespace Greenshot.Ui.Configuration.ViewModels
|
|||
IGreenshotLanguage greenshotLanguage,
|
||||
IConfigTranslations configTranslations,
|
||||
IMetroConfiguration metroConfiguration,
|
||||
MetroThemeManager metroThemeManager
|
||||
MetroThemeManager metroThemeManager,
|
||||
LanguageContainer languageContainer
|
||||
)
|
||||
{
|
||||
AvailableLanguages = languageContainer.AvailableLanguages;
|
||||
_metroThemeManager = metroThemeManager;
|
||||
_languageContainer = languageContainer;
|
||||
CoreConfiguration = coreConfiguration;
|
||||
GreenshotLanguage = greenshotLanguage;
|
||||
ConfigTranslations = configTranslations;
|
||||
|
@ -105,8 +110,8 @@ namespace Greenshot.Ui.Configuration.ViewModels
|
|||
MetroConfiguration.CommitTransaction();
|
||||
|
||||
CoreConfiguration.CommitTransaction();
|
||||
// TODO: Fix
|
||||
//Execute.OnUIThread(async () => { await LanguageLoader.Current.ChangeLanguageAsync(CoreConfiguration.Language).ConfigureAwait(false); });
|
||||
Execute.OnUIThread(async () => {
|
||||
await _languageContainer.ChangeLanguageAsync(CoreConfiguration.Language).ConfigureAwait(false); });
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue