Example #1
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath indexPath)
        {
            var root = (RootElement)Parent.Parent;
            root.RadioSelected = RadioIdx;

            base.Selected(dvc, tableView, indexPath);
        }
	private void Core()
	{
		var rootStyles = new RootElement ("Add New Styles");

		var styleHeaderElement = new Section ("Style Header");
		var manualEntryRootElement = new RootElement ("Manual Entry");
		styleHeaderElement.Add (manualEntryRootElement);

		var quickFillElement = new Section ("Quick Fill");
		var womenTops = new RootElement ("Womens Tops");
		var womenOutwear = new RootElement ("Womens Outerwear");
		var womenSweaters = new RootElement ("Womens Sweaters");
		quickFillElement.AddAll (new [] { womenTops, womenOutwear, womenSweaters });

		rootStyles.Add (new [] { styleHeaderElement, quickFillElement });

		// DialogViewController derives from UITableViewController, so access all stuff from it
		var rootDialog = new DialogViewController (rootStyles);
		rootDialog.NavigationItem.BackBarButtonItem = new UIBarButtonItem("Back", UIBarButtonItemStyle.Bordered, null);

		EventHandler handler = (s, e) => {
			if(_popover != null)
				_popover.Dismiss(true);
		};

		rootDialog.NavigationItem.SetLeftBarButtonItem(new UIBarButtonItem("Cancel", UIBarButtonItemStyle.Bordered, handler), true);
		rootDialog.NavigationItem.SetRightBarButtonItem(new UIBarButtonItem("Create", UIBarButtonItemStyle.Bordered, null), true);

		NavigationPopoverContentViewController = new UINavigationController (rootDialog);
	}
Example #3
0
	UIViewController StyleTransactionsScreen (RootElement arg)
	{
		var dvc = new DialogViewController (UITableViewStyle.Plain, arg,true);
		dvc.LoadView ();
		dvc.Root.TableView.SeparatorColor = UIColor.FromPatternImage (Resources.CellSeparator);
		dvc.Root.TableView.BackgroundView = new UIImageView (UIImage.FromBundle ("paper.png"));

		return dvc;
	}
Example #4
0
        void Initialize(UITableViewStyle navigationStyle = UITableViewStyle.Plain)
        {
            DisableStatusBarMoving = true;
            statusImage            = new UIView {
                ClipsToBounds = true
            }.SetAccessibilityId("statusbar");
            navigation              = new DialogViewController(navigationStyle, null);
            navigation.OnSelection += NavigationItemSelected;
            RectangleF navFrame = navigation.View.Frame;

            navFrame.Width = menuWidth;
            if (Position == FlyOutNavigationPosition.Right)
            {
                navFrame.X = mainView.Frame.Width - menuWidth;
            }
            navigation.View.Frame = navFrame;
            View.AddSubview(navigation.View);
            //SearchBar = new UISearchBar(new RectangleF(0, 0, navigation.TableView.Bounds.Width, 44))
            //	{
            //		//Delegate = new SearchDelegate (this),
            //		TintColor = TintColor
            //	};

            TintColor = UIColor.Black;
            var version = new System.Version(UIDevice.CurrentDevice.SystemVersion);

            isIos7 = version.Major >= 7;
            if (isIos7)
            {
                navigation.TableView.TableHeaderView = new UIView(new RectangleF(0, 0, 320, 22))
                {
                    BackgroundColor = UIColor.Clear
                }
            }
            ;
            navigation.TableView.TableFooterView = new UIView(new RectangleF(0, 0, 100, 100))
            {
                BackgroundColor = UIColor.Clear
            };
            navigation.TableView.ScrollsToTop = false;
            shadowView = new UIView();
            shadowView.BackgroundColor     = UIColor.White;
            shadowView.Layer.ShadowOffset  = new SizeF(Position == FlyOutNavigationPosition.Left ? -5 : 5, -1);
            shadowView.Layer.ShadowColor   = UIColor.Black.CGColor;
            shadowView.Layer.ShadowOpacity = .75f;
            closeButton = new UIButton();
            closeButton.TouchUpInside += delegate { HideMenu(); };
            AlwaysShowLandscapeMenu    = true;

            View.AddGestureRecognizer(new OpenMenuGestureRecognizer(DragContentView, shouldReceiveTouch));
        }
