做了一个主窗体,点击开始后会调用类检查网址返回的信息,如果存在就会在桌面右下角弹窗提示,如果主窗体不最小化,程序可以正常运行,但是最小化了就会提示在创建窗口句柄之前,不能在控件上调用 Invoke 或 BeginInvoke。
求帮忙查看~
[C#] 纯文本查看 复制代码 public void ShowNotifyForm()
{
NotifyForm notifyShowFrm = new NotifyForm();
notifyShowFrm.Show();
}
public void NotifyShowThread()
{
MethodInvoker methInvo = new MethodInvoker(ShowNotifyForm);
BeginInvoke(methInvo);
}
public void NotifyStartThread()
{
Thread thread = new Thread(NotifyShowThread);//创建新线程
thread.Start();
}
public void NotifyFunc()
{
if (itsmMaxNotifyTimes == 0)
{
if (ITSMHttp.respContentString != null && ITSMHttp.respContentString != string.Empty)
{
NotifyStartThread();
}
}
else
{
if (ITSMHttp.respContentString != null && ITSMHttp.respContentString != string.Empty)
{
if (addCompareStr == "ITSM")
{
addCompareStr = ITSMHttp.respContentString;
respContentArray.Add(addCompareStr);
NotifyStartThread();
}
else if (addCompareStr != "ITSM" && addCompareStr != ITSMHttp.respContentString)
{
addCompareStr = ITSMHttp.respContentString;
respContentArray.Clear();
respContentArray.Add(addCompareStr);
NotifyStartThread();
}
else if (addCompareStr != "ITSM" && addCompareStr == ITSMHttp.respContentString)
{
if (respContentArray.Count < itsmMaxNotifyTimes)
{
addCompareStr = ITSMHttp.respContentString;
respContentArray.Add(addCompareStr);
NotifyStartThread();
}
}
}
}
}
|