예제 #1
0
        void InitializeComponent()
        {
            // calculate the frame sizes
            float navBarHeight    = new UINavigationController().NavigationBar.Bounds.Height;
            float tabBarHeight    = new UITabBarController().TabBar.Bounds.Height;
            float availableHeight = View.Bounds.Height - navBarHeight - tabBarHeight;
            float toolbarHeight   = navBarHeight;
            float tableHeight     = availableHeight - toolbarHeight;

            // create the tableview
            TableView = new UITableView()
            {
                Frame = new RectangleF(0, 0, View.Bounds.Width, tableHeight)
            };
            TableView.BackgroundColor = UIColorHelper.FromString(App.ViewModel.Theme.TableBackground);
            TableView.SeparatorColor  = UIColorHelper.FromString(App.ViewModel.Theme.TableSeparatorBackground);
            this.View.AddSubview(TableView);

            // create the toolbar
            Toolbar = new UIToolbar()
            {
                Frame = new RectangleF(0, tableHeight, View.Bounds.Width, toolbarHeight)
            };
            var flexSpace = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);

            //var addButton = new UIBarButtonItem("\u2795" /* big plus */ + "List", UIBarButtonItemStyle.Plain, delegate {
            var addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add, delegate {
                FolderEditor folderEditor = new FolderEditor(this.NavigationController, null);
                folderEditor.PushViewController();
            });

            var editButton = new UIBarButtonItem(UIBarButtonSystemItem.Edit);
            var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done);

            editButton.Clicked += delegate
            {
                if (TableView.Editing == false)
                {
                    TableView.SetEditing(true, true);
                    Toolbar.SetItems(new UIBarButtonItem[] { flexSpace, addButton, flexSpace, doneButton, flexSpace }, false);
                }
            };
            doneButton.Clicked += delegate
            {
                if (TableView.Editing == true)
                {
                    TableView.SetEditing(false, true);
                    Toolbar.SetItems(new UIBarButtonItem[] { flexSpace, addButton, flexSpace, editButton, flexSpace }, false);

                    // trigger a sync with the Service
                    App.ViewModel.SyncWithService();
                }
            };

            Toolbar.SetItems(new UIBarButtonItem[] { flexSpace, addButton, flexSpace, editButton, flexSpace }, false);
            this.View.AddSubview(Toolbar);
        }
예제 #2
0
        private void InitializeComponent()
        {
            var root = new RootElement("More")
            {
                new Section()
                {
                    new StyledStringElement("Add Folder", delegate
                    {
                        //var form = new FolderEditor(this.NavigationController, null);
                        var form = new FolderEditor(this, null);
                        form.PushViewController();
                    })
                    {
                        Accessory       = UITableViewCellAccessory.DisclosureIndicator,
                        BackgroundColor = UIColorHelper.FromString(App.ViewModel.Theme.TableBackground)
                    },
                    new StyledStringElement("Add List", delegate
                    {
                        //r form = new ListEditor(this.NavigationController, null, null, null);
                        var form = new ListEditor(this, null, null, null);
                        form.PushViewController();
                    })
                    {
                        Accessory       = UITableViewCellAccessory.DisclosureIndicator,
                        BackgroundColor = UIColorHelper.FromString(App.ViewModel.Theme.TableBackground)
                    },
                    new StyledStringElement("Erase All Data", delegate
                    {
                        MessageBoxResult result = MessageBox.Show(
                            "are you sure you want to erase all data on the phone?  unless you connected the phone to an account, your data will be not be retrievable.",
                            "confirm erasing all data",
                            MessageBoxButton.OKCancel);
                        if (result == MessageBoxResult.Cancel)
                        {
                            return;
                        }

                        App.ViewModel.EraseAllData();
                    })
                    {
                        Accessory       = UITableViewCellAccessory.DisclosureIndicator,
                        BackgroundColor = UIColorHelper.FromString(App.ViewModel.Theme.TableBackground)
                    },
                    new StyledStringElement("Debug", DebugPage)
                    {
                        Accessory       = UITableViewCellAccessory.DisclosureIndicator,
                        BackgroundColor = UIColorHelper.FromString(App.ViewModel.Theme.TableBackground)
                    }
                },
            };

            // create and push the dialog view onto the nav stack
            dvc = new DialogViewController(UITableViewStyle.Plain, root);
            dvc.NavigationItem.HidesBackButton = true;
            dvc.Title = NSBundle.MainBundle.LocalizedString("More", "More");
            this.PushViewController(dvc, true);
        }
