If anyone has a useful source explaining how to get this to work, or link to some source code that implements it in a somewhat basic (read easy) manner, it would help a lot.
As of right now I've been following this example: http://snipplr.com/view/22250/systemwindowsformstimer-example/
Basically, I want a checkbox that when toggled on, action will be taken every x minutes. Right now, the game just begins not responding after I click the checkbox for the first time.
I've added the "static System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();" to my class. I've subscribed/unsubscribed to the events in both the LoginComplete and Logoff methods, respectively, adding the timer.Interval = 60000; alongside where I subscribed to the event.
Quote:
static System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
bool started = false;
static System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
bool started = false;
Quote:
[ControlEvent("Checkbox", "Change"
]
void Checkbox_Change(object sender, CheckBoxChangeEventArgs e)
{
----try
----{
-------while (Checkbox.Checked == true)
-------{
--------------timer.Start();
--------------started = true;
--------------while (started == true)
--------------{
-----------------Application.DoEvents();
-----------------if (Checkbox.Checked == true)
-----------------{
-----------------}
-----------------else
-----------------{
---------------------started = false;
-----------------}
--------------}
-------}
----}
----catch (Exception ex) { Util.LogError(ex); }
}
public void timer_Tick(object sender, EventArgs e)
{
----try
----{
-------timer.Stop();
-------Host.Actions.AddChatText("...", 5);
-------timer.Start();
----}
----catch(Exception ex) { Util.LogError(ex); }
}
[ControlEvent("Checkbox", "Change"
]void Checkbox_Change(object sender, CheckBoxChangeEventArgs e)
{
----try
----{
-------while (Checkbox.Checked == true)
-------{
--------------timer.Start();
--------------started = true;
--------------while (started == true)
--------------{
-----------------Application.DoEvents();
-----------------if (Checkbox.Checked == true)
-----------------{
-----------------}
-----------------else
-----------------{
---------------------started = false;
-----------------}
--------------}
-------}
----}
----catch (Exception ex) { Util.LogError(ex); }
}
public void timer_Tick(object sender, EventArgs e)
{
----try
----{
-------timer.Stop();
-------Host.Actions.AddChatText("...", 5);
-------timer.Start();
----}
----catch(Exception ex) { Util.LogError(ex); }
}
Any help would be greatly appreciated. I apologize if my terminology isn't quite correct, or if I'm incredibly far off on how to get this working. I'm doing this mostly as a learning experience, as I know I have a lot left to learn.
Thanks.




¤ Izz The Forgotten