void DisconnectUserButton_Click(object sender, EventArgs e) { // if we're connected, this is a disconnect request if (IsConnected) { // if the request queue isn't empty, warn the user if (RequestQueue.GetRequestRecord(RequestQueue.UserQueue) != null) { MessageBoxResult result = MessageBox.Show( "some of the changes you made on the phone haven't made it to your Zaplify account yet. " + "click ok to disconnect now and potentially lose these changes, or cancel the operation", "disconnect now?", MessageBoxButton.OKCancel); if (result == MessageBoxResult.Cancel) { return; } } // process the disconnect App.ViewModel.User = null; App.ViewModel.EraseAllData(); WebServiceHelper.Disconnect(); // reset the settings page accountOperationSuccessful = false; dvc.NavigationController.PopViewControllerAnimated(true); ResignFirstResponder(); CreateRoot(); dvc.ReloadData(); } }
private void CreateUserButton_Click(object sender, RoutedEventArgs e) { // if we're connected, this is a disconnect request if (IsConnected) { // if the request queue isn't empty, warn the user if (RequestQueue.GetRequestRecord(RequestQueue.UserQueue) != null) { MessageBoxResult result = MessageBox.Show( "some of the changes you made on the phone haven't made it to your Zaplify account yet. " + "click ok to disconnect now and potentially lose these changes, or cancel the operation", "disconnect now?", MessageBoxButton.OKCancel); if (result == MessageBoxResult.Cancel) { return; } } // process the disconnect App.ViewModel.User = null; App.ViewModel.EraseAllData(); WebServiceHelper.Disconnect(); // reset the settings page NotifyPropertyChanged("ConnectedMode"); NotifyPropertyChanged("CreateButtonText"); NotifyPropertyChanged("EnableButtons"); Email.IsEnabled = true; Email.Text = ""; Password.IsEnabled = true; Password.Password = ""; accountTextChanged = false; accountOperationSuccessful = false; foreach (var element in SettingsPanel.Children) { // get the listpicker key and value ListPicker listPicker = element as ListPicker; if (listPicker == null) { continue; } listPicker.SelectedIndex = 0; } return; } // validate account info if (String.IsNullOrWhiteSpace(Email.Text) || String.IsNullOrWhiteSpace(Password.Password)) { MessageBox.Show("please enter a valid email address and password"); return; } // process an account creation request User user = new User() { Email = Email.Text, Password = Password.Password }; WebServiceHelper.CreateUser( user, new CreateUserCallbackDelegate(CreateUserCallback), new MainViewModel.NetworkOperationInProgressCallbackDelegate(App.ViewModel.NetworkOperationInProgressCallback)); }