예제 #3
0
        void InitializeComponent()
        {
            // calculate the frame sizes
            float navBarHeight = new UINavigationController().NavigationBar.Bounds.Height;
            float tabBarHeight = new UITabBarController().TabBar.Bounds.Height;
            float availableHeight = View.Bounds.Height - navBarHeight - tabBarHeight;
            float toolbarHeight = navBarHeight;
            float tableHeight = availableHeight - toolbarHeight;

            // create the tableview
            TableView = new UITableView() { Frame = new RectangleF(0, 0, View.Bounds.Width, tableHeight) };
            TableView.BackgroundColor = UIColorHelper.FromString(App.ViewModel.Theme.TableBackground);
            TableView.SeparatorColor = UIColorHelper.FromString(App.ViewModel.Theme.TableSeparatorBackground);
            this.View.AddSubview(TableView);

            // create the toolbar
            Toolbar = new UIToolbar() { Frame = new RectangleF(0, tableHeight, View.Bounds.Width, toolbarHeight) };
            var flexSpace = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);

            //var addButton = new UIBarButtonItem("\u2795" /* big plus */ + "List", UIBarButtonItemStyle.Plain, delegate {
            var addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add, delegate {
                FolderEditor folderEditor = new FolderEditor(this.NavigationController, null);
                folderEditor.PushViewController();
            });

            var editButton = new UIBarButtonItem(UIBarButtonSystemItem.Edit);
            var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done);
            editButton.Clicked += delegate
            {
                if (TableView.Editing == false)
                {
                    TableView.SetEditing(true, true);
                    Toolbar.SetItems(new UIBarButtonItem[] { flexSpace, addButton, flexSpace, doneButton, flexSpace }, false);
                }
            };
            doneButton.Clicked += delegate
            {
                if (TableView.Editing == true)
                {
                    TableView.SetEditing(false, true);
                    Toolbar.SetItems(new UIBarButtonItem[] { flexSpace, addButton, flexSpace, editButton, flexSpace }, false);

                    // trigger a sync with the Service
                    App.ViewModel.SyncWithService();
                }
            };

            Toolbar.SetItems(new UIBarButtonItem[] { flexSpace, addButton, flexSpace, editButton, flexSpace }, false);
            this.View.AddSubview(Toolbar);
        }
