Hi I'm trying to create a GUI with WPF but I can't get it to work.
I tried it like this but it crashed the complete updater
Maybe someone can give me a hint
#edit: Sry I got it, please close thread
#edit2: here if you're interested in how it should look if it works:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using ArcheBuddy.Bot.Classes;
namespace AutoLoot
{
/// <summary>
/// Interaktionslogik für AutoLootWindow.xaml
/// </summary>
public partial class AutoLootWindow : Window
{
public AutoLootWindow()
{
InitializeComponent();
}
}
class Class1 : Core
{
public static string GetPluginAuthor()
{
return "Plugin Author";
}
public static string GetPluginVersion()
{
return "1.0.0.0";
}
public static string GetPluginDescription()
{
return "My plugin description";
}
public void test()
{
AutoLootWindow Window = new AutoLootWindow();
}
//Call on plugin start
public void PluginRun()
{
Thread t = new Thread(test);
t.TrySetApartmentState(ApartmentState.MTA);
t.Start();
while(true)
Thread.Sleep(50);
}
//Call on plugin stop
public void PluginStop()
{
}
}
}
I tried it like this but it crashed the complete updater
Maybe someone can give me a hint
#edit: Sry I got it, please close thread
#edit2: here if you're interested in how it should look if it works:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using ArcheBuddy.Bot.Classes;
namespace AutoLoot
{
/// <summary>
/// Interaktionslogik für AutoLootWindow.xaml
/// </summary>
public partial class AutoLootWindow : Window
{
public AutoLootWindow()
{
InitializeComponent();
}
}
class AutoLoot : Core
{
public static string GetPluginAuthor()
{
return "zdennis";
}
public static string GetPluginVersion()
{
return "1.0.0.0";
}
public static string GetPluginDescription()
{
return "My plugin description";
}
// Create a thread
Thread GuiThread = new Thread(new ThreadStart(() =>
{
// Create and show the Window
AutoLootWindow GUI = new AutoLootWindow();
GUI.Show();
// Start the Dispatcher Processing
System.Windows.Threading.Dispatcher.Run();
}));
//Call on plugin start
public void PluginRun()
{
// Set the apartment state
GuiThread.SetApartmentState(ApartmentState.STA);
// Make the thread a background thread
GuiThread.IsBackground = true;
// Start the thread
GuiThread.Start();
while (true)
Thread.Sleep(50);
}
//Call on plugin stop
public void PluginStop()
{
// Abort to close the window;
GuiThread.Abort();
}
}
}
Last edited:






