コード例 #1
0
 private void LoadEasyImageFromFile(string filePath)
 {
     try
     {
         using (var sr = new StreamReader(filePath))
         {
             var str = sr.ReadToEnd();
             if (str.Length > 0)
             {
                 using (var ms = new MemoryStream(Convert.FromBase64String(str)))
                 {
                     var baseInfos = new BinaryFormatter().Deserialize(ms) as List <ImageControlBaseInfo>;
                     if (baseInfos != null)
                     {
                         _controlManager.Clear();
                         _controlManager.Initialize(baseInfos.Select(m => PackageBaseInfoToControl(m, false)));
                     }
                 }
             }
         }
         _userConfigution.WindowState.InitEasyImagePath = filePath;
         App.Log.InfoFormat("加载 EasyImage 元文件: {0}", filePath);
     }
     catch (Exception ex)
     {
         App.Log.Error(ex.ToString());
         Extentions.ShowMessageBox("无效的文件,打开失败!");
     }
 }
コード例 #2
0
        public override void UnloadContent()
        {
            // We don't want the clear out to change our selections.
            m_raceCarSelector.SelectionChanged   -= RaceCarSelector_SelectionChanged;
            m_raceTrackSelector.SelectionChanged -= RaceTrackSelector_SelectionChanged;

            m_raceTracks.Clear();
            if (m_uiControlManager != null)
            {
                m_uiControlManager.Clear();
            }
            if (m_content != null)
            {
                m_content.Unload();
                m_content.Dispose();
                m_content = null;
            }

            base.UnloadContent();
        }