Example #5
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window = new UIWindow(UIScreen.MainScreen.Bounds);

            var message     = new EntryElement("Message", "Type your message here", "");
            var sendMessage = new StyledStringElement("Send Message")
            {
                Alignment       = UITextAlignment.Center,
                BackgroundColor = UIColor.Green
            };
            var receivedMessages = new Section();
            var root             = new RootElement("")
            {
                new Section()
                {
                    message, sendMessage
                },
                receivedMessages
            };

            var connection = new Connection("http://localhost:8081/echo");

            sendMessage.Tapped += delegate
            {
                if (!string.IsNullOrWhiteSpace(message.Value) && connection.State == ConnectionState.Connected)
                {
                    connection.Send("iOS: " + message.Value);

                    message.Value = "";
                    message.ResignFirstResponder(true);
                }
            };

            connection.Received += data =>
            {
                InvokeOnMainThread(() =>
                                   receivedMessages.Add(new StringElement(data)));
            };


            connection.Start().ContinueWith(task =>
                                            connection.Send("iOS: Connected"));

            var viewController = new DialogViewController(root);

            window.RootViewController = viewController;

            window.MakeKeyAndVisible();

            return(true);
        }
Example #6
0
        //
        // 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);

            _quantityGroup = new RadioGroup("Qty", 0);
            _fromUnitGroup = new RadioGroup("FromU", 0);
            _toUnitGroup   = new RadioGroup("ToU", 0);

            var quantityRootElement = new RootElement("Quantity", _quantityGroup)
            {
                new Section()
            };

            quantityRootElement[0].AddAll(QuantityCollection.Quantities.Select(qty => {
                var elem         = new EventHandlingRadioElement(qty.Quantity.ToString(), "Qty");
                elem.OnSelected += OnQuantitySelected;
                return(elem as Element);
            }));

            _rootElement = new RootElement("Unit Converter")
            {
                new Section()
                {
                    quantityRootElement
                },
                new Section("From")
                {
                    new EntryElement("Amount", string.Empty, string.Empty),
                    new RootElement("Unit", _fromUnitGroup)
                    {
                        new Section()
                    }
                },
                new Section("To")
                {
                    new EntryElement("Amount", string.Empty, string.Empty),
                    new RootElement("Unit", _toUnitGroup)
                    {
                        new Section()
                    }
                }
            };

            _rootVC = new DialogViewController(_rootElement);
            _nav    = new UINavigationController(_rootVC);

            _window.RootViewController = _nav;
            _window.MakeKeyAndVisible();

            return(true);
        }
Example #7
0
        public static void ReportError(UIViewController current, Exception e, string msg)
        {
            if (current == null)
            {
                throw new ArgumentNullException("current");
            }

            var root = new RootElement(Locale.GetText("Error"))
            {
                new Section(Locale.GetText("Error"))
                {
                    new StyledStringElement(msg)
                    {
                        Font = UIFont.BoldSystemFontOfSize(14),
                    }
                }
            };

            if (e != null)
            {
                root.Add(new Section(e.GetType().ToString())
                {
                    new StyledStringElement(e.Message)
                    {
                        Font = UIFont.SystemFontOfSize(14),
                    }
                });
                root.Add(new Section("Stacktrace")
                {
                    new StyledStringElement(e.ToString())
                    {
                        Font = UIFont.SystemFontOfSize(14),
                    }
                });
            }
            ;

            // Delay one second, as UIKit does not like to present
            // views in the middle of an animation.
            NSTimer.CreateScheduledTimer(TimeSpan.FromSeconds(1), delegate {
                UINavigationController nav           = null;
                DialogViewController dvc             = new DialogViewController(root);
                dvc.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Locale.GetText("Close"), UIBarButtonItemStyle.Plain, delegate {
                    nav.DismissModalViewControllerAnimated(false);
                });

                nav = new UINavigationController(dvc);
                current.PresentModalViewController(nav, false);
            });
        }
