Example #1
0
        /// <summary>
        /// 初始化核心程序
        /// </summary>
        /// <returns>是否已经加载对应学校</returns>
        public static bool Initialize()
        {
            if (App != null)
            {
                return(true);
            }

            App = new Core();
            ListSchools();

#if __UWP__
            ConfigDirectory = Windows.Storage.ApplicationData.Current.LocalFolder.Path;
#elif __IOS__
            ConfigDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "..", "Library");
#elif __ANDROID__
            ConfigDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
#elif __MOCKS__
            ConfigDirectory = Path.Combine(Environment.CurrentDirectory, "log");
#endif

            var type = ReadConfig("hs.school.bin");

            if (type == "")
            {
                return(false);
            }
            else
            {
                var current = Schools.Find((sw) => sw.SchoolId == type);
                if (current is null)
                {
                    return(false);
                }
                App.InjectService(current);
                current.PreLoad();
                current.PostLoad();
                return(true);
            }
        }