Exemplo n.º 1
0
 /// <summary>
 /// Helper extension for concise syntax
 /// </summary>
 private static void CloseAndDisable(this IHoardViewController controler)
 {
     if (controler == null)
     {
         return;
     }
     // Clearing the flag.
     ModalView = false;
     controler.Disable();
     controler.Close();
 }
Exemplo n.º 2
0
        /// <summary>
        ///   Open and show new controller to the user
        /// </summary>
        public static void Open(IHoardViewController controler, bool modalView = false)
        {
            ModalView = modalView;
            controler = GetCompleteControler(controler);
            controler.Open();
            controler.Enable();
            var top = stackedControlers.SafePeek();

            if (top != null)
            {
                top.Disable();
            }
            stackedControlers.Push(controler);
        }
        /// <summary>
        /// Provides the controler decorated with unity view. In this case it will only work with ViewControlerBase
        /// </summary>
        /// <param name="controler"></param>
        /// <returns></returns>
        public IHoardViewController ProvideFor(IHoardViewController controler)
        {
            if (!(controler is ViewController))
            {
                return(controler);
            }

            var type = controler.GetType();

            if (!controlers.ContainsKey(type))
            {
                return(controler);
            }

            return(controlers[type].BindWithViewModel(controler as ViewController));
        }
Exemplo n.º 4
0
 /// <summary>
 ///   Opens new controller and clears the current controller stack. New controller will be the base
 /// for the new navigation stack
 /// </summary>
 public static void OpenControlerWithNewRoot(IHoardViewController rootControler)
 {
     if (stackedControlers == null)
     {
         stackedControlers = new Stack <IHoardViewController>();
     }
     else
     {
         foreach (var v in stackedControlers)
         {
             v.CloseAndDisable();
         }
         stackedControlers.Clear();
     }
     if (rootControler != null)
     {
         Open(rootControler);
     }
 }
Exemplo n.º 5
0
 private static IHoardViewController GetCompleteControler(IHoardViewController c)
 => controlerProvider != null?controlerProvider.ProvideFor(c) : c;