Example #8
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            tableView.DeselectRow(path, true);

            var av = new UIAlertView("Save to Album?", "Would you like to save this barcode to your photo album?", null, "No", "Yes");

            av.Clicked += (sender, e) => {
                if (e.ButtonIndex == 1)
                {
                    this.barcodeImg.SaveToPhotosAlbum(null);
                }
            };
            av.Show();
        }
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            _window = new UIWindow(UIScreen.MainScreen.Bounds);

            _rootElement = new RootElement("To Do List")
            {
                new Section()
            };

            _rootVC = new DialogViewController(_rootElement);
            _nav    = new UINavigationController(_rootVC);

            _addButton = new UIBarButtonItem(UIBarButtonSystemItem.Add);
            _rootVC.NavigationItem.RightBarButtonItem = _addButton;

            _addButton.Clicked += (sender, e) => {
                ++n;

                var task = new Task {
                    Name = "task " + n, DueDate = DateTime.Now
                };

                var element = new EntryElement(task.Name, "Enter task description", task.Description);

                var dateElement = new FutureDateElement("Due Date", task.DueDate);

                var taskElement = (Element) new RootElement(task.Name)
                {
                    new Section()
                    {
                        element
                    },
                    new Section()
                    {
                        dateElement
                    },
                    new Section("Demo Retrieving Element Value")
                    {
                        new StringElement("Output Task Description",
                                          delegate { Console.WriteLine(element.Value); })
                    }
                };
                _rootElement [0].Add(taskElement);
            };

            _window.RootViewController = _nav;
            _window.MakeKeyAndVisible();

            return(true);
        }
Example #10
0
        UIViewController MakeOptions()
        {
            var options = new DialogViewController(new RootElement("Options")
            {
                new Section("Active Chats")
                {
                    new RootElement("Chat with a Robot", x => new ChatWithRobot().ChatViewController),
                    new RootElement("Chat with Mom", x => new ChatWithMom().ChatViewController),
                    new RootElement("Chat with a Robot vs Robot", x => new ChatWithRobotVsRobot().ChatViewController),
                }
            });

            return(new UINavigationController(options));
        }
Example #11
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            var vc = new MyViewController(this)
            {
                Autorotate = dvc.Autorotate
            };

            datePicker       = CreatePicker();
            datePicker.Frame = PickerFrameWithSize(datePicker.SizeThatFits(SizeF.Empty));

            vc.View.BackgroundColor = UIColor.Black;
            vc.View.AddSubview(datePicker);
            dvc.ActivateController(vc);
        }
Example #12
0
		/// <summary>
		/// Locates this instance of this Element within a given DialogViewController.
		/// </summary>
		/// <returns>The Section instance and the index within that Section of this instance.</returns>
		/// <param name="dvc">Dvc.</param>
		private KeyValuePair<Section, int> GetMySectionAndIndex(DialogViewController dvc)
		{
			foreach (var section in dvc.Root)
			{
				for (int i = 0; i < section.Count; i++)
				{
					if (section[i] == this)
					{
						return new KeyValuePair<Section, int>(section, i);
					}
				}
			}
			return new KeyValuePair<Section, int>();
		}
Example #13
0
        protected void ShowUserAndProfile()
        {
            var root = new RootElement("User & Profile")
            {
                new Section()
                {
                    new StringElement("User Id", User.UserID.ToString()),
                    new StringElement("Name", Profile.Name)
                }
            };
            var vc = new DialogViewController(UITableViewStyle.Grouped, root, false);

            viewController.NavigationController.TopViewController.PresentViewController(vc, false, null);
        }
        public void DemoDynamic()
        {
            account = new AccountInfo();

            context = new BindingContext(this, account, "Settings");

            if (dynamic != null)
            {
                dynamic.Dispose();
            }

            dynamic = new DialogViewController(context.Root, true);
            navigation.PushViewController(dynamic, true);
        }
