diff --git a/launcher-client-win/GUI/App.xaml b/launcher-client-win/GUI/App.xaml
index fc3e275..c814329 100644
--- a/launcher-client-win/GUI/App.xaml
+++ b/launcher-client-win/GUI/App.xaml
@@ -5,12 +5,11 @@
-
+
-
-
+
-
+
@@ -105,6 +104,15 @@
+
-
+
+
+
+
+
-
-
+
-
+
+
@@ -186,7 +204,7 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M 0 0 L 4 4 L 8 0 Z"
- Fill="{DynamicResource MyOrange}" />
+ Fill="{DynamicResource MySelectionColor}" />
diff --git a/launcher-client-win/GUI/App.xaml.cs b/launcher-client-win/GUI/App.xaml.cs
index fb2dabb..e2a738c 100644
--- a/launcher-client-win/GUI/App.xaml.cs
+++ b/launcher-client-win/GUI/App.xaml.cs
@@ -1,5 +1,4 @@
-using System.Windows.Input;
-using System.Windows.Media;
+using System.Windows.Media;
namespace launcher_client_win.GUI;
@@ -17,7 +16,7 @@ public partial class App : Application
MySoftDark = (SolidColorBrush)Resources["MyGray"];
MyWhite = (SolidColorBrush)Resources["MyWhite"];
MyGreen = (SolidColorBrush)Resources["MyGreen"];
- MyOrange = (SolidColorBrush)Resources["MyOrange"];
+ MyOrange = (SolidColorBrush)Resources["MySelectionColor"];
MySelectionColor = (SolidColorBrush)Resources["MySelectionColor"];
_Main(e.Args);
}
diff --git a/launcher-client-win/GUI/LauncherWindow.xaml b/launcher-client-win/GUI/LauncherWindow.xaml
index 54254ab..cf9172b 100644
--- a/launcher-client-win/GUI/LauncherWindow.xaml
+++ b/launcher-client-win/GUI/LauncherWindow.xaml
@@ -44,7 +44,6 @@
Grid.Column="0"
Content="Library"
FontSize="18"
- Foreground="{DynamicResource MyGreen}"
Style="{DynamicResource MyButtonStyle}" />
-
+
@@ -197,13 +182,12 @@
Content="0"
Style="{DynamicResource MyLabelStyle}" />
-
-
-
+ Template="{DynamicResource myScrollViewer}" />
@@ -230,14 +214,7 @@
diff --git a/launcher-client-win/GUI/LauncherWindow.xaml.cs b/launcher-client-win/GUI/LauncherWindow.xaml.cs
index efec0d0..18e7b94 100644
--- a/launcher-client-win/GUI/LauncherWindow.xaml.cs
+++ b/launcher-client-win/GUI/LauncherWindow.xaml.cs
@@ -1,5 +1,4 @@
-using System.Windows.Controls;
-using System.Windows.Media.Imaging;
+using System.Windows.Media.Imaging;
namespace launcher_client_win.GUI;
@@ -42,41 +41,14 @@ public partial class LauncherWindow : Window
{
if(CurrentTab!=null)
{
- CurrentTab.Foreground = App.MyWhite;
+ CurrentTab.Background = App.MyDark;
CurrentTab.TabGrid.Visibility = Visibility.Collapsed;
}
var selected = (TabButton)sender;
- selected.Foreground = App.MyGreen;
+ selected.Background = App.MySelectionColor;
selected.TabGrid.Visibility = Visibility.Visible;
CurrentTab = selected;
}
- void LibraryTab_activate(object sender, RoutedEventArgs eventArgs)
- {
- LibraryButton.Foreground = App.MyGreen;
- LogButton.Foreground = App.MyWhite;
- SettingsButton.Foreground = App.MyWhite;
- LibraryGrid.Visibility = Visibility.Visible;
- LogGrid.Visibility = Visibility.Hidden;
- SettingsGrid.Visibility = Visibility.Hidden;
- }
- void LogTab_activate(object sender, RoutedEventArgs eventArgs)
- {
- LibraryButton.Foreground = App.MyWhite;
- LogButton.Foreground = App.MyGreen;
- SettingsButton.Foreground = App.MyWhite;
- LibraryGrid.Visibility = Visibility.Hidden;
- LogGrid.Visibility = Visibility.Visible;
- SettingsGrid.Visibility = Visibility.Hidden;
- }
- void SettingsTab_activate(object sender, RoutedEventArgs eventArgs)
- {
- LibraryButton.Foreground = App.MyWhite;
- LogButton.Foreground = App.MyWhite;
- SettingsButton.Foreground = App.MyGreen;
- LibraryGrid.Visibility = Visibility.Hidden;
- LogGrid.Visibility = Visibility.Hidden;
- SettingsGrid.Visibility = Visibility.Visible;
- }
public Program[] Programs;
@@ -99,7 +71,7 @@ public partial class LauncherWindow : Window
}
public Program DisplayingProgram;
- public void SelectProgram(Program selectedP)
+ public void SelectProgram(Program selectedProg)
{
try
{
@@ -110,16 +82,17 @@ public partial class LauncherWindow : Window
}
else ProgramGrid.Visibility = Visibility.Visible;
- selectedP.ProgramLabel.Foreground = App.MyGreen;
- selectedP.ProgramLabel.FontWeight = FontWeights.Bold;
+ selectedProg.ProgramLabel.Foreground = App.MySelectionColor;
+ selectedProg.ProgramLabel.FontWeight = FontWeights.Bold;
- NameLabel.Content = selectedP.Name;
- DescriptionBox.Text = selectedP.Description;
+ NameLabel.Content = selectedProg.Name;
+ DescriptionBox.Text = selectedProg.Description;
BackgroundImage.Source =
new BitmapImage(new Uri(
- $"{Directory.GetCurrent()}{Path.Sep}backgrounds{Path.Sep}{selectedP.BackgroundFile}",
+ $"{Directory.GetCurrent()}{Path.Sep}backgrounds{Path.Sep}{selectedProg.BackgroundFile}",
UriKind.Absolute));
- DisplayingProgram = selectedP;
+ ProgramSettingsViever.Content = selectedProg.SettingsPanel;
+ DisplayingProgram = selectedProg;
}
catch(Exception ex)
{ LogError("SelectProgram()",ex); }
diff --git a/launcher-client-win/GUI/ProgramLabel.xaml.cs b/launcher-client-win/GUI/ProgramLabel.xaml.cs
index 81920b2..5835eab 100644
--- a/launcher-client-win/GUI/ProgramLabel.xaml.cs
+++ b/launcher-client-win/GUI/ProgramLabel.xaml.cs
@@ -1,5 +1,4 @@
using System.Windows.Controls;
-using System.Windows.Media;
using System.Windows.Media.Imaging;
namespace launcher_client_win.GUI;
diff --git a/launcher-client-win/GUI/ProgramSettingsPanelItem.xaml b/launcher-client-win/GUI/ProgramSettingsPanelItem.xaml
new file mode 100644
index 0000000..456057d
--- /dev/null
+++ b/launcher-client-win/GUI/ProgramSettingsPanelItem.xaml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/launcher-client-win/GUI/ProgramSettingsPanelItem.xaml.cs b/launcher-client-win/GUI/ProgramSettingsPanelItem.xaml.cs
new file mode 100644
index 0000000..02f2a02
--- /dev/null
+++ b/launcher-client-win/GUI/ProgramSettingsPanelItem.xaml.cs
@@ -0,0 +1,36 @@
+using System.Windows.Controls;
+
+namespace launcher_client_win.GUI;
+
+public partial class ProgramSettingsPanelItem : UserControl
+{
+ public static readonly DependencyProperty SettingKeyProp = DependencyProperty.Register(
+ "SettingKey",
+ typeof(string),
+ typeof(TabButton));
+ public string SettingKey
+ {
+ get => (string)GetValue(SettingKeyProp);
+ set => SetValue(SettingKeyProp, value);
+ }
+
+ public static readonly DependencyProperty SettingValueProp = DependencyProperty.Register(
+ "SettingValue",
+ typeof(string),
+ typeof(TabButton));
+ public string SettingValue
+ {
+ get => (string)GetValue(SettingValueProp);
+ set => SetValue(SettingValueProp, value);
+ }
+
+ public ProgramSettingsPanelItem(string key, string value)
+ {
+ InitializeComponent();
+ SettingKey = key;
+ SettingValue = value;
+ ValueBox.TextChanged += (_,_)=> UpdatedEvent?.Invoke(this);
+ }
+
+ public event Action UpdatedEvent;
+}
\ No newline at end of file
diff --git a/launcher-client-win/Launcher.cs b/launcher-client-win/Launcher.cs
index f1b528a..73d958c 100644
--- a/launcher-client-win/Launcher.cs
+++ b/launcher-client-win/Launcher.cs
@@ -32,6 +32,7 @@ public static class Launcher
Directory.Create("icons");
Directory.Create("backgrounds");
Directory.Create("installed");
+ Directory.Create("settings");
File.WriteAllText($"descriptors{Path.Sep}default.descriptor.template",
ReadResource("launcher_client_win.Resources.default.descriptor.template"));
CurrentLauncherWindow = new();
diff --git a/launcher-client-win/LauncherConfig.cs b/launcher-client-win/LauncherConfig.cs
index aa0adb1..d2e28ab 100644
--- a/launcher-client-win/LauncherConfig.cs
+++ b/launcher-client-win/LauncherConfig.cs
@@ -20,30 +20,18 @@ public class LauncherConfig
public LauncherConfig()
{
// читает дефолтный конфиг из ресурсов
- DtsodV23 updatedDtsod = new(ReadResource("launcher_client_win.Resources.launcher.dtsod"));
+ DtsodV23 updatedConfig;
+ DtsodV23 updatedDefault = new(ReadResource("launcher_client_win.Resources.launcher.dtsod"));
// проверка и обновление конфига
if (File.Exists(configFile))
{
- DtsodV23 dtsod = new(File.ReadAllText(configFile));
- // заменяет дефолтные значения на пользовательские
- foreach (var p in dtsod)
- {
- if (updatedDtsod.TryGetValue(p.Key, out dynamic def))
- {
- if (def.GetType() != p.Value.GetType())
- throw new Exception(
- "uncompatible config value type\n " +
- $"launcher.dtsod: {p.Key}:{p.Value} is {p.Value.GetType().Name}, " +
- $"must be {def.GetType().Name}");
- updatedDtsod[p.Key] = p.Value;
- }
- }
- // записывает обновлённый конфиг в файл
- WriteToFile();
+ DtsodV23 oldConfig = new(File.ReadAllText(configFile));
+ updatedConfig = DtsodFunctions.UpdateByDefault(oldConfig, updatedDefault);
}
+ else updatedConfig = updatedDefault;
// парсит парсит полученный дтсод в LauncherConfig
- List