コード例 #1
0
        public async Task PopModalAsync(bool isAnimated)
        {
            await Navigation.PopModalAsync(true);

            while (ToolbarItems.Count > 0)
            {
                if (string.Equals(ToolbarItems[0]?.Text, _cancelToolBarItemText))
                {
                    ToolbarItems[0].Clicked -= HandleCancelButtonTapped;
                }

                ToolbarItems.RemoveAt(0);
            }

            _viewModel.SaveToDatabaseCompleted -= HandleCancelButtonTapped;
            _viewModel.SaveError -= HandleSaveError;
            _viewModel            = null;
        }
コード例 #2
0
        public AddOpportunityPage()
        {
            var viewModel = new AddOpportunityViewModel(this);

            BindingContext = viewModel;

            #region Create Topic Entry
            var topicText = new EntryCell
            {
                Label = "Topic"
            };
            topicText.SetBinding(EntryCell.TextProperty, "Topic");
            #endregion

            #region Create Company Entry
            var companyText = new EntryCell
            {
                Label = "Company"
            };
            companyText.SetBinding(EntryCell.TextProperty, "Company");
            #endregion

            #region Create DBA Entry
            var dbaText = new EntryCell
            {
                Label = "DBA"
            };
            dbaText.SetBinding(EntryCell.TextProperty, "DBA");
            #endregion

            #region Create LeaseAmount Entry
            var leaseAmountNumber = new EntryCell
            {
                Label    = "Lease Amount",
                Keyboard = Keyboard.Numeric
            };
            leaseAmountNumber.SetBinding(EntryCell.TextProperty, "LeaseAmount");
            #endregion

            #region Create Owner Entry
            var ownerText = new EntryCell
            {
                Label = "Owner",
            };
            leaseAmountNumber.SetBinding(EntryCell.TextProperty, "Owner");
            #endregion

            #region create the TableView
            var tableView = new TableView
            {
                Intent = TableIntent.Settings,
                Root   = new TableRoot
                {
                    new TableSection {
                        topicText,
                        companyText,
                        leaseAmountNumber,
                        ownerText,
                        dbaText,
                    }
                }
            };
            #endregion

            #region Create Save Button
            var saveButtonToolBar = new ToolbarItem();
            saveButtonToolBar.Text = "Save";
            saveButtonToolBar.SetBinding(ToolbarItem.CommandProperty, "SaveButtonTapped");
            saveButtonToolBar.Priority = 0;
            ToolbarItems.Add(saveButtonToolBar);
            #endregion

            #region Create Cancel Button
            var cancelButtonToolBar = new ToolbarItem();
            cancelButtonToolBar.Text     = "Cancel";
            cancelButtonToolBar.Command  = new Command(async() => await PopModalAsync(true));
            cancelButtonToolBar.Priority = 1;
            ToolbarItems.Add(cancelButtonToolBar);
            #endregion

            Title = "Add Opportunity";

            Content = tableView;

            SaveToDatabaseCompleted += async(sender, e) => await PopModalAsync(true);
        }
