Friday, 27 September 2013

c# menuItem1 will not disable

c# menuItem1 will not disable

Is this wrong?
I always get "cb1 and firmware" even if my checkBox2 is checked. I also
tried with just & instead of &&.
It was working fine before I had to add it into thread to get UI to update
correctly.
private void MyWorkerThread2()
{
if ((this.IsChecked(checkBox1) && (myString == "86.09.0000")))
{
MessageBox.Show("cb1 and firmware");
Prep.clean();
startedimage();
wipefiles();
}
else if (this.IsChecked(checkBox1) &&
(this.IsChecked(checkBox2) && (myString == "86.09.0000")))
{
MessageBox.Show("cb1 and firmware and cb2");
Prep.clean();
startedimage();
fscreate();
wipefiles();
}
else if (myString == "86.09.0000")
{
MessageBox.Show("firmware");
if (myThread == null)
{
Prep.clean();
startedimage();
myThread = new Thread(MyWorkerThread);
myThread.IsBackground = true;
myThread.Start();
}
}
else
{
FactoryReset();
}
}
public delegate bool IsCheckedDelegate(CheckBox cb);
public bool IsChecked(CheckBox cb)
{
if (cb.InvokeRequired)
{
return (bool)cb.Invoke(new IsCheckedDelegate(IsChecked),
new Object[] { cb });
}
else
{
return cb.Checked;
}
}

No comments:

Post a Comment