Hi I try to save my config as an xml.
My problem is that it freezes the updater.
Sry I worked on it for 5 hours. It's late and its difficult to think at the moment.
So I'm glad if you could help me
Code:
// Create a thread
static Thread GuiThread = new Thread(
new ThreadStart(
() =>
{
// Create and show the Window
AutoRota GUI = new AutoRota();
GUI.Show();
_GUI = GUI;
// GUI Controlles
GUI.Closed += CloseWindow;
// Start the Dispatcher Processing
System.Windows.Threading.Dispatcher.Run();
}
)
);
private static void CloseWindow(object sender, EventArgs e)
{
SaveConfig();
IsActivePlugin = false;
}
//Call on plugin start
public void PluginRun()
{
_Core = this;
// Set the apartment state
GuiThread.SetApartmentState(ApartmentState.STA);
// Make the thread a background thread
GuiThread.IsBackground = true;
// Start the thread
GuiThread.Start();
//LoadConfig();
onKeyDown += KeyboardEvent;
while (IsActivePlugin == true)
Thread.Sleep(50);
}
//Call on plugin stop
public void PluginStop()
{
// Abort to close the window;
_GUI.Close();
GuiThread.Abort();
}
// Save / Load Data
public static void SaveConfig()
{
Config config = new Config();
config.UseThwart = (bool)_GUI.UseThwart.IsChecked;
config.MaxHeal = _GUI.MaxHeal.Text;
config.MaxAntithesis = _GUI.MaxAntithesis.Text;
config.MaxFerventHealing = _GUI.MaxFerventHealing.Text;
var serializer = new XmlSerializer(typeof(Config));
var fs = File.Create(@"C:\Data.xml");
try { serializer.Serialize(fs, config); }
finally { fs.Close(); }
}
My problem is that it freezes the updater.
Sry I worked on it for 5 hours. It's late and its difficult to think at the moment.
So I'm glad if you could help me






