コード例 #1
0
ファイル: DisposeTests.cs プロジェクト: borisdj/dextop
        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);
        }
コード例 #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);
        }
コード例 #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);
 }
コード例 #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));
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
        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));
            }
        }