This commit is contained in:
2025-08-28 12:05:05 +02:00
parent 31e285348e
commit d75b8fd834
70 changed files with 1163 additions and 910 deletions

View File

@@ -6,7 +6,7 @@ namespace ShadowStream;
public partial class LogIn : Window
{
DataBase dataBase = new DataBase();
//DataBase dataBase = new DataBase();
public LogIn()
{
InitializeComponent();

View File

@@ -2015,67 +2015,67 @@ public void SetInitialFocusForCurrentView()
}
#endregion
#region settings menue
private void Vm_StateChanged(object sender, EventArgs e)
{
// Update owner variables whenever selection changes
option = vm.Option;
specificOption = vm.SpecificOption;
rootPath = vm.RootPath;
}
private void AddRadioButtons()
{
foreach (string optionName in vm.Dirs)
#region settings menue
private void Vm_StateChanged(object sender, EventArgs e)
{
RadioButton rb = new RadioButton
// Update owner variables whenever selection changes
option = vm.Option;
specificOption = vm.SpecificOption;
rootPath = vm.RootPath;
}
private void AddRadioButtons()
{
foreach (string optionName in vm.Dirs)
{
Content = optionName,
GroupName = "DirsGroup",
Margin = new Thickness(5),
Foreground = Brushes.White
RadioButton rb = new RadioButton
{
Content = optionName,
GroupName = "DirsGroup",
Margin = new Thickness(5),
Foreground = Brushes.White
};
rb.Checked += (s, e) => { vm.SelectedOption = optionName; };
dirsStack.Children.Add(rb);
}
}
private void StaticRadioButton_Checked(object sender, RoutedEventArgs e)
{
if (sender is RadioButton rb)
{
vm.SelectedOption = rb.Content.ToString();
}
}
private void SelectPathButton_Click(object sender, RoutedEventArgs e)
{
// WPF native OpenFileDialog trick to select folder
var dialog = new Microsoft.Win32.OpenFileDialog
{
CheckFileExists = false, // allow selecting folder
CheckPathExists = true,
FileName = "Select folder",
ValidateNames = false
};
rb.Checked += (s, e) => { vm.SelectedOption = optionName; };
if (dialog.ShowDialog() == true)
{
string folderPath = System.IO.Path.GetDirectoryName(dialog.FileName);
dirsStack.Children.Add(rb);
// Update ViewModel, which triggers StateChanged to update owner variables
vm.RootPath = folderPath;
// Also update TextBox explicitly if needed
DirectPathTextBox.Text = folderPath;
}
}
}
private void StaticRadioButton_Checked(object sender, RoutedEventArgs e)
{
if (sender is RadioButton rb)
{
vm.SelectedOption = rb.Content.ToString();
}
}
private void SelectPathButton_Click(object sender, RoutedEventArgs e)
{
// WPF native OpenFileDialog trick to select folder
var dialog = new Microsoft.Win32.OpenFileDialog
{
CheckFileExists = false, // allow selecting folder
CheckPathExists = true,
FileName = "Select folder",
ValidateNames = false
};
if (dialog.ShowDialog() == true)
{
string folderPath = System.IO.Path.GetDirectoryName(dialog.FileName);
// Update ViewModel, which triggers StateChanged to update owner variables
vm.RootPath = folderPath;
// Also update TextBox explicitly if needed
DirectPathTextBox.Text = folderPath;
}
}
#endregion
#endregion