[Closed] How to prevent mouse "busy" when using webbrowser open a url?
Hi,
My recent project need to let data update every minute or less time,my simply way is using a webbrowser to visit a url so that I can let the data refresh in real time,the problem is the mouse,when a webbrowser open a url success,the mouse will keep “busy” for a while,so when a user doing some operation in 3dsmax,the mouse “Auto” switching to busy is very annoy,it is a simple question,but I truly don’t know how to avoid it and fix it,below is the example cause this problem:
First,the refresh page code:
(
w_b=dotNetobject "System.Windows.Forms.WebBrowser"
w_b.ScriptErrorsSuppressed=true
chk_url="http://www.bing.com"
try(destroydialog max_test) catch()
rollout max_test "Update data"
(
timer clock "" interval:1000
label test "1" pos:[100,10]
on clock tick do
(
timers=(test.text as integer)+1
test.text=timers as string
if timers>10 then
(
w_b.url=dotNetObject "System.Uri" chk_url
test.text="1"
)
)
)
CreateDialog max_test 300 60
)
The “busy” steps:
1.The normal mouse,a user is operating(The yellow area)
2.Opening a url,the mouse is busying for a while:(How to prevent the cursor busy of this step?)
3.The cursor turns to arrow,not the origin one(Also prevent cursor change to other one?)
try w_b.Refresh() instead of changing url.
I’d also try to move checks/updates to a background thread.
Thanks for help, Serejah,I tried,the problem still can not fix,it’s the same as before:
(
w_b=dotNetobject "System.Windows.Forms.WebBrowser"
w_b.ScriptErrorsSuppressed=true
chk_url="http://www.bing.com"
try(destroydialog max_test) catch()
rollout max_test "Update data"
(
timer clock "" interval:1000
label test "1" pos:[100,10]
on clock tick do
(
timers=(test.text as integer)+1
test.text=timers as string
if timers>10 then
(
w_b.Refresh()
test.text="1"
)
)
on max_test open do
(
w_b.url=dotNetObject "System.Uri" chk_url
)
)
CreateDialog max_test 300 60
)
Reloading page in browser every second to check if it has any updates doesn’t seem like an optimal solution.
As an alternative you can download page as string using WebClient and compare it with the previous one. And only If strings aren’t equal – reload page in webbrowser.
Ideally such things should be handled using javascript and ajax (of course if you have access to server backend to create a response for
ajax request)