Example #15
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            NSError error;

            window = new UIWindow(UIScreen.MainScreen.Bounds);
            window.MakeKeyAndVisible();
            dvc = new DialogViewController(new RootElement("CouchDemo")
            {
                new Section("Welcome")
            });
            window.RootViewController = new UINavigationController(dvc);

            server = new CouchTouchDBServer();
            if (server.Error != null)
            {
                Console.WriteLine("Error with the code: {0}", server.Error);
            }
            database = server.GetDatabase("grocery-sync");
            database.EnsureCreated(out error);
            database.TracksChanges = true;

            //
            // Create a view with documents sorted by date
            //
            design = database.DesignDocumentWithName("grocery");
            design.DefineView("byDate", (doc, emit) => {
                var date = doc ["created_at"];
                if (date != null)
                {
                    emit(date, doc);
                }
            }, "1.0");

            // Validation function requiring parseable dates
            design.SetValidationBlock((newRevision, context) => {
                if (newRevision.Deleted)
                {
                    return(true);
                }
                var date = newRevision.Properties ["created_at"];
                if (date != null && RestBody.DateWithJSONObject(date) == null)
                {
                    context.ErrorMessage = "Invalid date";
                    return(false);
                }
                return(true);
            });
            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);
            };

            this.RefreshRequested += delegate {
                NSTimer.CreateScheduledTimer(1, delegate {
                    CognitoSyncUtils.Synchronize();
                    this.ReloadComplete();
                });
            };

            CognitoSyncUtils.SetSyncAction((exception) =>
            {
                if (exception != null)
                {
                    Console.WriteLine("ERROR: " + exception.Message);
                    return;
                }
                CognitoSyncUtils.LoadTasks();
                todoLists = CognitoSyncUtils.GetTasks();
                if (todoLists != null)
                {
                    InvokeOnMainThread(() =>
                    {
                        var e = from t in todoLists
                                select(Element) new CheckboxElement((string.IsNullOrEmpty(t.Title) ? string.Empty : t.Title), t.Completed);
                        var section = new Section();
                        foreach (var element in e)
                        {
                            section.Add(element);
                        }

                        Root = new RootElement("Todo List");
                        Root.Add(section);
                    });
                }
            });
        }
Example #17
0
        public UIViewController GetViewController()
        {
            var menu = new RootElement("Test Runner");

            Section main = new Section();

            foreach (TestSuite suite in suites)
            {
                main.Add(Setup(suite));
            }
            menu.Add(main);

            Section options = new Section()
            {
                new StringElement("Run Everything", Run),
                new StyledStringElement("Options", Options)
                {
                    Accessory = UITableViewCellAccessory.DisclosureIndicator
                },
                new StyledStringElement("Credits", Credits)
                {
                    Accessory = UITableViewCellAccessory.DisclosureIndicator
                }
            };

            menu.Add(options);

            var dv = new DialogViewController(menu)
            {
                Autorotate = true
            };

            // AutoStart running the tests (with either the supplied 'writer' or the options)
            if (AutoStart)
            {
                ThreadPool.QueueUserWorkItem(delegate {
                    window.BeginInvokeOnMainThread(delegate {
                        Run();
                        // optionally end the process, e.g. click "Touch.Unit" -> log tests results, return to springboard...
                        // http://stackoverflow.com/questions/1978695/uiapplication-sharedapplication-terminatewithsuccess-is-not-there
                        if (TerminateAfterExecution)
                        {
                            TerminateWithSuccess();
                        }
                    });
                });
            }
            return(dv);
        }
