Esempio n. 1
0
        /// <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 };
            }
        }