コード例 #1
0
ファイル: AccountManager.cs プロジェクト: fiftin/oblqo
 public static AccountManager Load()
 {
     var ret = new AccountManager();
     using (var store = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Assembly, null, null))
     {
         var accountDirs = store.GetDirectoryNames("accounts/*");
         foreach (var dir in accountDirs)
         {
             try
             {
                 using (var stream = store.OpenFile("accounts/" + dir + "/settings.xml", FileMode.Open, FileAccess.Read, FileShare.None))
                 {
                     var serializer = new XmlSerializer(typeof(AccountInfo));
                     var account = (AccountInfo)serializer.Deserialize(stream);
                     ret.Add(account);
                 }
             }
             catch (Exception ex)
             {
                 ret.OnError(ex);
             }
         }
     }
     return ret;
 }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: fiftin/oblqo
        public MainForm()
        {
            InitializeComponent();
            try
            {
                accountManager = AccountManager.Load();
            }
            catch (Exception ex)
            {
                accountManager = new AccountManager();
                OnError(ex);
            }

            fileListView.TaskManager = taskManager;
            taskListView.TaskManager = taskManager;

            taskManager.TaskStateChanged += taskManager_TaskStateChanged;
            taskManager.Exception += xxx_Exception;
            InitUI();
            splitContainer2.SplitterWidth = 7;
            btnNewConnection.Visible = accountManager.Accounts.Count() == 0;
        }