Inheritance: UITableViewController
Exemplo n.º 1
0
            public override bool SelectItem(object item)
            {
                if (item == addStorage)
                {
                    var chooseProviderForm = new PForm("Add Storage");
                    chooseProviderForm.Sections.Add(new FileSystemProvidersSection());

                    Form.NavigationController.PushViewController(chooseProviderForm, true);

                    return(true);
                }

                var fs = item as IFileSystem;

                SetNeedsFormat();

                Form?.DismissAsync(true).ContinueWith(t => {
                    if (t.IsFaulted)
                    {
                        Log.Error(t.Exception);
                    }
                });
                DocumentAppDelegate.Shared.SetFileSystemAsync(fs, true).ContinueWith(t => {
                    if (t.IsFaulted)
                    {
                        Log.Error(t.Exception);
                    }
                });

                return(true);
            }
Exemplo n.º 2
0
        public static UIActionSheet ToActionSheet(this PForm form)
        {
            var q = from s in form.Sections
                    from i in s.Items
                    let c = i as Command
                            where c != null
                            select c;
            var actions = q.ToList();

            var ActionSheet = new UIActionSheet(form.Title);

            foreach (var a in actions)
            {
                ActionSheet.Add(a.Name);
            }

            ActionSheet.CancelButtonIndex = ActionSheet.ButtonCount - 1;

            ActionSheet.Clicked += async(ss, se) => {
                var index = (int)se.ButtonIndex;
                if (0 <= index && index < actions.Count)
                {
                    try {
                        await actions[index].ExecuteAsync();
                    } catch (Exception ex) {
                        Console.WriteLine("Failed to execute action: " + ex);
                    }
                }
            };

            return(ActionSheet);
        }
Exemplo n.º 3
0
            public override bool SelectItem(object item)
            {
                if (item == addStorage)
                {
                    var chooseProviderForm = new PForm("Add Storage");
                    chooseProviderForm.Sections.Add(new FileSystemProvidersSection());

                    Form.NavigationController.PushViewController(chooseProviderForm, true);

                    return(true);
                }

                var fs = item as IFileSystem;

                SetNeedsFormat();
                if (Form != null)
                {
                    Form.DismissAsync(true);
                }
                DocumentAppDelegate.Shared.SetFileSystemAsync(fs, true);

                return(true);
            }
 public FormSource(PForm controller)
 {
     this.controller = controller;
 }
Exemplo n.º 5
0
			public override bool SelectItem (object item)
			{
				if (item == addStorage) {

					var chooseProviderForm = new PForm ("Add Storage");
					chooseProviderForm.Sections.Add (new FileSystemProvidersSection ());

					Form.NavigationController.PushViewController (chooseProviderForm, true);

					return true;
				}

				var fs = item as IFileSystem;
				SetNeedsFormat ();
				if (Form != null)
					Form.DismissAsync (true);
				DocumentAppDelegate.Shared.SetFileSystemAsync (fs, true);

				return true;
			}
			public FormSource (PForm controller)
			{
				this.controller = controller;
			}