Example #18
0
        public static void CategoryPage(Category category, Action refresh)
        {
            var title = new EntryElement("Название", "", category.Title);
            var root  = new RootElement("Категория")
            {
                new Section()
                {
                    title
                }
            };

            var dv = new DialogViewController(root, true);

            dv.ViewDisappearing += delegate
            {
                category.Title = title.Value;

                DataLayer.PutCategory(category);
                refresh();
            };

            var deleteButton = new UIBarButtonItem(UIBarButtonSystemItem.Trash);

            deleteButton.Clicked += delegate
            {
                UIAlertView alert = new UIAlertView("Удаление", "Вы точно хотите удалить?", null, "Да", new string[] { "Нет" });
                alert.Clicked += (s, b) =>
                {
                    if (b.ButtonIndex == 0)
                    {
                        Task.Factory.StartNew(
                            () =>
                        {
                            DataLayer.DeleteCategory(category);
                        }
                            ).ContinueWith(
                            t =>
                        {
                            newOperationController.PopViewControllerAnimated(true);
                        }, TaskScheduler.FromCurrentSynchronizationContext()
                            );
                    }
                };
                alert.Show();
            };
            dv.NavigationItem.RightBarButtonItem = deleteButton;

            newOperationController.PushViewController(dv, true);
        }
 /// <summary>
 /// Behaves differently depending on iPhone or iPad
 /// </summary>
 public override void Selected(DialogViewController dvc, UITableView tableView, MonoTouch.Foundation.NSIndexPath path)
 {
     if (this.splitViewController != null)
     {
         this.splitViewController.ShowPatient(this.patient);
     }
     else
     {
         var detailViewController = this.ObjectFactory.Create <PatientDetailViewController>(new NamedParameterOverloads {
             { "patientId", this.patient.Id }
         });
         detailViewController.Title = "Patient";
         dvc.ActivateController(detailViewController);
     }
 }
Example #20
0
        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);
        }
Example #21
0
 public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
 {
     if (DisableSwitching)
     {
         ShowDatePicker(dvc, tableView, path);
     }
     else if (PickerType == PickerTypes.Calendar)
     {
         ShowCalendar(dvc, tableView, path);
     }
     else
     {
         ShowDatePicker(dvc, tableView, path);
     }
 }
Example #22
0
    private Transform tPfbParent;       // LayoutVertical(プレハブMemberの親)

    // CallBack
    public void _CallBackBtnAllClear()
    {
        SoundManager.play(SoundManager.CLICK01);
        string title   = "全ペア解除の確認";
        string message = "全てのペア構成を解除しますか?\n";

        DialogViewController.Show(title, message, new DialogViewOptions {
            btnCancelTitle = "キャンセル", btnCancelDelegate = () => {
                return;
            },
            btnOkTitle = "削除", btnOkDelegate = () => {
                _deletePairAll();
            },
        });
    }
Example #23
0
    public void _CallBackBtnDelete()
    {
        string title   = "通知の削除確認";
        string message = "この通知を削除します。";

        DialogViewController.Show(title, message, new DialogViewOptions {
            btnCancelTitle = "キャンセル", btnCancelDelegate = () => {
                return;
            },
            btnOkTitle = "削除", btnOkDelegate = () => {
                viewManager.scriptNoticeView.deleteNoticeItem(this.transform, category, sumDate, sumEndDate);
                viewManager.chgNoticeView(myView, viewManager.OUT_RIGHT);
            },
        });
    }
Example #24
0
    private void ConfirmSave()
    {
        string title   = "登録確認";
        string message = "メンバーを登録しますか?";

        DialogViewController.Show(title, message, new DialogViewOptions {
            btnCancelTitle = "キャンセル", btnCancelDelegate = () => {
                return;
            },
            btnOkTitle = "登録", btnOkDelegate = () => {
                SaveMemberInfo();
                _CallBackBtnCancel();
            },
        });
    }
Example #25
0
 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);
     };
 }
Example #26
0
        public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath indexPath)
        {
            RootElement root = (RootElement) Parent.Parent;
            if (RadioIdx != root.RadioSelected){
                var cell = tableView.CellAt (root.PathForRadio (root.RadioSelected));
                if (cell != null)
                    cell.Accessory = UITableViewCellAccessory.None;
                cell = tableView.CellAt (indexPath);
                if (cell != null)
                    cell.Accessory = UITableViewCellAccessory.Checkmark;
                root.RadioSelected = RadioIdx;
            }
			
            base.Selected (dvc, tableView, indexPath);
        }
