Пример #1
0
        static void Main(string[] args)
        {
            var nonDefaultAppDomain = AppDomain.CreateDomain("nonDefaultAppDomain");

            nonDefaultAppDomain.DoCallBack(() =>
            {
                try
                {
                    if (RunInNonDefaultAppDomain)
                    {
                        ICefSharpRenderer renderer = new CefSharpRenderer();
                        //Try to render something in non default appdomain
                        Console.WriteLine("Render something in non default AppDomain:");
                        renderer.RenderSomething();
                        Console.WriteLine("Works!");
                    }
                    else
                    {
                        ICefSharpRenderer renderer = new CefSharpRendererProxy();
                        //Try to render something in default appdomain
                        Console.WriteLine("Render something in default AppDomain: ");
                        renderer.RenderSomething();
                        Console.WriteLine("Works!");
                    }
                }
                catch (Exception)
                {
                    Console.WriteLine("Something went wrong");
                }
            });
        }
Пример #2
0
        public ActionResult Index()
        {
            ViewBag.Title = "Home Page";

            ICefSharpRenderer renderer = new CefSharpRendererProxy();

            //Try to render something in default appdomain
            Console.WriteLine("Render something in default AppDomain: ");
            var res = renderer.RenderSomething();

            Console.WriteLine("Works!");

            return(View());
        }