|
|
@@ -43,7 +43,6 @@ using PRSDesktop.Forms;
|
|
|
using PRSServer;
|
|
|
using SharpAvi.Codecs;
|
|
|
using SharpAvi.Output;
|
|
|
-using Syncfusion.Windows.Shared;
|
|
|
using Syncfusion.Windows.Tools.Controls;
|
|
|
using Application = System.Windows.Application;
|
|
|
using ButtonBase = System.Windows.Controls.Primitives.ButtonBase;
|
|
|
@@ -103,6 +102,18 @@ public class SimpleCommand : ICommand
|
|
|
|
|
|
}
|
|
|
|
|
|
+public class AppSettings : ILocalConfigurationSettings
|
|
|
+{
|
|
|
+ public AppSettings()
|
|
|
+ {
|
|
|
+ Settings = new Dictionary<string, string>();
|
|
|
+ }
|
|
|
+
|
|
|
+ public Dictionary<string, string> Settings { get; set; }
|
|
|
+
|
|
|
+ public DynamicGridSelectedFilterSettings Filters { get; set; } = new();
|
|
|
+}
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// Interaction logic for Main.xaml
|
|
|
/// </summary>
|
|
|
@@ -166,6 +177,16 @@ public partial class MainWindow : IPanelHostControl
|
|
|
|
|
|
private PanelHost PanelHost;
|
|
|
|
|
|
+ private AppSettings? _settings;
|
|
|
+ private AppSettings Settings
|
|
|
+ {
|
|
|
+ get
|
|
|
+ {
|
|
|
+ _settings ??= LocalConfiguration.Load<AppSettings>();
|
|
|
+ return _settings;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public MainWindow()
|
|
|
{
|
|
|
PanelHost = new PanelHost(this);
|
|
|
@@ -1290,13 +1311,11 @@ public partial class MainWindow : IPanelHostControl
|
|
|
|
|
|
private void LoadInitialWindow()
|
|
|
{
|
|
|
- var app = new LocalConfiguration<AppSettings>().Load();
|
|
|
- var module = app.Settings.ContainsKey("CurrentPanel")
|
|
|
- ? !string.IsNullOrWhiteSpace(app.Settings["CurrentPanel"])
|
|
|
- ? app.Settings["CurrentPanel"].Split([" / "], StringSplitOptions.None)
|
|
|
+ var module = Settings.Settings.TryGetValue("CurrentPanel", out string? currentPanel)
|
|
|
+ ? !currentPanel.IsNullOrWhiteSpace()
|
|
|
+ ? currentPanel.Split([" / "], StringSplitOptions.None)
|
|
|
: [ "Human Resources", "Task List"]
|
|
|
: [ "Human Resources", "Task List"];
|
|
|
-
|
|
|
|
|
|
try
|
|
|
{
|
|
|
@@ -1333,9 +1352,8 @@ public partial class MainWindow : IPanelHostControl
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
- MessageWindow.ShowError($"Unable to load {app.Settings["CurrentPanel"]}", e);
|
|
|
+ MessageWindow.ShowError($"Unable to load {currentPanel}", e);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private void _ribbon_OnLoaded(object sender, RoutedEventArgs e)
|
|
|
@@ -1447,14 +1465,14 @@ public partial class MainWindow : IPanelHostControl
|
|
|
|
|
|
if (sender != null)
|
|
|
{
|
|
|
- var settings = new LocalConfiguration<AppSettings>().Load();
|
|
|
var module = string.Format("{0} / {1}", CurrentTab?.Header, sender.Header);
|
|
|
- if (!settings.Settings.ContainsKey("CurrentPanel") || module != settings.Settings["CurrentPanel"])
|
|
|
+ if (!Settings.Settings.TryGetValue("CurrentPanel", out string? value) || module != value)
|
|
|
{
|
|
|
- settings.Settings["CurrentPanel"] = module;
|
|
|
+ value = module;
|
|
|
+ Settings.Settings["CurrentPanel"] = value;
|
|
|
try
|
|
|
{
|
|
|
- new LocalConfiguration<AppSettings>().Save(settings);
|
|
|
+ LocalConfiguration.Save(Settings);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
@@ -1931,9 +1949,8 @@ public partial class MainWindow : IPanelHostControl
|
|
|
|
|
|
private string CurrentPanelSlug()
|
|
|
{
|
|
|
- var app = new LocalConfiguration<AppSettings>().Load();
|
|
|
- var module = app.Settings["CurrentPanel"].Split(new[] { " / " }, StringSplitOptions.None);
|
|
|
- return module.LastOrDefault()?.Replace(" ", "_").Replace("/", "") ?? "";
|
|
|
+ var module = Settings.Settings.GetValueOrDefault("CurrentPanel")?.Split(new[] { " / " }, StringSplitOptions.None);
|
|
|
+ return module?.LastOrDefault()?.Replace(" ", "_").Replace("/", "") ?? "";
|
|
|
}
|
|
|
|
|
|
private bool ShowHelp()
|
|
|
@@ -1962,7 +1979,7 @@ public partial class MainWindow : IPanelHostControl
|
|
|
|
|
|
if (CurrentTab is not null)
|
|
|
{
|
|
|
- var border = VisualUtils.EnumChildrenOfType(CurrentTab, typeof(Border)).LastOrDefault();
|
|
|
+ var border = Syncfusion.Windows.Shared.VisualUtils.EnumChildrenOfType(CurrentTab, typeof(Border)).LastOrDefault();
|
|
|
if (border != null)
|
|
|
{
|
|
|
((Border)border).Background = new SolidColorBrush(Colors.Transparent);
|
|
|
@@ -2682,6 +2699,7 @@ public partial class MainWindow : IPanelHostControl
|
|
|
if(_trackingKanbanFilterComponent is null)
|
|
|
{
|
|
|
_trackingKanbanFilterComponent = new();
|
|
|
+ _trackingKanbanFilterComponent.SetSettings(Settings.Filters, false);
|
|
|
_trackingKanbanFilterComponent.OnFiltersSelected += _trackingKanbanFilterComponent_OnFiltersSelected;
|
|
|
}
|
|
|
return _trackingKanbanFilterComponent;
|
|
|
@@ -2704,6 +2722,8 @@ public partial class MainWindow : IPanelHostControl
|
|
|
_trackingKanbanFilterMenu.Header = TrackingKanbanFilterComponent.Text;
|
|
|
_trackingKanbanFilterMenu.Icon = new System.Windows.Controls.Image() { Source = TrackingKanbanFilterComponent.Image?.AsBitmapImage(24, 24) };
|
|
|
}
|
|
|
+ Settings.Filters = filters;
|
|
|
+ LocalConfiguration.Save(Settings);
|
|
|
}
|
|
|
|
|
|
private void SelectTask_Click(object sender, RoutedEventArgs e)
|