Example #27
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            tableView.DeselectRow(path, true);

            if (Animating)
            {
                return;
            }

            if (LoadMoreTapped != null)
            {
                Animating = true;
                LoadMoreTapped(this);
            }
        }
Example #28
0
 /// <summary>
 /// Invoked when the given element has been selected by the user.
 /// </summary>
 /// <param name="dvc">
 /// The <see cref="DialogViewController"/> where the selection took place
 /// </param>
 /// <param name="tableView">
 /// The <see cref="UITableView"/> that contains the element.
 /// </param>
 /// <param name="path">
 /// The <see cref="NSIndexPath"/> that contains the Section and Row for the element.
 /// </param>
 public virtual void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
 {
     if (Tapped != null)
     {
         Tapped();
     }
     if (SelectedCommand != null)
     {
         SelectedCommand.Execute(null);
     }
     if (ShouldDeselectAfterTouch)
     {
         tableView.DeselectRow(path, true);
     }
 }
Example #29
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            var section = dvc.Root [0].Elements;

            var list = (from MemorizationElement e in section where e.ElementIsSelected select e.VerseForElement).ToList();

            if (list.Count == 0)
            {
                new UIAlertView("Invalid Selection", "Oops! Select at least one verse to memorize!", null, "Okay", null).Show();
            }
            else
            {
                dvc.PresentViewController(new FlipCardController(list), true, null);
            }
        }
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            ViewForPicker = ViewForPicker ?? tableView.Superview;

            if (Tapped != null)
            {
                Tapped();
            }
            if (ShouldDeselect)
            {
                tableView.DeselectRow(path, true);
            }

            ShowPicker();
        }
Example #31
0
 // CallBack
 // 新規登録View
 public void _CallBackBtnRegister()
 {
     SoundManager.play(SoundManager.CLICK01);
     if (MemberManager.getMemberCount() >= MemberManager.MAX_MEMBER)
     {
         string title   = "登録人数の制限";
         string message = "登録できる最大人数は、" + MemberManager.MAX_MEMBER + "名です。";
         DialogViewController.Show(title, message, null);
     }
     else
     {
         MemberManager.newMember();
         viewManager.chgRegisterMembeView(myView, viewManager.IN_RIGHT);
     }
 }
Example #32
0
        //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);
        }
Example #33
0
        void msgSelected(DialogViewController dvc, UITableView tv, NSIndexPath path)
        {
            var np = new DialogViewController(new RootElement("Message Display")
            {
                new Section()
                {
                    new StyledMultilineElement(
                        "From: foo\n" +
                        "To: bar\n" +
                        "Subject: Hey there\n\n" +
                        "This is very simple!")
                }
            }, true);

            dvc.ActivateController(np);
        }
        void SetupImagePreview(DialogViewController parent, float y, string picUrl, string thumbUrl, string previewUrl)
        {
            var rect = new RectangleF(0, y, 78, 78);

            var imageButton = new UIButton(rect)
            {
                BackgroundColor = UIColor.Clear
            };

            imageButton.TouchUpInside += delegate {
                string html = "<html><body style='background-color:black'><div style='text-align:center; width: 320px; height: 480px;'><img src='{0}'/></div></body></html>";
                WebViewController.OpenHtmlString(parent, String.Format(html, previewUrl), new NSUrl(picUrl).BaseUrl);
            };
            AddSubview(imageButton);
            ImageStore.QueueRequestForPicture(serial++, thumbUrl, this);
        }
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath indexPath)
        {
            base.Selected (dvc, tableView, indexPath);

            dvc.NavigationController.PopViewControllerAnimated(true);
        }
        // hook into the selected - pass it down, then call our handler.
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath indexPath)
        {
            base.Selected (dvc, tableView, indexPath);

            if (RadioSelected != null)
            {
                RadioSelected(this);
            }
        }
