Exemplo n.º 1
0
 internal static void NavigateTo(Business.ModuleControllerBase moduleController)
 {
     if (openedControllerList.Contains(moduleController))
     {
         currentModuleController = moduleController;
         updateControllerActivateState();
     }
 }
Exemplo n.º 2
0
 internal static void Close(Business.ModuleControllerBase moduleController)
 {
     if (openedControllerList.Contains(moduleController))
     {
         moduleController.Close();
         var nextController = openedControllerList.LastOrDefault();
         if (nextController != null)
         {
             nextController.IsActivated = true;
         }
         currentModuleController = nextController;
     }
 }
Exemplo n.º 3
0
        private static void createModule(Model.ModuleData module, ModuleControllerBase controller)
        {
            controller.Closed += onModuleClosed;

            var moduleControllers = moduleControllerMap.GetOrAdd(module, new List <ModuleControllerBase>());

            moduleControllers.Add(controller);
            openedControllerList.Insert(PinnedCount, controller);
            controllerModuleMap.TryAdd(controller, module);

            updateOpenedModuleTitle(module);
            controller.Create();
        }
Exemplo n.º 4
0
        /// <summary>
        /// find Controller bound to Module, then open its first page, and handle close event
        /// </summary>
        public static void Open(Model.ModuleData module)
        {
            //get controller instance
            ModuleControllerBase controller = moduleControllerMapping(module);

            if (controller == null)
            {
                throw new InvalidOperationException("module controller can not be null.");
            }

            if (controller.IsSingleMode)
            {
                List <ModuleControllerBase> controllers;
                if (moduleControllerMap.TryGetValue(module, out controllers))
                {
                    var singleControllerInstance = controllers.SingleOrDefault();
                    if (singleControllerInstance != null)
                    {
                        NavigateTo(singleControllerInstance);
                        return;
                    }
                }
            }
            //HomePage is Single too
            if (controller.IsHomePage)
            {
                if (homePageCreated)
                {
                    throw new InvalidOperationException("only can set one Home page.");
                }
                homePageCreated = true;
                //homePageCount++;
                //if (homePageCount > 1)
                //	throw new InvalidOperationException("only can set one Home page.");
            }

            createModule(module, controller);
            currentModuleController = controller;
            updateControllerActivateState();
        }