public void Building() { if (building == null){ building = new Building () { AccountEnabled = true, ListOfString = new List<string> () { "One", "Two", "Three" } }; } var bc = new BindingContext (null, building, "Building"); 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 ( "Name: {0}\n" + "IEnumerable idx: {1}", building.Name, building.selected); }; navigation.PushViewController (dv, true); }
public EditPropertiesController(AppProperties appProperties) : base(null, true) { _appProperties = appProperties; _bctx = new BindingContext (null, _appProperties, "Properties"); this.Root = _bctx.Root; }
/// <summary> /// Required by MonoTouch.Dialog /// </summary> public SettingsController(RootElement root) : base(root) { _bindingContext = new BindingContext(this, Settings.Current.UserSettings, "Settings"); Root = _bindingContext.Root; ReloadData(); }
protected void ShowTaskDetails(Task task) { currentTask = task; taskDialog = new TaskDialog (task); context = new BindingContext (this, taskDialog, "Task Details"); detailsScreen = new DialogViewController (context.Root, true); ActivateController(detailsScreen); }
protected void ShowTaskDetails(TodoItem item) { currentItem = item; taskDialog = new TodoItemDialog (currentItem); context = new BindingContext (this, taskDialog, "Task Details"); detailsScreen = new DialogViewController (context.Root, true); ActivateController(detailsScreen); }
public void Display () { _contact = new ContactInfo (); _context = new BindingContext (this, _contact, "Kontakt"); _viewController = new LbkDialogViewController (_context.Root, true); _viewController.TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; _navigation.PushViewController (_viewController, true); }
// // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { window = new UIWindow(UIScreen.MainScreen.Bounds); Util.VisualMode = VisualMode.None; //Util.VisualMode = VisualMode.TintColor; //Util.VisualMode = VisualMode.UIAppearance; AppearanceManager.SetAppearance(); UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.BlackOpaque; tabBar = new UITabBarController(); loginDvc = new LoginDialogViewController(); //have a look at the ExpenseModel class to see why it's hard to do // theming on MonoTouch.Dialog auto-generated stuff var expense = new ExpenseModel(); var context = new BindingContext(null, expense, "Expenses"); expenseDvc = new BaseDialogViewController(context.Root); expenseDvc.Title = "Expenses"; var tabControllers = new UINavigationController[] { new UINavigationController(loginDvc) { TabBarItem = new UITabBarItem("Login", Resources.Padlock, 1) }, new UINavigationController(expenseDvc) { TabBarItem = new UITabBarItem("Expenses", Resources.Expense, 2) } /* new UINavigationController(deadlines) { TabBarItem = new UITabBarItem("Deadlines", Resources.Deadlines, 2) }, new UINavigationController(reports) { TabBarItem = new UITabBarItem("Reports", Resources.Deadlines, 4) }, new UINavigationController(you) { TabBarItem = new UITabBarItem("You", Resources.You, 3) } */ }; tabBar.SetViewControllers(tabControllers, false); window.RootViewController = tabBar; window.MakeKeyAndVisible (); return true; }
protected void ShowTaskDetails(TodoItem item) { transaction = TodoItemManager.BeginTransaction(); item = item ?? TodoItemManager.CreateTodoItem(); currentItem = item; taskDialog = new TodoItemDialog (currentItem); context = new BindingContext (this, taskDialog, "Task Details"); detailsScreen = new DialogViewController (context.Root, true); ActivateController(detailsScreen); }
private void Startup () { using (var pool = new NSAutoreleasePool()) { InvokeOnMainThread(delegate { var binding = new BindingContext(new MovieListView(), "MVVM Samples"); navigation.ViewControllers = new UIViewController[] { new DialogViewController(binding, true) }; }); } }
public void SampleMenu() { account = new AccountInfo (); context = new BindingContext (this, account, "Settings"); if (dynamic != null) dynamic.Dispose (); dynamic = new DialogViewController (context.Root, true); navigation.PushViewController (dynamic, 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) { Customer c = new Customer (); var b = new BindingContext (null, c, "Create a Customer"); DialogViewController dvc = new DialogViewController (b.Root); window.AddSubview (dvc.View); window.MakeKeyAndVisible (); return true; }
public TODOViewController() : base(UITableViewStyle.Plain, null) { NavigationItem.SetRightBarButtonItem(new UIBarButtonItem(UIBarButtonSystemItem.Add), false); NavigationItem.RightBarButtonItem.Clicked += (sender, e) => { taskDialog = new TaskDialog() { Id = Guid.NewGuid().ToString() }; context = new BindingContext(this, taskDialog, "New Task"); detailsScreen = new DialogViewController(context.Root, true); ActivateController(detailsScreen); }; }
public override bool FinishedLaunching (UIApplication app, NSDictionary options) { window = new UIWindow (UIScreen.MainScreen.Bounds); var expense = new Expense (); var bctx = new BindingContext (null, expense, "Create a task"); var dvc = new DialogViewController (bctx.Root); nav = new UINavigationController(dvc); window.RootViewController = nav; window.MakeKeyAndVisible (); return true; }
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); }
//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 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 static void ShowCredentialDetails(Credential credential, UIViewController controller, UITableView tableView) { bool isNew = credential.Id == 0; var binding = new BindingContext(null, credential, isNew ? "Add Credential" : credential.Name); var dialogViewController = new DialogViewController(binding.Root); if ( controller is UINavigationController ) { var navController = (controller as UINavigationController); navController.PushViewController(dialogViewController, true); navController.NavigationBarHidden = false; UIBarButtonItem addButton = new UIBarButtonItem (UIBarButtonSystemItem.Save); dialogViewController.NavigationItem.HidesBackButton = false; dialogViewController.NavigationItem.RightBarButtonItem = addButton; addButton.Clicked += (sender, e) => { binding.Fetch(); binding.Root.Caption = credential.Name; if (ClientInterface.SaveCredential(credential) && tableView != null) { tableView.ReloadData(); } navController.PopViewControllerAnimated(true); }; } else { controller.PresentModalViewController(dialogViewController, true); } }
public void DemoReflectionApi () { if (s == null){ s = new Settings () { AccountEnabled = true, Login = "******", Appointment = DateTime.Now, Birthday = new DateTime (1980, 6, 24), Alarm = new DateTime (2000, 1, 1, 7, 30, 0, 0), FavoriteType = TypeCode.Int32 }; } var bc = new BindingContext (s, "Settings"); var dv = new DialogViewController (bc.Root, true); // When the view goes out of screen, we fetch the data. dv.ViewDissapearing += 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" + "Appointment: {3}\n" + "Birthday: {4}\n" + "Alarm: {5}\n" + "Favorite Type: {6}\n", s.AccountEnabled, s.Login, s.Password, s.Appointment, s.Birthday, s.Alarm, s.FavoriteType); }; navigation.PushViewController (dv, 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 cb = new Callbacks(); var bc = new BindingContext (cb, settings, "Settings"); cb.Initalize(bc); 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}\n" + "I like ice cream: {9}\n" + "I like veggies: {10}\n" + "Animal kinds: {11}\n" + "Animal sizes: {12}", settings.AccountEnabled, settings.Login, settings.Password, settings.Name, settings.TimeSamples.Appointment, settings.TimeSamples.Birthday, settings.TimeSamples.Alarm, settings.FavoriteType, settings.selected, settings.LikeIceCream, settings.LikeVegetables, settings.Kinds, settings.Sizes); }; navigation.PushViewController (dv, true); }
public void Initalize (BindingContext context) { _context = context; foreach (Element el in _context.GetElementsForTag("animals")) { var chkEl = el as CheckboxElement; if (chkEl != null) chkEl.Tapped += UpdateCatsAndDogs; } }
public DialogViewController (BindingContext binding, bool pushing) : base(UITableViewStyle.Grouped) { if(binding == null) throw new ArgumentNullException("binding"); this.pushing = pushing; PrepareRoot(binding.Root); }
public void LoadMonoTouchDialog() { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); var bc = new BindingContext(this, Settings.Current.UserSettings, "Settings"); stopwatch.Stop(); Logger.Info("StartupLoader.LoadMonoTouchDialog took {0}ms", stopwatch.ElapsedMilliseconds); }