Beispiel #1
0
        public void SessionDisposesWindowsTest()
        {
            DextopEnvironment.SetProvider(new DextopTestEnvironment());

            var app = new DextopTestApplication();
            app.Initialize();

            var session = new DextopSession();
            app.AddSession(session);

            var win = new DextopWindow();
            session.Remote.Register(win);

            WeakReference ar = new WeakReference(app);
            WeakReference sr = new WeakReference(session);
            WeakReference wr = new WeakReference(win);

            app.Dispose();
            app = null;
            session = null;
            win = null;

            GC.Collect();
            GC.WaitForPendingFinalizers();

            Assert.AreEqual(false, ar.IsAlive);
            Assert.AreEqual(false, sr.IsAlive);
            Assert.AreEqual(false, wr.IsAlive);
        }
Beispiel #2
0
        public void SessionDisposesWindowsTest()
        {
            DextopEnvironment.SetProvider(new DextopTestEnvironment());

            var app = new DextopTestApplication();

            app.Initialize();

            var session = new DextopSession();

            app.AddSession(session);

            var win = new DextopWindow();

            session.Remote.Register(win);

            WeakReference ar = new WeakReference(app);
            WeakReference sr = new WeakReference(session);
            WeakReference wr = new WeakReference(win);

            app.Dispose();
            app     = null;
            session = null;
            win     = null;

            GC.Collect();
            GC.WaitForPendingFinalizers();

            Assert.AreEqual(false, ar.IsAlive);
            Assert.AreEqual(false, sr.IsAlive);
            Assert.AreEqual(false, wr.IsAlive);
        }
Beispiel #3
0
 /// <summary>
 /// Register session within the module. Module can optionaly create a remotable object associated with the session.
 /// </summary>
 /// <param name="session"></param>
 /// <returns></returns>
 protected internal override Remoting.IDextopRemotable RegisterSession(DextopSession session)
 {
     var config = new DextopConfig();
     config.Add("url", DextopUtil.AbsolutePath(DextopUtil.CombinePaths(base.VirtualPath, "soundmanager2/swf")));
     if (sounds != null)
         config.Add("sounds", sounds);
     return new DextopRemotableConfig("Dextop.modules.SoundModule", config);
 }
Beispiel #4
0
        /// <summary>
        /// Register session within the module. Module can optionaly create a remotable object associated with the session.
        /// </summary>
        /// <param name="session"></param>
        /// <returns></returns>
        protected internal override Remoting.IDextopRemotable RegisterSession(DextopSession session)
        {
            var config = new DextopConfig();

            config.Add("url", DextopUtil.AbsolutePath(DextopUtil.CombinePaths(base.VirtualPath, "soundmanager2/swf")));
            if (sounds != null)
            {
                config.Add("sounds", sounds);
            }
            return(new DextopRemotableConfig("Dextop.modules.SoundModule", config));
        }
        IAsyncResult IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData)
        {            
            try
            {                
                if (!int.TryParse(context.Request["start"], out start))
                    start = 0;

                this.context = context;
                this.session = GetSession(context);
                var ar = session.BeginHandleLongPollingRequest(start, cb, extraData);
                return ar;
            }
            catch (Exception ex)
            {
                errorHandler = WriteException;
                return errorHandler.BeginInvoke(context, ex, cb, extraData);
            }
        }
        IAsyncResult IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, object extraData)
        {
            try
            {
                if (!int.TryParse(context.Request["start"], out start))
                {
                    start = 0;
                }

                this.context = context;
                this.session = GetSession(context);
                var ar = session.BeginHandleLongPollingRequest(start, cb, extraData);
                return(ar);
            }
            catch (Exception ex)
            {
                errorHandler = WriteException;
                return(errorHandler.BeginInvoke(context, ex, cb, extraData));
            }
        }