add super intelligent save button cuz torch is trash
This commit is contained in:
18
TorchRemote.Plugin/ConfigControl.xaml
Normal file
18
TorchRemote.Plugin/ConfigControl.xaml
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<UserControl x:Class="TorchRemote.Plugin.ConfigControl"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:TorchRemote.Plugin"
|
||||||
|
xmlns:views="clr-namespace:Torch.Views;assembly=Torch"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="300" d:DesignWidth="300">
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<views:PropertyGrid Margin="3" />
|
||||||
|
<Button Grid.Row="1" Margin="5" Content="Save" Click="ButtonBase_OnClick" />
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
21
TorchRemote.Plugin/ConfigControl.xaml.cs
Normal file
21
TorchRemote.Plugin/ConfigControl.xaml.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using Torch;
|
||||||
|
|
||||||
|
namespace TorchRemote.Plugin;
|
||||||
|
|
||||||
|
public partial class ConfigControl : UserControl
|
||||||
|
{
|
||||||
|
private readonly Persistent<Config> _persistent;
|
||||||
|
|
||||||
|
public ConfigControl(Persistent<Config> persistent)
|
||||||
|
{
|
||||||
|
_persistent = persistent;
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
_persistent.Save();
|
||||||
|
}
|
||||||
|
}
|
@@ -25,9 +25,8 @@ public class Plugin : TorchPluginBase, IWpfPlugin
|
|||||||
.AddFactory(s => new ChatMonitorManager(s.Torch));
|
.AddFactory(s => new ChatMonitorManager(s.Torch));
|
||||||
}
|
}
|
||||||
|
|
||||||
public UserControl GetControl() => new PropertyGrid
|
public UserControl GetControl() => new ConfigControl(_config)
|
||||||
{
|
{
|
||||||
Margin = new(3),
|
|
||||||
DataContext = _config.Data
|
DataContext = _config.Data
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@@ -2,5 +2,5 @@
|
|||||||
<PluginManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
<PluginManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
<Name>Torch Remote</Name>
|
<Name>Torch Remote</Name>
|
||||||
<Guid>284017F3-9682-4841-A544-EB04DB8CB9BA</Guid>
|
<Guid>284017F3-9682-4841-A544-EB04DB8CB9BA</Guid>
|
||||||
<Version>v1.0.5</Version>
|
<Version>v1.0.6</Version>
|
||||||
</PluginManifest>
|
</PluginManifest>
|
Reference in New Issue
Block a user