Exemple #1
0
        ///// <summary>
        ///// Navigates to the view/controller in a modal fashion.
        ///// </summary>
        ///// <param name="controller">The name of the controller.</param>
        ///// <returns>The DialogResult from the displayed view.</returns>
        //public static DialogResult NavigateFormDialog(Controller controller)
        //{
        //    string name = controller.Name;


        //    if (!controllerCache.ContainsKey(name))
        //    {
        //        controllerCache.Add(name, controller);
        //    }
        //    history.Add(controller);
        //    DialogResult result = controller.View.ShowDialog();
        //    history.GoBack();
        //    return result;
        //}

        //        /// <summary>
        ///// Navigates to the view/controller in a modal fashion for Control realization.
        ///// </summary>
        ///// <param name="controller">The name of the controller.</param>
        ///// <returns>The DialogResult from the displayed view.</returns>
        //public static void NavigateControlDialog(Controller controller)
        //{
        //    string name = controller.Name;


        //    if (!controllerCache.ContainsKey(name))
        //    {
        //        controllerCache.Add(name, controller);
        //    }
        //    history.Add(controller);
        //    controller.View.ShowDialog();
        //}

        ///// <summary>
        ///// Navigates to the controller.
        ///// </summary>
        ///// <param name="controller">An instance of the controller.</param>
        //public static void Navigate(Controller controller)
        //{
        //    string name = controller.Name;

        //    if (!controllerCache.ContainsKey(name))
        //    {
        //        controllerCache.Add(name, controller);
        //    }
        //    else
        //    {
        //        controllerCache.Remove(name);
        //        controllerCache.Add(name, controller);
        //    }

        //    Controller currentController = history.GetCurrent();

        //    controller.View.Show();
        //    if (currentController != null)
        //    {
        //        currentController.View.Hide();
        //    }

        //    history.Add(controller);


        //}

        /// <summary>
        /// Navigates to the controller.
        /// </summary>
        /// <param name="controller">An instance of the contoller.</param>
        /// <param name="parameters">An array of the parameters.</param>
        public static void Navigate(Controller controller, params object[] parameters)
        {
            string name = controller.GetType().Name;

            if (!controllerCache.ContainsKey(name))
            {
                controllerCache.Add(name, controller);
            }
            else
            {
                controllerCache.Remove(name);
                controllerCache.Add(name, controller);
            }

            controller.Initialize(parameters);
            controller.Activate();

            Controller currentController = history.GetCurrent();

            if (currentController != null)
            {
                currentController.Deactivate();
            }
            history.Add(controller);
        }
Exemple #2
0
        ///// <summary>
        ///// Navigates to the controller
        ///// </summary>
        ///// <param name="name">controller name</param>
        //public static void Navigate(string name)
        //{
        //    if (controllerCache.ContainsKey(name))
        //    {
        //        Controller controller = controllerCache[name];

        //        Controller currentController = history.GetCurrent();

        //        if (currentController != controller)
        //        {
        //            controller.Activate();
        //            if (currentController != null)
        //            {
        //                currentController.Deactivate();
        //            }

        //            history.Add(controller);
        //        }

        //    }
        //    else
        //    {
        //        throw new MissingMemberException("Controller does not exist");
        //    }
        //}

        /// <summary>
        /// Navigates to the view/controller with the parameters
        /// </summary>
        /// <param name="name">The name of the controller.</param>
        /// <param name="parameters">An array of the parameters</param>
        public static void Navigate(string name, params object[] parameters)
        {
            if (controllerCache.ContainsKey(name))
            {
                Controller controller = controllerCache[name];

                if (parameters != null)
                {
                    controller.Initialize(parameters);
                }

                Controller currentController = history.GetCurrent();

                controller.Activate();
                if (currentController != null)
                {
                    currentController.Deactivate();
                }

                history.Add(controller);
            }
            else
            {
                throw new MissingMemberException("Controller does not exist");
            }
        }
Exemple #3
0
        ///// <summary>
        ///// Navigates to the view/controller in a modal fashion.
        ///// </summary>
        ///// <param name="controller">The name of the controller.</param>
        ///// <returns>The DialogResult from the displayed view.</returns>
        //public static DialogResult NavigateFormDialog(Controller controller)
        //{
        //    string name = controller.Name;
        //    if (!controllerCache.ContainsKey(name))
        //    {
        //        controllerCache.Add(name, controller);
        //    }
        //    history.Add(controller);
        //    DialogResult result = controller.View.ShowDialog();
        //    history.GoBack();
        //    return result;
        //}
        //        /// <summary>
        ///// Navigates to the view/controller in a modal fashion for Control realization.
        ///// </summary>
        ///// <param name="controller">The name of the controller.</param>
        ///// <returns>The DialogResult from the displayed view.</returns>
        //public static void NavigateControlDialog(Controller controller)
        //{
        //    string name = controller.Name;
        //    if (!controllerCache.ContainsKey(name))
        //    {
        //        controllerCache.Add(name, controller);
        //    }
        //    history.Add(controller);
        //    controller.View.ShowDialog();
        //}
        ///// <summary>
        ///// Navigates to the controller.
        ///// </summary>
        ///// <param name="controller">An instance of the controller.</param>
        //public static void Navigate(Controller controller)
        //{
        //    string name = controller.Name;
        //    if (!controllerCache.ContainsKey(name))
        //    {
        //        controllerCache.Add(name, controller);
        //    }
        //    else
        //    {
        //        controllerCache.Remove(name);
        //        controllerCache.Add(name, controller);
        //    }
        //    Controller currentController = history.GetCurrent();
        //    controller.View.Show();
        //    if (currentController != null)
        //    {
        //        currentController.View.Hide();
        //    }
        //    history.Add(controller);
        //}
        /// <summary>
        /// Navigates to the controller.
        /// </summary>
        /// <param name="controller">An instance of the contoller.</param>
        /// <param name="parameters">An array of the parameters.</param>
        public static void Navigate(Controller controller, params object[] parameters)
        {
            string name = controller.GetType().Name;

            if (!controllerCache.ContainsKey(name))
            {
                controllerCache.Add(name, controller);
            }
            else
            {
                controllerCache.Remove(name);
                controllerCache.Add(name, controller);
            }

            controller.Initialize(parameters);
            controller.Activate();

            Controller currentController = history.GetCurrent();
            if (currentController != null)
            {
                currentController.Deactivate();
            }
            history.Add(controller);
        }