Example #37
0
		// This method is invoked when the application has loaded its UI and its ready to run
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			JsonElement sampleJson;
			var Last = new DateTime (2010, 10, 7);
			Console.WriteLine (Last);
			
			var p = Path.GetFullPath ("background.png");
			
			var menu = new RootElement ("Demos"){
				new Section ("Element API"){
					new StringElement ("iPhone Settings Sample", DemoElementApi),
					new StringElement ("Dynamically load data", DemoDynamic),
					new StringElement ("Add/Remove demo", DemoAddRemove),
					new StringElement ("Assorted cells", DemoDate),
					new StyledStringElement ("Styled Elements", DemoStyled) { BackgroundUri = new Uri ("file://" + p) },
					new StringElement ("Load More Sample", DemoLoadMore),
					new StringElement ("Row Editing Support", DemoEditing),
					new StringElement ("Advanced Editing Support", DemoAdvancedEditing),
					new StringElement ("Owner Drawn Element", DemoOwnerDrawnElement),
				},
				new Section ("Container features"){
					new StringElement ("Pull to Refresh", DemoRefresh),
					new StringElement ("Headers and Footers", DemoHeadersFooters),
					new StringElement ("Root Style", DemoContainerStyle),
					new StringElement ("Index sample", DemoIndex),
				},
				new Section ("Json") {
					(sampleJson = JsonElement.FromFile ("sample.json")),
					// Notice what happens when I close the paranthesis at the end, in the next line:
					new JsonElement ("Load from URL", "file://" + Path.GetFullPath ("sample.json"))
				},
				new Section ("Auto-mapped", footer){
					new StringElement ("Reflection API", DemoReflectionApi)
				},
			};
			
			//
			// Lookup elements by ID:
			//
			var jsonSection = sampleJson ["section-1"] as Section;
			Console.WriteLine ("The section has {0} elements", jsonSection.Count);
			var booleanElement = sampleJson ["first-boolean"] as BooleanElement;
			Console.WriteLine ("The state of the first-boolean value is {0}", booleanElement.Value);
			
			//
			// Create our UI and add it to the current toplevel navigation controller
			// this will allow us to have nice navigation animations.
			//
			var dv = new DialogViewController (menu) {
				Autorotate = true
			};
			navigation = new UINavigationController ();
			navigation.PushViewController (dv, true);				
			
			// On iOS5 we use the new window.RootViewController, on older versions, we add the subview
			window = new UIWindow (UIScreen.MainScreen.Bounds);
			window.MakeKeyAndVisible ();
            if (UIDevice.CurrentDevice.CheckSystemVersion (5, 0))
				window.RootViewController = navigation;	
			else
				window.AddSubview (navigation.View);
			
			return true;
		}
Example #38
0
    public override bool FinishedLaunching(UIApplication app, NSDictionary options)
    {
        window = new UIWindow (UIScreen.MainScreen.Bounds);
        //		var rect = new CGRect (0, 0, window.Bounds.Width, 100);

        NSTimer.CreateScheduledTimer (0.1, (v) => TickOnce ());

        dvc = new DialogViewController (
            new RootElement ("Root")
            {
        //				new Section ("Main") {
        //					(misc = new GlassButton (rect)),
        //					(run = new GlassButton (rect)),
        //				},
            }
        );
        dvc.Autorotate = true;
        //
        //		if (misc != null) {
        //			misc.SetTitle ("Click MEEE!", UIControlState.Normal);
        //			misc.Tapped += (obj) =>
        //			{
        //				try {
        //					MiscTapped ();
        //				} catch (Exception e) {
        //					Console.WriteLine (e);
        //				}
        //			};
        //		}
        //		if (run != null) {
        //			run.SetTitle ("Run tests", UIControlState.Normal);
        //			run.Tapped += (obj) => {
        //				var builder = new NUnit.Framework.Internal.NUnitLiteTestAssemblyBuilder ();
        //				var suite = builder.Build (typeof (AppDelegate).Assembly, new Dictionary<string, object> ());
        //				var wi = suite.CreateWorkItem (NUnit.Framework.Internal.TestFilter.Empty);
        //				wi.Execute (NUnit.Framework.Internal.TestExecutionContext.CurrentContext);
        //			};
        //		}
        window.RootViewController = dvc;
        window.MakeKeyAndVisible ();

        return true;
    }
		protected abstract EditorViewController CreateEditorController(DialogViewController dvc);
