Page 4 of 6 FirstFirst ... 23456 LastLast
Results 31 to 40 of 54
  1. #31
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1

    i will upload now some of my experiments.

  2. #32
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    Download here -> Webclient: Web Client Sample

    DownloadProgressChangedEventHandler is raised at 4KB (internet) 65k (local) with respect to DownloadStringAsync.

    Even though I can’t consider this as complete Asynchronous Model, coz WebClient class uses Events and not AsyncCallbacks(they aren’t the same technically), everything are still done asynchronously. User can CANCEL (control whatever on the forms). Try dragging, or hold the UI as the download progresses or until it finished.

    InvokeScript can be inserted or trigger anywhere on the DownloadProgressChangedEventHandler, if it requires to spawn another thread saving resources, call API, it is still possible, provided that you won’t break the UI Thread. A Combination of BackGroudWorker is useful for multiple threads.

    My previous example of BackGroundWorker download it here -> BackGroundWorker Sample
    Last edited by MarkCuering; 12-08-2009 at 04:23 PM.

  3. #33
    @Mark - I appreciate you taking the time and effort to help me.

    Ako gi try imo gi himo and yes dili siya mo kaging. Again ako pangutana is are you using InvokeScript to download a resource or something on that test app?

  4. #34
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    oopsss I forgot, another thing to prove that it runs async'ly, try click "navigate" button twice. Then hit "cancel".
    of course, there's no way to cancel the previous call coz I disabled the button ^_^

    another test... do this quickly.

    1. enter site hxxp://www.mail.com -> hit navigate button
    2. enter site hxxp://www.istorya.net -> hit navigate button
    3. press "CANCEL".

    result: mail.com display.


    reverse the process.


    1. enter site hxxp://www.istorya.net -> hit navigate button
    2. enter site hxxp://www.mail.com -> hit navigate button
    3. press "CANCEL".

    result: istorya.net display.


    If you navigate twice and cancel twice, both process stopped, it is good to know that during multiple process, when CancelAsync() method is called, the latest asynchronous call is aborted, the other remains running not unless you have an equivalent numbers of CanceAsync() calls.

  5. #35
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    Quote Originally Posted by junkfactory View Post
    @Mark - I appreciate you taking the time and effort to help me.

    Ako gi try imo gi himo and yes dili siya mo kaging. Again ako pangutana is are you using InvokeScript to download a resource or something on that test app?
    Welcome still learning here...

    no problem with the invokescript (not tested), but it work on my custom thread, even multiple threads, I even spawn COM objects across the network to parse the data before it display on my textbox (that’s why it includes some proxy settings there)... if all of these works fine, then invokescript may still be fine, invoking scripts to do something that allows my UI to wait is the same, not unless if the script is modifying the UI. it's ILLEGAL! UI Thread should be the only one to update the UI...that's why a BackGroundWorker is helpful if you want to modify the UI outside from its own thread...coz it shift from other thread back to UI and vice versa, surely you won't violate any rules.

    during my test I figure it out that something wrong with your “while” statement and the DoEvents(). Try to remove that or reconstruct your code... Honestly, I don’t understand why you place that but it looks no good to me. I used DoEvents() method only in some certain situations.

    Coffee Time LOL....

  6. #36
    This isn't something to prove asynchronousity (sakto ba kaha na nga wording nyahahah).

    I don't why you are talking of COM Objects across network, its irrelevant to my problem.

    Quote Originally Posted by MarkCuering
    Honestly, I don’t understand why you place that but it looks no good to me. I used DoEvents() method only in some certain situations.
    If you don't understand why I placed DoEvents there, then we both have much to learn

  7. #37
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    Quote Originally Posted by junkfactory View Post
    This isn't something to prove asynchronousity (sakto ba kaha na nga wording nyahahah).

    I don't why you are talking of COM Objects across network, its irrelevant to my problem.

    If you don't understand why I placed DoEvents there, then we both have much to learn
    hahahahahaha.... but i understand in my own application

    from MSDN:

    When you run a Windows Form, it creates the new form, which then waits for events to handle. Each time the form handles an event, it processes all the code associated with that event. All other events wait in the queue. While your code handles the event, your application does not respond. For example, the window does not repaint if another window is dragged on top.

    If you call DoEvents in your code, your application can handle the other events. For example, if you have a form that adds data to a ListBox and add DoEvents to your code, your form repaints when another window is dragged over it. If you remove DoEvents from your code, your form will not repaint until the click event handler of the button is finished executing.
    inside your WHILE statement you place DoEvents().

    1. WHILE is a kind of LOOP is it against to asynchrous call?
    2. What happen if WHILE statement becomes FALSE? so no more DoEvents() call too
    3. while (IsDownloadCompleted == false), you waiting here, and yet some delegates are waiting too

    test my BackGroundWorker again... hehehe... actually I learn alot in your problem
    Last edited by MarkCuering; 12-08-2009 at 05:50 PM.

  8. #38
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    Quote Originally Posted by junkfactory View Post
    This isn't something to prove asynchronousity (sakto ba kaha na nga wording nyahahah).
    If you mean about the TESTGUIDE yes... asynchronous events are those occurs independently in the main program. We only add button to control them "NAVIGATE” and "CANCEL" base in my example program. When you navigate two sites, and cancel one, you can still get the first result.

    If it were synchronous call, all of it will be aborted… what I’m trying to test also is raising more than 5 calls then stopped the middle… oops...sorry this is not related to your problem

    Quote Originally Posted by junkfactory View Post
    I don't why you are talking of COM Objects across network, its irrelevant to my problem.
    instead of invoking script I use also some COM Objects... I'm not a web guy... I don't have the right knowledge to write reliable javascript or jscript

  9. #39
    Quote Originally Posted by junkfactory View Post
    This isn't something to prove asynchronousity (sakto ba kaha na nga wording nyahahah).

    I don't why you are talking of COM Objects across network, its irrelevant to my problem.



    If you don't understand why I placed DoEvents there, then we both have much to learn
    Ang technique ana is imong mga long running task(i.e. pag-stream from the webserver) is dili mahitabo sa main thread(GUI Thread).

  10. #40

    Default Solved!

    Quote Originally Posted by eax View Post
    Ang technique ana is imong mga long running task(i.e. pag-stream from the webserver) is dili mahitabo sa main thread(GUI Thread).
    Yep. Mao nga ang title sa thread is "... executed in another thread?" Pero sa muna-munang paningkamot nga dili kaayo ma complicated ang app, ni adto nalang ko sa event based solution para ma solbad na ni.

    Instead nga mag paabot ang script sa result sa "GetContents", ako nalang gi pa register ang scripts ug function nga tawagon sa app once mahuman na ang download process. Di unta ko ganahan ingon ani pero saon mao ra man solution ako nakit-an sa pagka-karon.

    Kung naa mo idea nga mas maayo and simple, open japon ko para maminaw. Salamat sa inyo tanan!

  11.    Advertisement

Page 4 of 6 FirstFirst ... 23456 LastLast

Similar Threads

 
  1. love can be expressed in various ways
    By Meganda in forum "Love is..."
    Replies: 6
    Last Post: 08-27-2012, 04:53 AM
  2. Replies: 36
    Last Post: 04-11-2011, 09:13 PM
  3. Bidding Script - Would it be Possible in istorya.net
    By salbahis in forum Support Center
    Replies: 1
    Last Post: 02-02-2009, 11:49 AM
  4. how can i prevent from being spied in yahoo messenger?
    By boyq in forum Networking & Internet
    Replies: 21
    Last Post: 06-06-2008, 12:42 PM
  5. Replies: 3
    Last Post: 01-14-2008, 04:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top