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
        static int Main(string[] args)
        {
            try
            {
                if (args.Length == 0)
                {
                    PrintUsage();
                    return(1);
                }

                var applicationAssemblyPath = args[0];
                var fileInfo = new FileInfo(applicationAssemblyPath);
                if (fileInfo.Directory.Name != "bin")
                {
                    throw new InvalidOperationException("You should point to main application's assembly inside application's bin directory.");
                }

                var dxEnv = new DextopPreprocessorEnvironment
                {
                    PhysicalAppPath = fileInfo.Directory.Parent.FullName
                };

                DextopEnvironment.SetProvider(dxEnv);

                for (var i = 1; i < args.Length; i++)
                {
                    if (args[i].StartsWith(virtualPathSwitch))
                    {
                        dxEnv.VirtualAppPath = args[i].Substring(virtualPathSwitch.Length);
                    }

                    if (args[i].StartsWith("/?"))
                    {
                        PrintUsage();
                    }
                }

                var appAssembly   = Assembly.LoadFrom(applicationAssemblyPath);
                var bootstrappers = GetApplicationBootstrapperTypes(appAssembly);



                foreach (var booterType in bootstrappers)
                {
                    var bootstrapper = (IDextopApplicationBootsraper)Activator.CreateInstance(booterType);
                    var app          = bootstrapper.CreateApplication();
                    app.Initialize();
                }
                Console.WriteLine("Dextop preprocessing complete.");
                return(0);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Dextop preprocessor error: " + ex);
                return(1);
            }
        }