示例#1
0
 public void Load(string path)
 {
     if (!File.Exists(path))
     {
         if (path == null)
         {
             path = "Config/UserConfig.xml";
         }
         path = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, path);
         if (!File.Exists(path))
         {
             return;
         }
     }
     DataFilePath = path;
     try
     {
         using (var fs = new FileStream(path, FileMode.Open))
         {
             var xmldes = new XmlSerializer(typeof(UserConfig));
             var config = (UserConfig)xmldes.Deserialize(fs);
             _imageSetting    = config._imageSetting;
             _windowState     = config._windowState;
             _appSetting      = config.AppSetting;
             _shortcutSetting = config.ShortcutSetting;
         }
     }
     catch (Exception ex)
     {
         App.Log.Error(ex.ToString());
     }
 }
示例#2
0
 public UserConfig()
 {
     _imageSetting    = new ImageSetting();
     _windowState     = new WindowState();
     _appSetting      = new AppSetting();
     _shortcutSetting = new ShortcutSetting();
 }