private static void InternalNavigate(IMXView fromView, string url, Dictionary <string, string> parameters)
        {
            Console.WriteLine("InternalNavigation navigating to: " + url);

            MXContainer container = Instance;   // optimization for the server size, property reference is a hashed lookup

            // fetch and allocate a viable controller
            IMXController controller = container.GetController(url, parameters);

            // Initiate load for the associated controller passing all parameters
            if (controller != null)
            {
                container.OnControllerLoadBegin(controller);

                container.CancelLoad = false;

                // synchronize load layer to prevent collisions on web-based targets.
                lock (container)
                {
                    // Console.WriteLine("InternalNavigate: Locked");

                    // if there is no synchronization, don't launch a new thread
                    if (container.ThreadedLoad)
                    {
                        // new thread to execute the Load() method for the layer
//	                    new Thread((object args) =>
//	                    {
                        try
                        {
                            //Dictionary<string, string> parameters = (Dictionary<string, string>)args;
                            container.LoadController(fromView, controller, parameters);
                        }
                        catch (Exception ex)
                        {
                            container.OnControllerLoadFailed(controller, ex);
                        }
//
//						}).Start(parameters);
                    }
                    else
                    {
                        try
                        {
                            container.LoadController(fromView, controller, parameters);
                        }
                        catch (Exception ex)
                        {
                            container.OnControllerLoadFailed(controller, ex);
                        }
                    }

                    // Console.WriteLine("InternalNavigate: Unlocking");
                }
            }
        }
Beispiel #2
0
        private static void InternalNavigate(IMXView fromView, string url, Dictionary <string, string> parameters)
        {
            MXContainer container = Instance; // optimization for the server side; property reference is a hashed lookup

            // fetch and allocate a viable controller
            var controller = container.GetController(url, ref parameters);

            if (controller != null)
            {
                // Initiate load for the associated controller passing all parameters
                TryLoadController(container, fromView, controller, url, parameters);
            }
        }
        private static void InternalNavigate(IMXView fromView, string url, Dictionary <string, string> parameters)
        {
            MXContainer container = Instance;   // optimization for the server size, property reference is a hashed lookup

            // fetch and allocate a viable controller
            IMXController controller = container.GetController(url, ref parameters);

            // Initiate load for the associated controller passing all parameters
            if (controller != null)
            {
                container.OnControllerLoadBegin(controller);

                container.CancelLoad = false;

                // synchronize load layer to prevent collisions on web-based targets.
                lock (container)
                {
                    // Console.WriteLine("InternalNavigate: Locked");

                    // if there is no synchronization, don't launch a new thread
                    if (container.ThreadedLoad)
                    {
                        // new thread to execute the Load() method for the layer
#if NETFX_CORE
                        System.Threading.Tasks.Task.Factory.StartNew(() => TryLoadController(container, fromView, controller, parameters), System.Threading.Tasks.TaskCreationOptions.LongRunning);
#else
                        new Thread(() => TryLoadController(container, fromView, controller, parameters)).Start();
#endif
                    }
                    else
                    {
                        TryLoadController(container, fromView, controller, parameters);
                    }

                    // Console.WriteLine("InternalNavigate: Unlocking");
                }
            }
        }