예제 #1
0
        /// <summary>
        /// 读取App列表
        /// </summary>
        private void ReadApps()
        {
            XmlDB mDB = XmlDBFactory.LoadXmlDB(mFileName);

            //读取应用程序列表
            for (int i = 0; i < 6; i++)
            {
                //读取类型值为i的应用程序列表
                List <object> mObjects = mDB.ReadByObject(new SmartApp(null, null, mNames[i]));
                //将数组转化为List
                List <SmartApp> mList = new List <SmartApp>();
                for (int j = 0; j < mObjects.Count; j++)
                {
                    mList.Add((SmartApp)mObjects[j]);
                }
                mAppDic.Add(mNames[i], mList);
            }
            //将应用程序添加到对应的桌面
            foreach (KeyValuePair <string, List <SmartApp> > mValue in mAppDic)
            {
                //获取该桌面下的应用列表
                mAppList = mValue.Value;
                //获取该桌面
                Grid mGrid = getGrid(mValue.Key);
                CreateAppForGrid(mGrid, mAppList);
            }
        }
예제 #2
0
 /// <summary>
 /// 初始化天气
 /// </summary>
 private void InitWeather()
 {
     //如果网络已连接,则获取最新的天气,否则读取本地天气
     if (WebState.isConneted())
     {
         //获取天气
         WeatherStructure mWeather = WebWeather.getWeatherByCode(WebWeather.getCodeByIP());
         SetWeather(mWeather);
         //更新本地数据
         File.Delete(Config + "\\Weather.xml");
         XmlDB mDB = XmlDBFactory.CreatXmlDB("Weather", Config + "\\Weather.xml", 1);
         mDB.Insert(mWeather);
         mDB.Commit();
     }
     else
     {
         XmlDB            mDB      = XmlDBFactory.LoadXmlDB(Config + "\\Weather.xml");
         List <object>    mObjects = mDB.ReadByObject(new WeatherStructure());
         WeatherStructure mWeather = (WeatherStructure)mObjects[0];
         SetWeather(mWeather);
     }
 }