public void SaveTask() { context.Fetch(); currentTask = new Task(); currentTask.Id = taskDialog.Id; currentTask.Title = taskDialog.Name; currentTask.Description = taskDialog.Description; currentTask.Completed = taskDialog.Completed; NavigationController.PopViewController(true); CognitoSyncUtils.SaveTask(currentTask); currentTask = null; }
public async Task SaveTask() { context.Fetch(); // re-populates with updated values currentItem.Name = taskDialog.Name; currentItem.Notes = taskDialog.Notes; currentItem.Reward = Int32.Parse(taskDialog.Reward); // TODO: show the completion status in the UI currentItem.Done = taskDialog.Done; await AppDelegate.Current.TodoContractClient.SaveItem(currentItem); NavigationController.PopViewController(true); }
// When the Update button is clicked, update our published Message public void UpdateMessage() { // Retrieves updated data from UI context.Fetch(); // Remove our last message from MonoTouch Dialog if (myMessage != null) { RemoveMonkeyMessage(myMessage); } // Create new Nearby message to publish with the list choices myMessage = new EmotionMessage { UserId = userId, Name = dialog.Names.ElementAt(dialog.CurrentName), Species = dialog.Species.ElementAt(dialog.CurrentSpecie), Emotion = dialog.Emotions.ElementAt(dialog.CurrentEmotion) }; // Unpublish message, if we already published a message Unpublish(myMessage); // Publish the new message Publish(myMessage); }
public void RegisterNewAccount() { context.Fetch(); var email = newAccountData.Email; var password = newAccountData.Password; var passwordVerify = newAccountData.PasswordVerify; if (string.IsNullOrWhiteSpace(email) || string.IsNullOrWhiteSpace(password) || string.IsNullOrWhiteSpace(passwordVerify)) { AppDelegate.ShowMessage("Hey!", "Seems that some information is missing...", NavigationController); return; } if (password != passwordVerify) { AppDelegate.ShowMessage("Hey!", "Passwords don't match. Please, verify.", NavigationController); return; } indicatorView.StartAnimating(); View.EndEditing(true); Auth.DefaultInstance.CreateUser(email, password, CreateUserOnCompletion); }
public EditAccount(IAccountContainer container, TwitterAccount account, bool pushing) { var info = new AccountInfo(); bool newAccount = account == null; if (newAccount) { account = new TwitterAccount(); } else { info.Login = account.Username; //info.Password = account.Password; } var bc = new BindingContext(this, info, Locale.GetText("Edit Account")); var dvc = new DialogViewController(bc.Root, true); PushViewController(dvc, false); UIBarButtonItem done = null; done = new UIBarButtonItem(UIBarButtonSystemItem.Done, delegate { bc.Fetch(); done.Enabled = false; CheckCredentials(info, delegate(string errorMessage) { Util.PopNetworkActive(); done.Enabled = true; if (errorMessage == null) { account.Username = info.Login; //account.Password = info.Password; lock (Database.Main){ if (newAccount) { Database.Main.Insert(account); } else { Database.Main.Update(account); } } account.SetDefaultAccount(); DismissModalViewControllerAnimated(true); container.Account = account; } else { dlg = new UIAlertView(Locale.GetText("Login error"), errorMessage, null, Locale.GetText("Close")); dlg.Show(); } }); }); dvc.NavigationItem.SetRightBarButtonItem(done, false); }
public void SaveTask() { context.Fetch(); // re-populates with updated values currentTask.Name = taskDialog.Name; currentTask.Notes = taskDialog.Notes; TaskManager.SaveTask(currentTask); NavigationController.PopViewControllerAnimated(true); }
public void SaveTask() { context.Fetch(); TaskManager.SaveTask(currentTask); NavigationController.PopViewControllerAnimated(true); }
public void SaveCategory() { context.Fetch(); CategoryManager.SaveCategory(currentCategory); NavigationController.PopViewControllerAnimated(true); }
public void Login() { context.Fetch(); var email = passwordData.Email; var password = passwordData.Password; if (string.IsNullOrWhiteSpace(email) || string.IsNullOrWhiteSpace(password)) { AppDelegate.ShowMessage("Hey!", "Seems that some information is missing...", NavigationController); return; } indicatorView.StartAnimating(); View.EndEditing(true); auth.SignIn(email, password, SignInOnCompletion); }
public void SaveTask() { context.Fetch(); // re-populates with updated values currentItem.Name = taskDialog.Name; currentItem.Notes = taskDialog.Notes; // TODO: show the completion status in the UI currentItem.Done = taskDialog.Done; TodoItemManager.SaveTask(currentItem); NavigationController.PopViewController(true); }
public async void SaveTask() { context.Fetch(); // re-populates with updated values currentTask.Name = taskDialog.Name; currentTask.Notes = taskDialog.Notes; currentTask.Done = taskDialog.Done; await TodoManager.SaveTaskAsync(currentTask); NavigationController.PopViewController(true); }
public void SaveTask() { context.Fetch(); // re-populates with updated values currentTask.Name = taskDialog.Name; currentTask.Notes = taskDialog.Notes; TodoService.SaveTodo(currentTask).ContinueWith(res => { Console.WriteLine("SAVED"); }); NavigationController.PopViewController(true); }
public void DemoReflectionApi() { if (settings == null) { var image = UIImage.FromFile("monodevelop-32.png"); settings = new Settings() { AccountEnabled = true, Login = "******", TimeSamples = new TimeSettings() { Appointment = DateTime.Now, Birthday = new DateTime(1980, 6, 24), Alarm = new DateTime(2000, 1, 1, 7, 30, 0, 0) }, FavoriteType = TypeCode.Int32, Top = image, Middle = image, Bottom = image, ListOfString = new List <string> () { "One", "Two", "Three" } }; } var bc = new BindingContext(null, settings, "Settings"); var dv = new DialogViewController(bc.Root, true); // When the view goes out of screen, we fetch the data. dv.ViewDisappearing += delegate { // This reflects the data back to the object instance bc.Fetch(); // Manly way of dumping the data. Console.WriteLine("Current status:"); Console.WriteLine( "AccountEnabled: {0}\n" + "Login: {1}\n" + "Password: {2}\n" + "Name: {3}\n"+ "Appointment: {4}\n" + "Birthday: {5}\n" + "Alarm: {6}\n" + "Favorite Type: {7}\n" + "IEnumerable idx: {8}", settings.AccountEnabled, settings.Login, settings.Password, settings.Name, settings.TimeSamples.Appointment, settings.TimeSamples.Birthday, settings.TimeSamples.Alarm, settings.FavoriteType, settings.selected); }; navigation.PushViewController(dv, true); }
public void SaveTask() { context.Fetch(); // re-populates with updated values currentItem.Name = taskDialog.Name; currentItem.Notes = taskDialog.Notes; // TODO: show the completion status in the UI currentItem.Done = taskDialog.Done; AppDelegate.Current.TodoManager.SaveTask(currentItem); Analytics.TrackEvent("Saved new TodoItem", AnalyticsHelper.ConstructProperties(currentItem)); NavigationController.PopViewController(true); }
public void PostUserProperty() { context.Fetch(); if (string.IsNullOrWhiteSpace(userProperty.Name)) { AppDelegate.ShowMessage("Empty Property Name", "Hey! We need a name to post!", this); return; } var value = string.IsNullOrWhiteSpace(userProperty.Value) ? userProperty.Value : null; Analytics.SetUserProperty(value, userProperty.Name); AppDelegate.ShowMessage("User Property Posted!", string.Empty, this); }
//using the reflection api to edit a single bank void EditBank(Bank bank) { var context = new BindingContext(this, bank, "Edit " + bank.Name); //make a dialog view controller (UITableView descendant) var dvc = new DialogViewController(context.Root, true); //setup a button, so we can have a save function dvc.NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Save, (o, e) => { context.Fetch(); NavigationController.PopViewControllerAnimated(true); ReloadData(); }); NavigationController.PushViewController(dvc, true); }
public void FetchTweets() { if (Busy) { return; } Busy = true; // Fetch the edited values. context.Fetch(); var request = (HttpWebRequest)WebRequest.Create("http://twitter.com/statuses/friends_timeline.xml"); request.Credentials = new NetworkCredential(account.Username, account.Password); request.BeginGetResponse(TimeLineLoaded, request); }
/// <summary> /// Saves the task. /// </summary> public void SaveTask() { context.Fetch(); // re-populates with updated values currentTask.Name = taskDialog.Name; currentTask.Notes = taskDialog.Notes; currentTask.Done = taskDialog.Done; currentTask.Assignee = taskDialog.Assignees[taskDialog.CurrentAssignee]; ///////////////////// // Save task to Azure Mobile Services // This is an async method so the mobile app will simply continue on. ///////////////////// TaskManager.Instance.Insert(currentTask); NavigationController.PopViewControllerAnimated(true); // context.Dispose (); // documentation suggests this is required, but appears to cause a crash sometimes }
public override void ViewWillDisappear(bool animated) { base.ViewWillDisappear(animated); bool previousShowImages = Settings.Current.UserSettings.ImagesEnabled; // Update the UserSettings singleton _bindingContext.Fetch(); // Trigger all feeds reloading again - only if it was false beforehand (as we need the images HTML). // If the setting was previously TRUE and we're switching to FALSE, we already have the content and don't need to update again. if (previousShowImages == false && Settings.Current.UserSettings.ImagesEnabled) { Settings.Current.ClearCache(true); } // Persist the controller name for next load Settings.Current.LastControllerId = "Settings"; }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { window = new UIWindow(UIScreen.MainScreen.Bounds); //create our model var account = new AccountInfoModel(); //we could also do this //account.Login = "******"; //account.Password = "******"; //create a context. passing (in order) // account: this is where OnTap callbacks go to. This could be any other class, it doesn't have to be the same one // account: this is the model we are going to be populating // "...": the title of the list var context = new BindingContext(account, account, "Account"); //make a dialog view controller (UITableView descendant) var dvc = new DialogViewController(context.Root, false); //setup a button, so we can have a save function dvc.NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Save, (o, e) => { context.Fetch(); var alert = new UIAlertView("Thanks!", string.Format("Thanks {0}. Your secret handshake is {1}.\nHave a nice flight in the {2}", account.Login, account.Password, account.Preference.ToString()), null, "Ok"); alert.Show(); }); //wrap it all up in a UINavigationController window.RootViewController = new UINavigationController(dvc); window.MakeKeyAndVisible(); return(true); }
// This method is invoked when the application has loaded its UI and its ready to run public override bool FinishedLaunching(UIApplication app, NSDictionary options) { window.AddSubview(navigationController.View); Library.CustomerEdit.BeginNewCustomer(Csla.DataPortal.ProxyModes.LocalOnly, (o, e) => { if (e.Error == null) { var customer = e.Object; // Now make sure we invoke on the main thread the updates navigationController.InvokeOnMainThread(delegate { var context = new BindingContext(this, customer, "Simple App"); customerViewController = new DialogViewController(context.Root, true); // When the view goes out of screen, we fetch the data. customerViewController.ViewDissapearing += delegate { // This reflects the data back to the object instance context.Fetch(); Console.WriteLine("Customer Name: {0}", customer.Name); Console.WriteLine("Date of Birth: {0}", customer.BirthDate); Console.WriteLine("Status: {0}", customer.Status); }; navigationController.PushViewController(customerViewController, true); }); } else { throw e.Error; } }); window.MakeKeyAndVisible(); return(true); }
public override void ViewDidAppear(bool animated) { base.ViewDidAppear(animated); Context.Fetch(); }