コード例 #3
0
        public AddOpportunityPage()
        {
            _viewModel     = new AddOpportunityViewModel();
            BindingContext = _viewModel;

            #region Create Topic Entry
            var topicText = new EntryCell
            {
                Label = "Topic"
            };
            topicText.SetBinding(EntryCell.TextProperty, "Topic");
            #endregion

            #region Create Company Entry
            var companyText = new EntryCell
            {
                Label = "Company"
            };
            companyText.SetBinding(EntryCell.TextProperty, "Company");
            #endregion

            #region Create DBA Entry
            var dbaText = new EntryCell
            {
                Label = "DBA"
            };
            dbaText.SetBinding(EntryCell.TextProperty, "DBA");
            #endregion

            #region Create LeaseAmount Entry
            var leaseAmountNumber = new EntryCell
            {
                Label    = "Lease Amount",
                Keyboard = Keyboard.Numeric
            };
            leaseAmountNumber.SetBinding(EntryCell.TextProperty, "LeaseAmount");
            #endregion

            #region Create Owner Entry
            var ownerText = new EntryCell
            {
                Label = "Owner",
            };
            ownerText.SetBinding(EntryCell.TextProperty, "Owner");
            #endregion

            #region create the TableView
            var tableView = new TableView
            {
                Intent = TableIntent.Settings,
                Root   = new TableRoot
                {
                    new TableSection {
                        topicText,
                        companyText,
                        leaseAmountNumber,
                        ownerText,
                        dbaText,
                    }
                }
            };
            #endregion

            #region Create Save Button
            var saveButtonToolBar = new ToolbarItem();
            saveButtonToolBar.Text = _saveToolBarItemText;
            saveButtonToolBar.SetBinding(ToolbarItem.CommandProperty, "SaveButtonTapped");
            saveButtonToolBar.Priority = 0;
            ToolbarItems.Add(saveButtonToolBar);
            #endregion

            #region Create Cancel Button
            var cancelButtonToolBar = new ToolbarItem();
            cancelButtonToolBar.Text     = _cancelToolBarItemText;
            cancelButtonToolBar.Clicked += HandleCancelButtonTapped;
            cancelButtonToolBar.Priority = 1;
            ToolbarItems.Add(cancelButtonToolBar);
            #endregion

            Title = "Add Opportunity";

            Content = tableView;

            _viewModel.SaveError += HandleSaveError;

            _viewModel.SaveToDatabaseCompleted += HandleCancelButtonTapped;
        }
コード例 #4
0
		public AddOpportunityPage()
		{
			var viewModel = new AddOpportunityViewModel(this);
			BindingContext = viewModel;

			#region Create Topic Entry
			var topicText = new EntryCell
			{
				Label = "Topic"
			};
			topicText.SetBinding(EntryCell.TextProperty, "Topic");
			#endregion

			#region Create Company Entry
			var companyText = new EntryCell
			{
				Label = "Company"
			};
			companyText.SetBinding(EntryCell.TextProperty, "Company");
			#endregion

			#region Create DBA Entry
			var dbaText = new EntryCell
			{
				Label = "DBA"
			};
			dbaText.SetBinding(EntryCell.TextProperty, "DBA");
			#endregion

			#region Create LeaseAmount Entry
			var leaseAmountNumber = new EntryCell
			{
				Label = "Lease Amount",
				Keyboard = Keyboard.Numeric
			};
			leaseAmountNumber.SetBinding(EntryCell.TextProperty, "LeaseAmount");
			#endregion

			#region Create Owner Entry
			var ownerText = new EntryCell
			{
				Label = "Owner",
			};
			ownerText.SetBinding(EntryCell.TextProperty, "Owner");
			#endregion

			#region create the TableView
			var tableView = new TableView
			{
				Intent = TableIntent.Settings,
				Root = new TableRoot
				{
					new TableSection{
						topicText,
						companyText,
						leaseAmountNumber,
						ownerText,
						dbaText,
					}
				}
			};
			#endregion

			#region Create Save Button
			var saveButtonToolBar = new ToolbarItem();
			saveButtonToolBar.Text = "Save";
			saveButtonToolBar.SetBinding(ToolbarItem.CommandProperty, "SaveButtonTapped");
			saveButtonToolBar.Priority = 0;
			ToolbarItems.Add(saveButtonToolBar);
			#endregion

			#region Create Cancel Button
			var cancelButtonToolBar = new ToolbarItem();
			cancelButtonToolBar.Text = "Cancel";
			cancelButtonToolBar.Command = new Command (async ()=> await PopModalAsync(true));
			cancelButtonToolBar.Priority = 1;
			ToolbarItems.Add(cancelButtonToolBar);
			#endregion

			Title = "Add Opportunity";

			Content = tableView;

			viewModel.SaveError += HandleSaveError;

			SaveToDatabaseCompleted += async (sender, e) => await PopModalAsync(true);
		}