Ejemplo n.º 1
0
        public static void CreateItem()
        {
            CreateScreen createItem = new CreateScreen();

            //This gives the newly instantiated copy of the form
            //focus, instead of the console window
            createItem.Show();
            createItem.Activate();
            Application.Run(createItem);
        }
        private void ChangeScreen(ScreenState screenState, CreateScreen createScreen)
        {
            previousScreen = currentScreen;

            if (!screens.ContainsKey(screenState))
            {
                screens.Add(screenState, createScreen());
                screens[screenState].LoadContent();
            }
            currentScreen = screens[screenState];
            currentScreen.Activate();
        }
Ejemplo n.º 3
0
        private void ChangeScreen(ScreenState screenState, CreateScreen createScreen)
        {
            previousScreen = currentScreen;

            if (!screens.ContainsKey(screenState))
            {
                screens.Add(screenState, createScreen());
                screens[screenState].LoadContent();
            }

            currentScreen = screens[screenState];

            currentScreen.Activate();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 用于回收再利用
        /// 默认调用了LoadContent以及Reinit
        /// 注意的是:screenType不能为Between
        /// </summary>
        /// <param name="screenType">屏幕种类</param>
        /// <param name="createScreen">生成屏幕的方法</param>
        public void ChangeScreenTo(ScreenType screenType, CreateScreen createScreen)
        {
            if (currentScreen != null)
            {
                previousScreenType = currentScreenType;
                previousScreen     = currentScreen;
                //注意,一定要先释放Input资源,并且注意不要重复释放!
                previousScreen.UnloadContent();
            }
            if (!screenDictionary.ContainsKey(screenType))
            {
                /*
                 #region 设置新页面
                 * screenDictionary.Add(screenType, createScreen());
                 * new Thread(new ThreadStart(screenDictionary[screenType].RegistCotent)).Start();
                 * nextScreenType = screenType;
                 * nextScreen = screenDictionary[screenType];
                 #endregion
                 *
                 #region 设置Between页面
                 * //设置BetweenScreen。
                 * //默认存在BetweenScreen
                 * currentScreenType = ScreenType.Between;
                 * currentScreen = screenDictionary[ScreenType.Between];
                 * currentScreen.ReInit();
                 #endregion
                 */
                //为了省事,这是老方法
                screenDictionary.Add(screenType, createScreen());
                currentScreenType = screenType;
                currentScreen     = screenDictionary[screenType];
                currentScreen.BaseLoadContent();
            }
            else
            {
                #region 直接加载新页面
                currentScreenType = screenType;
                currentScreen     = screenDictionary[screenType];
                //重新启动
                currentScreen.ReInit();
                #endregion

                #region 清理资源
                ReleaseScreen();
                //重置nextScreen
                nextScreen = null;
                #endregion
            }
        }
 private void menuCreateScreen_Click(object sender, RoutedEventArgs e)
 {
     CreateScreen addControl = new CreateScreen(this);
     addControl.Show();
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 注册页面
 /// </summary>
 public static SAScreen RegistScreen(ScreenType screenType, CreateScreen createScreen)
 {
     screenDictionary.Add(screenType, createScreen());
     screenDictionary[screenType].RegistCotent();
     return(screenDictionary[screenType]);
 }