예제 #4
0
        void InitializeComponent()
        {
            // get the current list name
            string listName = null;
            if (listID == null || listID == Guid.Empty)
                listName = Source.Folder.Name;
            else
                listName = Source.Folder.Items.Single(i => i.ID == listID).Name;
            this.Title = listName;

            // calculate the frame sizes
            float navBarHeight =
                parentController.NavigationController != null ?
                parentController.NavigationController.NavigationBar.Bounds.Height :
                new UINavigationController().NavigationBar.Bounds.Height;
            float tabBarHeight =
                parentController.TabBarController.TabBar != null ?
                parentController.TabBarController.TabBar.Bounds.Height :
                new UINavigationController().NavigationBar.Bounds.Height;
            float availableHeight = View.Bounds.Height - navBarHeight - tabBarHeight;
            float toolbarHeight = navBarHeight;
            float tableHeight = availableHeight - toolbarHeight;

            // create the tableview
            TableView = new UITableView() { Frame = new RectangleF(0, 0, View.Bounds.Width, tableHeight) };
            TableView.BackgroundColor = UIColorHelper.FromString(App.ViewModel.Theme.TableBackground);
            TableView.SeparatorColor = UIColorHelper.FromString(App.ViewModel.Theme.TableSeparatorBackground);
            this.View.AddSubview(TableView);

            // create the toolbar - edit button, add button, sort button
            Toolbar = new UIToolbar() { Frame = new RectangleF(0, tableHeight, View.Bounds.Width, toolbarHeight) };
            var flexSpace = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);

            // create the add button
            var addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add, delegate { AddButton_Click(); });

            // create the email button
            var emailButton = CreateEmailButton();

            // create the sort button along with the action, which will instantiate a new DialogViewController
            var sortButton = CreateSortButton();

            // create the edit and done buttons
            // the edit button puts the table in edit mode, and the done button returns to normal mode
            if (editButtonImage == null)
                editButtonImage = UIImageCache.GetUIImage("Images/187-pencil.png");
            var editButton = new UIBarButtonItem(editButtonImage, UIBarButtonItemStyle.Plain, null);
            var doneButton = new UIBarButtonItem(UIBarButtonSystemItem.Done);
            editButton.Clicked += delegate
            {
                if (TableView.Editing == false)
                {
                    TableView.SetEditing(true, true);
                    Toolbar.SetItems(new UIBarButtonItem[] { flexSpace, addButton, flexSpace, sortButton, flexSpace, emailButton, flexSpace, doneButton, flexSpace }, false);
                }
            };
            doneButton.Clicked += delegate
            {
                if (TableView.Editing == true)
                {
                    TableView.SetEditing(false, true);
                    Toolbar.SetItems(new UIBarButtonItem[] { flexSpace, addButton, flexSpace, sortButton, flexSpace, emailButton, flexSpace, editButton, flexSpace  }, false);

                    // trigger a sync with the Service
                    App.ViewModel.SyncWithService();

                    Source.Folder = App.ViewModel.LoadFolder(Source.Folder.ID);
                }
            };

            // create the toolbar with all its buttons
            Toolbar.SetItems(new UIBarButtonItem[] { flexSpace, addButton, flexSpace, sortButton, flexSpace, emailButton, flexSpace, editButton, flexSpace }, false);
            this.View.AddSubview(Toolbar);

            // create the properties right bar button item
            this.NavigationItem.RightBarButtonItem = new UIBarButtonItem("Properties", UIBarButtonItemStyle.Bordered, delegate {
                if (listID == null || listID == Guid.Empty)
                {
                    FolderEditor folderEditor = new FolderEditor(this.NavigationController, Source.Folder);
                    folderEditor.PushViewController();
                }
                else
                {
                    ListEditor listEditor = new ListEditor(this.NavigationController, Source.Folder, Source.List, null);
                    listEditor.PushViewController();
                }
            });
        }
예제 #5
0
        private void InitializeComponent()
        {
            var root = new RootElement("More")
            {
                new Section()
                {
                    new StyledStringElement("Add Folder", delegate
                    {
                        //var form = new FolderEditor(this.NavigationController, null);
                        var form = new FolderEditor(this, null);
                        form.PushViewController();
                    })
                    {
                        Accessory = UITableViewCellAccessory.DisclosureIndicator,
                        BackgroundColor = UIColorHelper.FromString(App.ViewModel.Theme.TableBackground)
                    },
                    new StyledStringElement("Add List", delegate
                    {
                        //r form = new ListEditor(this.NavigationController, null, null, null);
                        var form = new ListEditor(this, null, null, null);
                        form.PushViewController();
                    })
                    {
                        Accessory = UITableViewCellAccessory.DisclosureIndicator,
                        BackgroundColor = UIColorHelper.FromString(App.ViewModel.Theme.TableBackground)
                    },
                    new StyledStringElement("Erase All Data", delegate
                    {
                        MessageBoxResult result = MessageBox.Show(
                            "are you sure you want to erase all data on the phone?  unless you connected the phone to an account, your data will be not be retrievable.",
                            "confirm erasing all data",
                            MessageBoxButton.OKCancel);
                        if (result == MessageBoxResult.Cancel)
                            return;

                        App.ViewModel.EraseAllData();
                    })
                    {
                        Accessory = UITableViewCellAccessory.DisclosureIndicator,
                        BackgroundColor = UIColorHelper.FromString(App.ViewModel.Theme.TableBackground)
                    },
                    new StyledStringElement("Debug", DebugPage)
                    {
                        Accessory = UITableViewCellAccessory.DisclosureIndicator,
                        BackgroundColor = UIColorHelper.FromString(App.ViewModel.Theme.TableBackground)
                    }
                },
            };

            // create and push the dialog view onto the nav stack
            dvc = new DialogViewController(UITableViewStyle.Plain, root);
            dvc.NavigationItem.HidesBackButton = true;
            dvc.Title = NSBundle.MainBundle.LocalizedString ("More", "More");
            this.PushViewController(dvc, true);
        }