private void ButtonNewAccount_Click(object sender, EventArgs e) { if (m_bAddingAccount == true) { return; } m_bAddingAccount = true; AccountNameInputControl.InputValue = "New Account"; AccountNameInputControl.ShowAndGetItems(); this.MainScrollViewer.IsEnabled = false; this.AccountPicker.IsEnabled = false; }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { /// Check for crashes last time we ran App.CheckForExceptionsLastTime(); using (IsolatedStorageFile storage = IsolatedStorageFile.GetUserStoreForApplication()) { if (storage.FileExists("xmppcred.item") == true) { // Load from storage IsolatedStorageFileStream location = null; try { location = new IsolatedStorageFileStream("xmppcred.item", System.IO.FileMode.Open, storage); DataContractSerializer ser = new DataContractSerializer(typeof(List <XMPPAccount>)); Accounts = ser.ReadObject(location) as List <XMPPAccount>; } catch (Exception) { } finally { if (location != null) { location.Close(); } } } } if (Accounts.Count <= 0) { this.m_bAddingAccount = true; AccountNameInputControl.InputValue = "New Account"; AccountNameInputControl.ShowAndGetItems(); this.MainScrollViewer.IsEnabled = false; this.AccountPicker.IsEnabled = false; base.OnNavigatedTo(e); return; } this.AccountPicker.ItemsSource = Accounts; this.AccountPicker.SelectedItem = Accounts[0]; //this.AccountPicker.SelectedItem = App.XMPPClient.XMPPAccount; /// can't do this until we hash/equal by name, base.OnNavigatedTo(e); }