求教:WebBrowser跳转的时候的一个“The requested resource is in use”报错?

kingmax54212008 2012-05-13 07:47:29
System.Runtime.InteropServices.COMException (0x800700AA): The requested resource is in use. (Exception from HRESULT: 0x800700AA)
at System.Windows.Forms.UnsafeNativeMethods.IWebBrowser2.Navigate2(Object& URL, Object& flags, Object& targetFrameName, Object& postData, Object& headers)
at System.Windows.Forms.WebBrowser.PerformNavigate2(Object& URL, Object& flags, Object& targetFrameName, Object& postData, Object& headers)
at System.Windows.Forms.WebBrowser.PerformNavigateHelper(String urlString, Boolean newWindow, String targetFrameName, Byte[] postData, String headers)
at System.Windows.Forms.WebBrowser.Navigate(String urlString)
at eXLearning.MainFormAutofit.SlidesPlayertimer_Tick(Object sender, EventArgs e) in E:\xunzhen\eXLearning\eXLearning\MainFormAutofit.cs:line 4269





4269行源代码如下:
wbResourcePlayer.Navigate("javascript:GoToNextSld();");




这个报错好像随机出现的,不是必然出现的,有时候没问题,有时候报错。研究了一天了,还是没有找到问题所在。
...全文
222 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
kingmax54212008 2012-05-13
  • 打赏
  • 举报
回复
4269行源代码如下:
wbResourcePlayer.Navigate("javascript:GoToNextSld();");
kingmax54212008 2012-05-13
  • 打赏
  • 举报
回复
private void SlidesPlayertimer_Tick(object sender, EventArgs e)
{
try
{
Console.WriteLine("gSlideIndex = " + gSlideIndex.ToString());
Console.WriteLine("Current webbrowser visible status = " + wbResourcePlayer.Visible);
VRStudio.Common.DLog.Write(wbResourcePlayer.DocumentText, VRStudio.Common.DLog.LogMessageType.Info);
gSlideIndex = imagecollectionidex + 1;
if (imagecollectionidex >= modelimageslst.Count)
{
// it's the end, just stop the timer
Console.WriteLine(DateTime.Now.ToString());
Console.WriteLine("SlidesPlayertimer stops...");
SlidesPlayertimer.Stop();
imagecollectionidex = 0;
SlidesPlayertimer.Enabled = false;
if (wbResourcePlayer.Visible == true)
wbResourcePlayer.Visible = false;
return;
}
if (modelimageslst.Count > 0)
{
if (imagecollectionidex < modelimageslst.Count)
{
Console.WriteLine(DateTime.Now.ToString());
Console.WriteLine("imagecollectionidex = " + imagecollectionidex);
Console.WriteLine("ImagePath = " + modelimageslst[imagecollectionidex].ImagePath);

SlidesPlayertimer.Interval = modelimageslst[imagecollectionidex].ImageAutoInterval * 1000;
Console.WriteLine("Current Image_ID = " + modelimageslst[imagecollectionidex].Image_ID.ToString());
Console.WriteLine("Current image play time = " + modelimageslst[imagecollectionidex].ImageAutoInterval.ToString());
// navigate to slide player
if (imagecollectionidex == 0)
{
//if it's the first page navigate the local path
//wbResourcePlayer.Navigate(PPTPreviewFullPath);
//get the selected slide index and navigate to it
if (this.lveSlides.SelectedItems.Count > 0)
{
imagecollectionidex = lveSlides.SelectedIndices[0];
if (imagecollectionidex > 0)
{
if (wbResourcePlayer.Visible == false)
{
wbResourcePlayer.Visible = true;
}
}
gSlideIndex = imagecollectionidex + 1;
try
{
this.Focus();
wbResourcePlayer.Navigate("javascript:GoToSldNum(" + gSlideIndex.ToString() + ");");
Console.WriteLine("javascript:GoToSldNum(" + gSlideIndex.ToString() + ");");
VRStudio.Common.DLog.Write("gSlideIndex =" + gSlideIndex.ToString(), VRStudio.Common.DLog.LogMessageType.Info);
VRStudio.Common.DLog.Write("javascript:GoToSldNum(" + gSlideIndex.ToString() + ");", VRStudio.Common.DLog.LogMessageType.Info);
}
catch (System.Exception ex1)
{
VRStudio.Common.DLog.Write(ex1.ToString(), VRStudio.Common.DLog.LogMessageType.Error);
try
{
VRStudio.Common.DLog.Write("javascript:GoToSldNum(" + gSlideIndex.ToString() + ");", VRStudio.Common.DLog.LogMessageType.Info);
}
catch (System.Exception ex)
{
VRStudio.Common.DLog.Write(ex.ToString(), VRStudio.Common.DLog.LogMessageType.Error);
}
}
}
else
{
this.Focus();
wbResourcePlayer.Navigate("javascript:GoToNextSld();");
Console.WriteLine("javascript:GoToNextSld();");
VRStudio.Common.DLog.Write("gSlideIndex =" + gSlideIndex.ToString(), VRStudio.Common.DLog.LogMessageType.Info);
VRStudio.Common.DLog.Write("javascript:GoToNextSld();", VRStudio.Common.DLog.LogMessageType.Info);
}
}
else
{
wbResourcePlayer.Navigate("javascript:GoToNextSld();"); Console.WriteLine("javascript:GoToNextSld();");
VRStudio.Common.DLog.Write("gSlideIndex =" + gSlideIndex.ToString(), VRStudio.Common.DLog.LogMessageType.Info);
VRStudio.Common.DLog.Write("javascript:GoToNextSld();", VRStudio.Common.DLog.LogMessageType.Info);
}
wbResourcePlayer.ScrollBarsEnabled = false;
imagecollectionidex++;
}
}
else
{
// it's the end, just stop the timer
SlidesPlayertimer.Stop();
SlidesPlayertimer.Enabled = false;
}
}
catch (System.Exception ex)
{
VRStudio.Common.DLog.Write(ex.ToString(), VRStudio.Common.DLog.LogMessageType.Error);
}
}
歌神的卖 2012-05-13
  • 打赏
  • 举报
回复
能看看代码么?

110,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