private UIBarButtonItem[] GetToolBar() { // Add button _addButton = new UIBarButtonItem(); _addButton.Image = UIImage.FromFile("Assets/Images/Toolbar/toolbar_add.png"); _addButton.Title = "Add question"; _addButton.Clicked += delegate { if (Settings.IsFullVersion) { _addEditQuestionController = new AddEditQuestionController(null, _data.Category); NavigationController.PushViewController(_addEditQuestionController, true); } else { if (_data.Questions.Count == 10) { UpgradeView view = new UpgradeView(); view.Show("The free edition is limited to 10 questions."); } else { _addEditQuestionController = new AddEditQuestionController(null, _data.Category); NavigationController.PushViewController(_addEditQuestionController, true); } } }; return(new UIBarButtonItem[] { _addButton }); }
/// <summary> /// Upgrade Apsim Next Generation. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="e">Event arguments.</param> private void OnUpgrade(object sender, EventArgs e) { // Get the version of the current assembly. Version version = Assembly.GetExecutingAssembly().GetName().Version; if (version.Revision == 0) { ShowError("You are on a custom build. You cannot upgrade."); } else { if (this.AllowClose()) { UpgradeView form = new UpgradeView(view as ViewBase); form.Show(); } } }
/// <summary> /// Configures the bottom toolbar. /// </summary> /// <returns></returns> private UIBarButtonItem[] GetToolBar() { int buttonWidth = 45; // Add button _addButton = new UIBarButtonItem(); _addButton.Image = UIImage.FromFile("Assets/Images/Toolbar/toolbar_add.png"); _addButton.Title = "Add category"; _addButton.Width = buttonWidth; _addButton.Clicked += delegate { if (Settings.IsFullVersion) { _addEditCategoryController = new AddEditCategoryController(null); NavigationController.PushViewController(_addEditCategoryController, true); } else { UpgradeView view = new UpgradeView(); view.Show("Only one category is available in the free edition."); } }; // Help button _helpButton = new UIBarButtonItem(); _helpButton.Image = UIImage.FromFile("Assets/Images/Toolbar/toolbar_help.png"); _helpButton.Title = "Help"; _helpButton.Width = buttonWidth; _helpButton.Clicked += delegate { _helpController = new HelpController(); NavigationController.PushViewController(_helpController, true); }; if (Settings.IsFullVersion) { _spacer = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); //_spacer.Width = buttonWidth; // Import button _importButton = new UIBarButtonItem(); _importButton.Image = UIImage.FromFile("Assets/Images/Toolbar/toolbar_import.png"); _importButton.Title = "Import"; _importButton.Width = buttonWidth; _importButton.Clicked += delegate { _importController = new ImportController(); NavigationController.PushViewController(_importController, true); }; // Export button _exportButton = new UIBarButtonItem(); _exportButton.Image = UIImage.FromFile("Assets/Images/Toolbar/toolbar_export.png"); _exportButton.Title = "Export"; _importButton.Width = buttonWidth; _exportButton.Clicked += delegate { _exportController = new ExportController(); NavigationController.PushViewController(_exportController, true); }; // Tips button _tipsButton = new UIBarButtonItem(); _tipsButton.Image = UIImage.FromFile("Assets/Images/Toolbar/toolbar_tips.png"); _tipsButton.Title = "Tips"; _tipsButton.Width = buttonWidth; _tipsButton.Clicked += delegate { _tipsController = new TipsController(); NavigationController.PushViewController(_tipsController, true); }; return(new UIBarButtonItem[] { _addButton, _spacer, _importButton, _spacer, _exportButton, _spacer, _helpButton, _spacer, _tipsButton }); } else { return(new UIBarButtonItem[] { _addButton, _helpButton }); } }
/// <summary> /// Configures the bottom toolbar. /// </summary> /// <returns></returns> private UIBarButtonItem[] GetToolBar() { int buttonWidth = 45; // Add button _addButton = new UIBarButtonItem(); _addButton.Image = UIImage.FromFile("Assets/Images/Toolbar/toolbar_add.png"); _addButton.Title = "Add category"; _addButton.Width = buttonWidth; _addButton.Clicked += delegate { if (Settings.IsFullVersion) { _addEditCategoryController = new AddEditCategoryController(null); NavigationController.PushViewController(_addEditCategoryController, true); } else { UpgradeView view = new UpgradeView(); view.Show("Only one category is available in the free edition."); } }; // Help button _helpButton = new UIBarButtonItem(); _helpButton.Image = UIImage.FromFile("Assets/Images/Toolbar/toolbar_help.png"); _helpButton.Title = "Help"; _helpButton.Width = buttonWidth; _helpButton.Clicked += delegate { _helpController = new HelpController(); NavigationController.PushViewController(_helpController, true); }; if (Settings.IsFullVersion) { _spacer = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace); //_spacer.Width = buttonWidth; // Import button _importButton = new UIBarButtonItem(); _importButton.Image = UIImage.FromFile("Assets/Images/Toolbar/toolbar_import.png"); _importButton.Title = "Import"; _importButton.Width = buttonWidth; _importButton.Clicked += delegate { _importController = new ImportController(); NavigationController.PushViewController(_importController, true); }; // Export button _exportButton = new UIBarButtonItem(); _exportButton.Image = UIImage.FromFile("Assets/Images/Toolbar/toolbar_export.png"); _exportButton.Title = "Export"; _importButton.Width = buttonWidth; _exportButton.Clicked += delegate { _exportController = new ExportController(); NavigationController.PushViewController(_exportController, true); }; // Tips button _tipsButton = new UIBarButtonItem(); _tipsButton.Image = UIImage.FromFile("Assets/Images/Toolbar/toolbar_tips.png"); _tipsButton.Title = "Tips"; _tipsButton.Width = buttonWidth; _tipsButton.Clicked += delegate { _tipsController = new TipsController(); NavigationController.PushViewController(_tipsController, true); }; return new UIBarButtonItem[] { _addButton, _spacer, _importButton, _spacer, _exportButton, _spacer, _helpButton, _spacer, _tipsButton }; } else { return new UIBarButtonItem[] { _addButton, _helpButton }; } }
private UIBarButtonItem[] GetToolBar() { // Add button _addButton = new UIBarButtonItem(); _addButton.Image = UIImage.FromFile("Assets/Images/Toolbar/toolbar_add.png"); _addButton.Title = "Add question"; _addButton.Clicked += delegate { if (Settings.IsFullVersion) { _addEditQuestionController = new AddEditQuestionController(null, _data.Category); NavigationController.PushViewController(_addEditQuestionController, true); } else { if (_data.Questions.Count == 10) { UpgradeView view = new UpgradeView(); view.Show("The free edition is limited to 10 questions."); } else { _addEditQuestionController = new AddEditQuestionController(null, _data.Category); NavigationController.PushViewController(_addEditQuestionController, true); } } }; return new UIBarButtonItem[] { _addButton }; }