Sinbeard
New Member
- Joined
- Oct 14, 2019
- Messages
- 14
I'm mostly a linux dev in experience, and as a result have extremely little experience developing with any kind of GUI. As a result I've been having some pretty annoying trouble getting a settings window to work for a botbase I'm trying code.
I'm trying to use a WPF with a SettingsWindow.xaml and respective code behind file. I basically copied the files over from a blank WPF VS project and summoned them forth with my OnButtonPress() override. The code I'm using basically is the same from DeepDive botbase:
code behind code:
xaml
Here are the errors I'm getting in the RB log:
The annoying thing is that if I use MahApps Metro and compile the botbase into a .dll and use the loader file that's been floating around for ages the settings window launches fine in RB. However, I don't want to have to compile this code to a dll to use it. Also, the project builds just fine when I build it in VS.
I'm clearly doing something wrong, but I don't have the experience to easily guess at it. Does RB not have the System.Windows reference ...?
I'm trying to use a WPF with a SettingsWindow.xaml and respective code behind file. I basically copied the files over from a blank WPF VS project and summoned them forth with my OnButtonPress() override. The code I'm using basically is the same from DeepDive botbase:
Code:
private SettingsWindow _settings;
...
public override void OnButtonPress()
{
if (_settings == null)
{
_settings = new SettingsWindow {
Title = "Garlean Resource Assimilator v" + _v
};
_settings.Closed += (o, e) => { _settings = null; };
}
try
{
_settings.Show();
}
catch (Exception)
{
// ignored
}
}
code behind code:
Code:
namespace Assimilator.GUI
{
public partial class SettingsWindow : Window
{
public SettingsWindow()
{
InitializeComponent();
}
}
}
xaml
Code:
<Window
x:Class="Assimilator.GUI.SettingsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Garlean Resource Assimilator"
Height="Auto"
Width="Auto"
WindowStartupLocation="CenterScreen">
...
</Window>
Here are the errors I'm getting in the RB log:
Code:
[04:45:16.511 N] Compiler Error: C:\Users\<user>\Downloads\rb\BotBases\Assimilator\Assimilator.cs(43,21) : error CS0117: 'SettingsWindow' does not contain a definition for 'Title'
[04:45:16.511 N] Compiler Error: C:\Users\<user>\Downloads\rb\BotBases\Assimilator\Assimilator.cs(45,27) : error CS1061: 'SettingsWindow' does not contain a definition for 'Closed' and no extension method 'Closed' accepting a first argument of type 'SettingsWindow' could be found (are you missing a using directive or an assembly reference?)
[04:45:16.511 N] Compiler Error: C:\Users\<user>\Downloads\rb\BotBases\Assimilator\Assimilator.cs(50,27) : error CS1061: 'SettingsWindow' does not contain a definition for 'Show' and no extension method 'Show' accepting a first argument of type 'SettingsWindow' could be found (are you missing a using directive or an assembly reference?)
The annoying thing is that if I use MahApps Metro and compile the botbase into a .dll and use the loader file that's been floating around for ages the settings window launches fine in RB. However, I don't want to have to compile this code to a dll to use it. Also, the project builds just fine when I build it in VS.
I'm clearly doing something wrong, but I don't have the experience to easily guess at it. Does RB not have the System.Windows reference ...?