Tech Off Thread

1 post

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Rx Extensions Questions (on WP7 platform)

Back to Forum: Tech Off
  • User profile image

    Problems with code;
         1) Hangs it does not make it to 'CHECKPOINT A' and 'CHECKPOINT C' in code below, if I replace o.Subscribe() with o.First() it works any ideas?  Problem with this is handle can be overwritten.
         2)  How can an Observable dispose of itself (see CHECKPOINT B in code)? I had to comment out 'this.Dispose()' because it gives syntax error. I created IDisposable 'handle' as class member Instead and the Observable calls handle.Dispose().


    The code will run on a windows phone 7 device.


    Thanks for Any help appreciated code below;


        /// <summary>
        /// objective of this code is to execute a task in background and call dispose on self
        /// when done.
        /// </summary>
        static class SomeClass
            private static IDisposable handle;
            public static void DoTaskAsyncly()
                var o = Observable.Start(() =>
                    /* Do Some Labor Intensive Task ... */
                    /* CHECKPOINT A */
                    /* CHECKPOINT B */
                    // Dispose myself now because I want is basically go and forget.
                    // this.Dispose();
                /* CHECKPOINT C */
                handle = o.Subscribe(); // << this does not start the task!!!! but .First() does



Conversation locked

This conversation has been locked by the site admins. No new comments can be made.