Example #40
0
 /// <summary>
 /// Invoked when the given element has been deslected by the user.
 /// </summary>
 /// <param name="dvc">
 /// The <see cref="DialogViewController"/> where the deselection took place
 /// </param>
 /// <param name="tableView">
 /// The <see cref="UITableView"/> that contains the element.
 /// </param>
 /// <param name="path">
 /// The <see cref="NSIndexPath"/> that contains the Section and Row for the element.
 /// </param>
 public virtual void Deselected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
 {
 }
Example #41
0
        public override void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
        {
            var vc = new WebViewController(this)
                {
                    Autorotate = dvc.Autorotate
                };

            _web = new UIWebView(UIScreen.MainScreen.Bounds)
                {
                    BackgroundColor = UIColor.White,
                    ScalesPageToFit = true,
                    AutoresizingMask = UIViewAutoresizing.All
                };
            _web.LoadStarted += delegate
                {
                    NetworkActivity = true;
                    var indicator = new UIActivityIndicatorView(UIActivityIndicatorViewStyle.White);
                    vc.NavigationItem.RightBarButtonItem = new UIBarButtonItem(indicator);
                    indicator.StartAnimating();
                };
            _web.LoadFinished += delegate
                {
                    NetworkActivity = false;
                    vc.NavigationItem.RightBarButtonItem = null;
                };
            _web.LoadError += (webview, args) =>
                {
                    NetworkActivity = false;
                    vc.NavigationItem.RightBarButtonItem = null;
                    if (_web != null)
                        _web.LoadHtmlString(
                            String.Format("<html><center><font size=+5 color='red'>{0}:<br>{1}</font></center></html>",
                                          "An error occurred:".GetText(), args.Error.LocalizedDescription), null);
                };
            vc.NavigationItem.Title = Caption;

            vc.View.AutosizesSubviews = true;
            vc.View.AddSubview(_web);

            dvc.ActivateController(vc);
            _web.LoadRequest(NSUrlRequest.FromUrl(_nsUrl));
        }
Example #42
0
 /// <summary>
 /// Invoked when the given element has been selected by the user.
 /// </summary>
 /// <param name="dvc">
 /// The <see cref="DialogViewController"/> where the selection took place
 /// </param>
 /// <param name="tableView">
 /// The <see cref="UITableView"/> that contains the element.
 /// </param>
 /// <param name="path">
 /// The <see cref="NSIndexPath"/> that contains the Section and Row for the element.
 /// </param>
 public virtual void Selected(DialogViewController dvc, UITableView tableView, NSIndexPath path)
 {
     if (Tapped != null)
         Tapped();
     if (SelectedCommand != null)
         SelectedCommand.Execute(null);
     if (ShouldDeselectAfterTouch)
         tableView.DeselectRow(path, true);
 }
 public override void Selected (DialogViewController dvc, MonoTouch.UIKit.UITableView tableView, MonoTouch.Foundation.NSIndexPath path)
 {
     base.Selected (dvc, tableView, path);
     dvc.NavigationController.PopViewControllerAnimated(true);
 }
Example #44
0
		public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			tableView.DeselectRow (path, true);
			
			if (Animating)
				return;
			
			if (Tapped != null){
				Animating = true;
				Tapped (this);
			}
		}
		public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
		{
			var vc = CreateEditorController(dvc);
			vc.Autorotate = true; 
			dvc.ActivateController (vc);
		}