예제 #1
0
        /// <summary>
        /// 程序主逻辑
        /// </summary>
        /// <param name="args">命令行参数</param>
        private static void Main(string[] args)
        {
            if (!IsStarted())
            {
                WriteLine("此程序已在运行中, 按任意键关闭此窗口");
                ReadKey(true);
                return;
            }
            Clear();
            Ui.AddStudents();
            Ui.DefaultSetting();
            Ui.AboutThisApplication();

            UserCore currentUser;

            do
            {
                currentUser = UserCore.Login();
            } while (currentUser == null);

            while (_appState == State.On)
            {
                currentUser.Prompt();
                switch (currentUser.UserType)
                {
                case Identity.Student:
                    currentUser = RunForStudent(currentUser as Student) ?? currentUser;
                    break;

                case Identity.Instructor:
                    currentUser = RunForTeacher(currentUser as Instructor) ?? currentUser;
                    break;

                case Identity.HeadTeacher:
                    currentUser = RunForHeadTeacher(currentUser as HeadTeacher) ?? currentUser;
                    break;

                default:
                    throw new ArgumentException();
                }
            }
        }