diff --git a/src/Shared/Corathing.Contracts/DataContexts/WidgetContext.cs b/src/Shared/Corathing.Contracts/DataContexts/WidgetContext.cs
index 9520314..8a76d56 100644
--- a/src/Shared/Corathing.Contracts/DataContexts/WidgetContext.cs
+++ b/src/Shared/Corathing.Contracts/DataContexts/WidgetContext.cs
@@ -56,4 +56,8 @@ public WidgetContext(IServiceProvider services) : this()
{
_services = services;
}
+
+ public virtual void OnDestroy()
+ {
+ }
}
diff --git a/src/Shared/Corathing.Contracts/Services/ILocalizationService.cs b/src/Shared/Corathing.Contracts/Services/ILocalizationService.cs
index ad3fae4..cfd0149 100644
--- a/src/Shared/Corathing.Contracts/Services/ILocalizationService.cs
+++ b/src/Shared/Corathing.Contracts/Services/ILocalizationService.cs
@@ -28,6 +28,6 @@ public interface ILocalizationService
/// On LocalizationChanged
///
///
- void Provide(string key, Action action);
+ void Provide(string key, Action action, string fallbackValue = "");
#endregion
}
diff --git a/src/Shared/Corathing.Dashboards.WPF/Services/LocalizationService.cs b/src/Shared/Corathing.Dashboards.WPF/Services/LocalizationService.cs
index aef3912..f5287f6 100644
--- a/src/Shared/Corathing.Dashboards.WPF/Services/LocalizationService.cs
+++ b/src/Shared/Corathing.Dashboards.WPF/Services/LocalizationService.cs
@@ -85,6 +85,25 @@ public string GetString(string key)
return "";
}
+ private bool TryGetString(string key, out string value)
+ {
+ value = "";
+ foreach (var resManager in _stringResourceManagers.Values)
+ {
+ if (CachedApplicationCultureInfo == null)
+ {
+ ApplySystemLanguage();
+ }
+ string? resultString = resManager.GetString(key, CachedApplicationCultureInfo);
+ if (!string.IsNullOrEmpty(resultString))
+ {
+ value = resultString;
+ return true;
+ }
+ }
+ return false;
+ }
+
public event PropertyChangedEventHandler? PropertyChanged;
private void RaisePropertyChanged(object sender, PropertyChangedEventArgs e)
@@ -194,9 +213,17 @@ public void RegisterStringResourceManager(string namespaceName, ResourceManager
///
///
///
- public void Provide(string key, Action action)
+ public void Provide(string key, Action action, string fallbackValue = "")
{
- action?.Invoke(GetString(key));
- _refreshProvideActions.Add(() => action?.Invoke(GetString(key)));
+ if (string.IsNullOrEmpty(key))
+ {
+ action?.Invoke(fallbackValue);
+ _refreshProvideActions.Add(() => action?.Invoke(fallbackValue));
+ }
+ else
+ {
+ action?.Invoke(TryGetString(key, out string value) ? value : fallbackValue);
+ _refreshProvideActions.Add(() => action?.Invoke(TryGetString(key, out string value) ? value : fallbackValue));
+ }
}
}
diff --git a/src/Shared/Corathing.UI.WPF/Controls/CircularProgressBars/AngleRadiusToPointConverter.cs b/src/Shared/Corathing.UI.WPF/Controls/CircularProgressBars/AngleRadiusToPointConverter.cs
index 22be724..48b61eb 100644
--- a/src/Shared/Corathing.UI.WPF/Controls/CircularProgressBars/AngleRadiusToPointConverter.cs
+++ b/src/Shared/Corathing.UI.WPF/Controls/CircularProgressBars/AngleRadiusToPointConverter.cs
@@ -9,23 +9,23 @@
namespace Corathing.UI.WPF.Controls.CircularProgressBars;
-[ValueConversion(typeof(double[]), typeof(Point))]
public class AngleRadiusToPointConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
- if (values.Length != 2)
+ if (values.Length != 3)
return new();
if (values[0] is double angle &&
- values[1] is double radius)
+ values[1] is double radius &&
+ values[2] is Thickness offset)
{
double piang = angle * Math.PI / 180;
double px = Math.Sin(piang) * radius + radius;
double py = -Math.Cos(piang) * radius + radius;
- return new Point(px, py);
+ return new Point(px + offset.Left, py + offset.Top);
}
return new();
diff --git a/src/Shared/Corathing.UI.WPF/Controls/CircularProgressBars/AutoCircularProgressBar.xaml b/src/Shared/Corathing.UI.WPF/Controls/CircularProgressBars/AutoCircularProgressBar.xaml
index c9515e4..29bea77 100644
--- a/src/Shared/Corathing.UI.WPF/Controls/CircularProgressBars/AutoCircularProgressBar.xaml
+++ b/src/Shared/Corathing.UI.WPF/Controls/CircularProgressBars/AutoCircularProgressBar.xaml
@@ -3,11 +3,9 @@
xmlns:circulars="clr-namespace:Corathing.UI.WPF.Controls.CircularProgressBars"
xmlns:converters="clr-namespace:Corathing.UI.WPF.Converters">
-
-