mirror of
https://github.com/9ParsonsB/Pulsar.git
synced 2025-04-05 17:39:39 -04:00
don't save empty fileinfo settings
This commit is contained in:
parent
5e8891c75f
commit
08a8aa3156
@ -854,7 +854,7 @@ namespace Observatory.UI.Views
|
|||||||
settingsGrid.AddControl(label, settingsGrid.RowDefinitions.Count - 1, 0);
|
settingsGrid.AddControl(label, settingsGrid.RowDefinitions.Count - 1, 0);
|
||||||
settingsGrid.AddControl(intControl, settingsGrid.RowDefinitions.Count - 1, 1);
|
settingsGrid.AddControl(intControl, settingsGrid.RowDefinitions.Count - 1, 1);
|
||||||
break;
|
break;
|
||||||
case System.IO.FileInfo fileSetting:
|
case FileInfo fileSetting:
|
||||||
label.Text += ": ";
|
label.Text += ": ";
|
||||||
|
|
||||||
TextBox settingPath = new()
|
TextBox settingPath = new()
|
||||||
@ -887,7 +887,7 @@ namespace Observatory.UI.Views
|
|||||||
{
|
{
|
||||||
string path = browseTask.Result[0];
|
string path = browseTask.Result[0];
|
||||||
Avalonia.Threading.Dispatcher.UIThread.InvokeAsync(() => { settingPath.Text = path; });
|
Avalonia.Threading.Dispatcher.UIThread.InvokeAsync(() => { settingPath.Text = path; });
|
||||||
setting.Key.SetValue(plugin.Settings, new System.IO.FileInfo(path));
|
setting.Key.SetValue(plugin.Settings, new FileInfo(path));
|
||||||
PluginManagement.PluginManager.GetInstance.SaveSettings(plugin, plugin.Settings);
|
PluginManagement.PluginManager.GetInstance.SaveSettings(plugin, plugin.Settings);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -897,19 +897,22 @@ namespace Observatory.UI.Views
|
|||||||
|
|
||||||
settingPath.LostFocus += (object sender, RoutedEventArgs e) =>
|
settingPath.LostFocus += (object sender, RoutedEventArgs e) =>
|
||||||
{
|
{
|
||||||
string fullPath;
|
if (settingPath.Text.Trim() != string.Empty)
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
fullPath = System.IO.Path.GetFullPath(settingPath.Text);
|
string fullPath;
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
fullPath = string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
setting.Key.SetValue(plugin.Settings, new System.IO.FileInfo(fullPath));
|
try
|
||||||
PluginManagement.PluginManager.GetInstance.SaveSettings(plugin, plugin.Settings);
|
{
|
||||||
|
fullPath = Path.GetFullPath(settingPath.Text);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
fullPath = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
setting.Key.SetValue(plugin.Settings, new FileInfo(fullPath));
|
||||||
|
PluginManagement.PluginManager.GetInstance.SaveSettings(plugin, plugin.Settings);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
StackPanel stackPanel = new() { Orientation = Avalonia.Layout.Orientation.Horizontal };
|
StackPanel stackPanel = new() { Orientation = Avalonia.Layout.Orientation.Horizontal };
|
||||||
|
Loading…
x
Reference in New Issue
Block a user