Пример #1
0
        public async Task EntryCellDisposed()
        {
            var text1 = "Foo";
            var text2 = "Bar";
            var model = new _5560Model()
            {
                Text = text1
            };

            for (int m = 0; m < 3; m++)
            {
                var entryCell = new EntryCell();
                entryCell.SetBinding(EntryCell.TextProperty, new Binding("Text"));
                entryCell.SetBinding(EntryCell.BindingContextProperty, new Binding("BindingContext"));
                entryCell.BindingContext = model;
                CellFactory.GetCell(entryCell, null, null, Context, null);

                if (m == 1)
                {
                    GC.Collect();
                }

                model.Text = model.Text == text1 ? text2 : text1;
            }

            await model.WaitForTestToComplete().ConfigureAwait(false);
        }
Пример #2
0
        public void EntryCellXAlignBindingMatchesHorizontalTextAlignmentBinding()
        {
            var vm = new ViewModel();

            vm.Alignment = TextAlignment.Center;

            var entryCellXAlign = new EntryCell()
            {
                BindingContext = vm
            };

            entryCellXAlign.SetBinding(EntryCell.XAlignProperty, new Binding("Alignment"));

            var entryCellHorizontalTextAlignment = new EntryCell()
            {
                BindingContext = vm
            };

            entryCellHorizontalTextAlignment.SetBinding(EntryCell.HorizontalTextAlignmentProperty, new Binding("Alignment"));

            Assert.AreEqual(TextAlignment.Center, entryCellXAlign.XAlign);
            Assert.AreEqual(TextAlignment.Center, entryCellHorizontalTextAlignment.HorizontalTextAlignment);

            vm.Alignment = TextAlignment.End;

            Assert.AreEqual(TextAlignment.End, entryCellXAlign.XAlign);
            Assert.AreEqual(TextAlignment.End, entryCellHorizontalTextAlignment.HorizontalTextAlignment);
        }
        public static IEnumerable <Cell> GenerateSettingsFormCells(object instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException(nameof(instance));
            }

            foreach (var property in instance.GetType().GetProperties(
                         BindingFlags.Public | BindingFlags.Instance))
            {
                var entryCell = new EntryCell();
                if (property.PropertyType == typeof(sbyte) ||
                    property.PropertyType == typeof(byte) ||
                    property.PropertyType == typeof(short) ||
                    property.PropertyType == typeof(ushort) ||
                    property.PropertyType == typeof(int) ||
                    property.PropertyType == typeof(uint) ||
                    property.PropertyType == typeof(long) ||
                    property.PropertyType == typeof(ulong) ||
                    property.PropertyType == typeof(decimal) ||
                    property.PropertyType == typeof(float) ||
                    property.PropertyType == typeof(double))
                {
                    entryCell.Keyboard = Keyboard.Numeric;
                }

                entryCell.Label = property.GetCustomAttribute <DisplayAttribute>()?.Name ?? property.Name.Humanize(LetterCasing.Title);
                entryCell.HorizontalTextAlignment = TextAlignment.End;
                entryCell.SetBinding(EntryCell.TextProperty, new Binding {
                    Source = instance, Path = property.Name
                });
                yield return(entryCell);
            }
        }
        internal static Cell IntCell(PropertyInfo property, IContact context, Page parent = null)
        {
            var label     = CreateLabel(property);
            var entryCell = new EntryCell();

            entryCell.SetValue(EntryCell.LabelProperty, label);
            entryCell.LabelColor = Color.FromHex("999999");
            entryCell.SetBinding(EntryCell.TextProperty, new Binding(property.Name, mode: BindingMode.TwoWay, converter: DefaultConverter));
            entryCell.BindingContext = context;
            return(entryCell);
        }
Пример #5
0
        protected override void Init()
        {
            _viewModel = new _37841ViewModel();

            var instructions = new Label {
                FontSize = 16, Text = @"Click on the Generate button. 
The EntryCell should display '12345' and the TextCell should display '6789'. 
Click on the Generate button a second time. 
The EntryCell should display '112358' and the TextCell should display '48151623'."
            };

            var button = new Button {
                Text = "Generate"
            };

            button.SetBinding(Button.CommandProperty, nameof(_37841ViewModel.GetNextNumbersCommand));

            var random1 = new EntryCell {
                IsEnabled = false, Label = "Entry Cell"
            };

            random1.SetBinding(EntryCell.TextProperty, nameof(_37841ViewModel.Value1));

            var textCell = new TextCell {
                IsEnabled = false, Detail = "TextCell"
            };

            textCell.SetBinding(TextCell.TextProperty, nameof(_37841ViewModel.Value2));

            var buttonViewCell = new ViewCell {
                View = button
            };

            var section = new TableSection("")
            {
                random1,
                textCell,
                buttonViewCell
            };

            var root = new TableRoot {
                section
            };
            var tv = new TableView {
                Root = root
            };

            Content = new StackLayout
            {
                Children = { instructions, tv }
            };

            BindingContext = _viewModel;
        }
        internal static Cell DecimalCell(PropertyInfo property, IContact context, Page parent = null)
        {
            var label          = CreateLabel(property);
            var currencyAttrib = property.GetCustomAttribute <CurrencyAttribute>();
            var entryCell      = new EntryCell();

            entryCell.SetValue(EntryCell.LabelProperty, label);
            entryCell.LabelColor = Color.FromHex("999999");
            entryCell.SetBinding(EntryCell.TextProperty, new Binding(property.Name, mode: BindingMode.TwoWay, converter: DefaultConverter, converterParameter: currencyAttrib));
            entryCell.BindingContext = context;
            return(entryCell);
        }
Пример #7
0
        public SettingsPage()
        {
            BindingContext = new SettingsModel();

            var cameraSwitch = new SwitchCell {
                Text = "Rear Camera"
            };

            cameraSwitch.SetBinding(SwitchCell.OnProperty, new Binding("DefaultCameraRear"));

            var timerEntry = new EntryCell {
                Label = "Seconds", Keyboard = Keyboard.Numeric
            };

            timerEntry.SetBinding(EntryCell.TextProperty, new Binding("TimerInterval", BindingMode.TwoWay));

            var clearDataLabel = new TextCell {
                Text = "Clear All Data"
            };

            clearDataLabel.Tapped += async(s, e) =>
            {
                var result = await DisplayAlert("Delete All Data", "Are you sure you wish to clear all stored data online?", "YES", "Cancel");

                if (result)
                {
                    var response = await(BindingContext as SettingsModel).ResetData();
                    DisplayAlert(response, "", "Ok");
                }
            };

            Title   = "Settings";
            Content = new TableView
            {
                Root = new TableRoot {
                    new TableSection("Default Camera")
                    {
                        cameraSwitch
                    },
                    new TableSection("Data")
                    {
                        clearDataLabel
                    },
                    new TableSection("Identify Interval")
                    {
                        timerEntry
                    }
                }
            };

            //
        }
Пример #8
0
 public ListViewEntryCell()
 {
     Content = new ListView()
     {
         ItemTemplate = new DataTemplate(() =>
         {
             var cell = new EntryCell();
             cell.SetBinding(EntryCell.TextProperty, ".");
             return(cell);
         }),
         ItemsSource = Enumerable.Range(0, 100).Select(i => $"Entry {i}").ToList()
     };
 }
Пример #9
0
		public void EntryCellXAlignBindingMatchesHorizontalTextAlignmentBinding ()
		{
			var vm = new ViewModel ();
			vm.Alignment = TextAlignment.Center;

			var entryCellXAlign = new EntryCell () { BindingContext = vm };
			entryCellXAlign.SetBinding (EntryCell.XAlignProperty, new Binding ("Alignment"));

			var entryCellHorizontalTextAlignment = new EntryCell () { BindingContext = vm };
			entryCellHorizontalTextAlignment.SetBinding (EntryCell.HorizontalTextAlignmentProperty, new Binding ("Alignment"));

			Assert.AreEqual (TextAlignment.Center, entryCellXAlign.XAlign);
			Assert.AreEqual (TextAlignment.Center, entryCellHorizontalTextAlignment.HorizontalTextAlignment);

			vm.Alignment = TextAlignment.End;

			Assert.AreEqual (TextAlignment.End, entryCellXAlign.XAlign);
			Assert.AreEqual (TextAlignment.End, entryCellHorizontalTextAlignment.HorizontalTextAlignment);
		}
        private void emailCellCreation(int cellNum, string Text)
        {
            string    s  = "Contact" + (cellNum);
            EntryCell ec = new EntryCell()
            {
                Label       = s + ": ",
                Placeholder = s + "@" + s + ".com",
                Keyboard    = Keyboard.Email,
                Text        = Text,
            };

            Binding ecbind = new Binding("contact" + cellNum);

            ecbind.Source = rawData;
            ecbind.Mode   = BindingMode.TwoWay;
            ec.SetBinding(EntryCell.TextProperty, ecbind);

            EmailCells.Add(ec);
        }
Пример #11
0
        public EditInspectorPage(Inspector existingInspector = null)
        {
            if (existingInspector == null)
            {
                this.inspector = new Inspector();
                Title          = "Create new Inspector";
            }
            else
            {
                this.inspector = existingInspector;
                Title          = "Edit Inspector";
            }
            TableView    view    = new TableView();
            TableRoot    root    = new TableRoot(Title);
            TableSection section = new TableSection();

            Padding  = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0);
            NameCell = new EntryCell
            {
                BindingContext = inspector,
                Label          = "Inspector Name:",
            };
            NameCell.SetBinding(EntryCell.TextProperty, "Name");
            ViewCell SaveCell     = new ViewCell();
            ViewCell CancelCell   = new ViewCell();
            Button   saveButton   = new Button();
            Button   cancelButton = new Button();

            saveButton.Clicked   += SaveInspectorClicked;
            cancelButton.Clicked += CancelInspectorClicked;
            saveButton.Text       = "Save";
            cancelButton.Text     = "Cancel";
            SaveCell.View         = saveButton;
            CancelCell.View       = cancelButton;

            section.Add(NameCell);
            section.Add(SaveCell);
            section.Add(CancelCell);
            root.Add(section);
            view.Root = root;
            Content   = view;
        }
Пример #12
0
        protected override Cell CreateDefault(object item)
        {
            var pi = (PropertyInfo)item;

            if (pi.PropertyType == typeof(double))
            {
                Binding b = new Binding()
                {
                    Source = Target,
                    Path   = pi.Name
                };

                var cell = new EntryCell()
                {
                    Label = pi.Name
                };
                cell.SetBinding(EntryCell.TextProperty, b);
                return(cell);
                //return CreateSpinnerCell(pi);
            }
            return(base.CreateDefault(item));
        }
Пример #13
0
        public void EntryCellDisposed()
        {
            var text1 = "Foo";
            var text2 = "Bar";
            var model = new _5560Model()
            {
                Text = text1
            };

            for (int m = 0; m < 3; m++)
            {
                var entryCell = new EntryCell();
                entryCell.SetBinding(EntryCell.TextProperty, new Binding("Text"));
                entryCell.BindingContext = model;
                CellFactory.GetCell(entryCell, null, null, Context, null);

                if (m == 1)
                {
                    GC.Collect();
                }

                model.Text = model.Text == text1 ? text2 : text1;
            }
        }
Пример #14
0
        public EntryCellPage()
        {
            products = new EProduct[]
            {
                new EProduct("Dev Services", "Service",
                             "Do you need a mobile app, website, or both? Count on Mooseworks Software to collaborate with you at every stage of the project lifecycle, from concept to completion to support. ",
                             "http://mooseworkssoftware.com/wordpress/wp-content/uploads/2013/11/services1.png"),
                new EProduct("Graph", "Product",
                             "The Graph Control provides every graphing feature you could want: Legends, Zooming, Date/Time, Logarithmic, Inverted axes, Right and Left Y-Axes, Markers, Cursor Values, Alarms, and more, while still providing excellent performance.",
                             "http://mooseworkssoftware.com/wordpress/wp-content/uploads/2013/12/graphimage.png"),
                new EProduct("Instrumentation", "Product",
                             "The Instrumentation Control suite includes everything you need to create eye catching and easy to use displays.",
                             "http://mooseworkssoftware.com/wordpress/wp-content/uploads/2013/11/Screenshot1.png"),
                new EProduct("Trend Graph", "Product",
                             "The Trend Graph Control provides real time, scrollable charting capabilities. Memory is handled by the Trend Graph’s circular buffer, so you can add points in real time without worrying about memory growing out of control as time goes on. ",
                             "http://mooseworkssoftware.com/wordpress/wp-content/uploads/2013/12/TrendGraph2.png")
            };

            Label lblHeader = new Label
            {
                Text = "Table View",
                Font = Font.SystemFontOfSize(NamedSize.Large, FontAttributes.Bold),
                HorizontalOptions = LayoutOptions.Center
            };

            TableView tableProducts = new TableView {
                Intent = TableIntent.Data,
                Root   = new TableRoot("Products and Services")
            };

            TableSection sectionServices = new TableSection("Services");
            TableSection sectionProducts = new TableSection("Products");

            foreach (EProduct product in products)
            {
                EntryCell ec = new EntryCell();
                ec.BindingContext = product;
                ec.Label          = "Product Name";
                ec.SetBinding(EntryCell.TextProperty, "Name", BindingMode.TwoWay);
                if (product.Category == "Service")
                {
                    sectionServices.Add(ec);
                }
                else
                {
                    sectionProducts.Add(ec);
                }
            }
            tableProducts.Root.Add(new TableSection[] { sectionServices, sectionProducts });

            Button btnSubmit = new Button {
                Text = "Submit",
                HorizontalOptions = LayoutOptions.Center
            };

            btnSubmit.Clicked += (object sender, EventArgs e) => {
                string message = "";
                foreach (EProduct product in products)
                {
                    message += product.Name + ", ";
                }
                DisplayAlert("Products", message, "OK");
            };

            this.Padding = new Thickness(10, Device.OnPlatform(20, 10, 10), 10, 10);

            this.Content = new StackLayout {
                Children =
                {
                    lblHeader,
                    tableProducts,
                    btnSubmit
                }
            };
        }
        public WalkEntryPage()
        {
            // Set the Content Page Title
            Title = "New Walk Entry";

            // Declare and initialise our Model Binding Context
            BindingContext = new WalkEntryViewModel(DependencyService.Get <IWalkNavService>());

            // Define our New Walk Entry fields
            var walkTitle = new EntryCell
            {
                Label       = "Title:",
                Placeholder = "Trail Title"
            };

            walkTitle.SetBinding(EntryCell.TextProperty, "Title", BindingMode.TwoWay);

            var walkNotes = new EntryCell
            {
                Label       = "Notes:",
                Placeholder = "Description"
            };

            walkNotes.SetBinding(EntryCell.TextProperty, "Notes", BindingMode.TwoWay);

            var walkLatitude = new EntryCell
            {
                Label       = "Latitude:",
                Placeholder = "Latitude",
                Keyboard    = Keyboard.Numeric
            };

            walkLatitude.SetBinding(EntryCell.TextProperty, "Latitude", BindingMode.TwoWay);

            var walkLongitude = new EntryCell
            {
                Label       = "Longitude:",
                Placeholder = "Longitude",
                Keyboard    = Keyboard.Numeric
            };

            walkLongitude.SetBinding(EntryCell.TextProperty, "Longitude", BindingMode.TwoWay);

            var walkKilometers = new EntryCell
            {
                Label       = "Kilometers:",
                Placeholder = "Kilometers",
                Keyboard    = Keyboard.Numeric
            };

            walkKilometers.SetBinding(EntryCell.TextProperty, "Kilometers", BindingMode.TwoWay);

            var walkDifficulty = new EntryCell
            {
                Label       = "Difficulty Level:",
                Placeholder = "Walk Difficulty"
            };

            walkDifficulty.SetBinding(EntryCell.TextProperty, "Difficulty", BindingMode.TwoWay);

            var walkImageUrl = new EntryCell
            {
                Label       = "ImageUrl:",
                Placeholder = "Image URL"
            };

            walkImageUrl.SetBinding(EntryCell.TextProperty, "ImageUrl", BindingMode.TwoWay);

            // Define our TableView
            Content = new TableView
            {
                Intent = TableIntent.Form,
                Root   = new TableRoot
                {
                    new TableSection()
                    {
                        walkTitle,
                        walkNotes,
                        walkLatitude,
                        walkLongitude,
                        walkKilometers,
                        walkDifficulty,
                        walkImageUrl
                    }
                }
            };

            var saveWalkItem = new ToolbarItem
            {
                Text = "Save"
            };

            saveWalkItem.SetBinding(ToolbarItem.CommandProperty, "SaveCommand");
            ToolbarItems.Add(saveWalkItem);
        }
        public EmoteButtonPage()
        {
            ManicSlider.Minimum = 0;
            ManicSlider.Maximum = 100;

            DepressedSlider.Minimum = 0;
            DepressedSlider.Maximum = 100;

            NavigationPage.SetHasNavigationBar(this, true);

            InitializeComponent();

            Title = "Emotional Menu";

            StackLayout stackL2 = new StackLayout()
            {
                Padding = new Thickness(20)
            };


            #region Controls

            #region sliders

            ManiaL.Text       = "Mania = " + rawData.maniaVal;
            ManiaL.FontSize   = 20;
            ManicSlider.Value = rawData.maniaVal;

            ManicSlider.ValueChanged += (sender, e) => OnSliderValueChanged(sender, e, 0, ManiaL);

            DepresionL.Text       = "Depression = " + rawData.depressionVal;
            DepresionL.FontSize   = 20;
            DepressedSlider.Value = rawData.depressionVal;

            DepressedSlider.ValueChanged += (sender, e) => OnSliderValueChanged(sender, e, 1, DepresionL);

            #endregion sliders


            #region EntryCells

            EntryCell sleepHours = new EntryCell()
            {
                Label = "Hours of Sleep?",
            };

            Binding sleepBind = new Binding("sleepHours");
            sleepBind.Source = rawData;
            sleepBind.Mode   = BindingMode.TwoWay;
            sleepHours.SetBinding(EntryCell.TextProperty, sleepBind);


            #endregion EntryCells

            #endregion Controls

            var section = new TableSection
            {
                sleepHours,
            };

            var root = new TableRoot {
                section
            };

            var table = new MenuTableView()
            {
                Intent = TableIntent.Menu,
                Root   = root,
            };

            stackL2.Children.Add(ManiaL);
            stackL2.Children.Add(ManicSlider);
            stackL2.Children.Add(DepresionL);
            stackL2.Children.Add(DepressedSlider);
            stackL2.Children.Add(table);

            ScrollView scrollV = new ScrollView();
            scrollV.Content = stackL2;

            Content = scrollV;
        }
Пример #17
0
        public NewEntryPage()
        {
            //BindingContext = new NewEntryViewModel(DependencyService.Get<INavService>());

            Title = "New Entry";

            var save = new ToolbarItem
            {
                Text = "Save"
            };

            ToolbarItems.Add(save);
            save.SetBinding(ToolbarItem.CommandProperty, "SaveCommand");

            // form fields
            var title = new EntryCell
            {
                Label = "Title"
            };

            title.SetBinding(EntryCell.TextProperty, "Title", BindingMode.TwoWay);

            var latitude = new EntryCell
            {
                Label    = "Latitude",
                Keyboard = Keyboard.Numeric
            };

            latitude.SetBinding(EntryCell.TextProperty, "Latitude", BindingMode.TwoWay);

            var longitude = new EntryCell
            {
                Label    = "Longitude",
                Keyboard = Keyboard.Numeric
            };

            longitude.SetBinding(EntryCell.TextProperty, "Longitude", BindingMode.TwoWay);

            var date = new DatePickerEntryCell
            {
                Label = "Date"
            };

            date.SetBinding(DatePickerEntryCell.DateProperty, "Date", BindingMode.TwoWay);

            var rating = new EntryCell
            {
                Label    = "Rating",
                Keyboard = Keyboard.Numeric
            };

            rating.SetBinding(EntryCell.TextProperty, "Rating", BindingMode.TwoWay);

            var notes = new EntryCell
            {
                Label = "Notes"
            };

            notes.SetBinding(EntryCell.TextProperty, "Notes", BindingMode.TwoWay);

            // Form
            var entryForm = new TableView
            {
                Intent = TableIntent.Form,
                Root   = new TableRoot {
                    new TableSection()
                    {
                        title,
                        latitude,
                        longitude,
                        date,
                        rating,
                        notes
                    }
                }
            };

            Content = entryForm;
        }
Пример #18
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);
        }
Пример #19
0
        public override Element GetEditor(EditableField field, object parent)
        {
            Element view = null;

            if (view == null)
            {
                if (field.PropertyData.Readonly)
                {
                    view = new TextCell()
                    {
                        Text           = ObjectEditor.Translate(field.PropertyData.Title),
                        BindingContext = field,
                        Detail         = field.Value.ToString()
                    };
                    view.SetBinding(TextCell.DetailProperty, nameof(field.Value));
                }
                else
                {
                    var type = field.SourceProperty.PropertyType;
                    if (field.PropertyData.RelationTo != null)
                    {
                        var inst = Activator.CreateInstance(field.PropertyData.RelationTo);
                        if (inst is IEditorRelation rel)
                        {
                            view = new RelationCell(rel)
                            {
                                Text = ObjectEditor.Translate(field.PropertyData.Title)
                            };
                            view.SetBinding(DateCell.ValueProperty, nameof(field.Value));
                        }
                    }
                    else if (type == typeof(string) || type == typeof(int))
                    {
                        view = new EntryCell()
                        {
                            Label = ObjectEditor.Translate(field.PropertyData.Title)
                        };
                        view.SetBinding(EntryCell.TextProperty, nameof(field.Value));
                    }
                    else if (type == typeof(bool))
                    {
                        view = new SwitchCell()
                        {
                            Text = ObjectEditor.Translate(field.PropertyData.Title)
                        };
                        view.SetBinding(SwitchCell.OnProperty, nameof(field.Value));
                    }
                    else if (type == typeof(DateTime))
                    {
                        view = new DateCell()
                        {
                            Text = ObjectEditor.Translate(field.PropertyData.Title)
                        };
                        view.SetBinding(DateCell.ValueProperty, nameof(field.Value));
                    }
                    if (view != null)
                    {
                        view.BindingContext = field;
                    }
                }
            }
            return(view as Element);
        }
Пример #20
0
        public LeadDetailPage()
        {
            #region name entry
            EntryCell companyNameEntryCell = new EntryCell()
            {
                Label       = TextResources.Leads_LeadDetail_CompanyName,
                Placeholder = TextResources.Leads_LeadDetail_CompanyNamePlaceholder
            };
            companyNameEntryCell.SetBinding(EntryCell.TextProperty, "Lead.Company", BindingMode.TwoWay);
            #endregion

            #region industry picker
            PickerCell industryPickerCell = new PickerCell();
            industryPickerCell.Picker.HorizontalOptions = new LayoutOptions(LayoutAlignment.Center, true);
            industryPickerCell.Picker.Title             = TextResources.Leads_LeadDetail_Industry;
            foreach (var industry in Account.IndustryTypes)
            {
                industryPickerCell.Picker.Items.Add(industry);
            }
            industryPickerCell.Picker.SetBinding(Picker.SelectedIndexProperty, "Lead.IndustryTypeCurrentIndex", BindingMode.TwoWay);
            industryPickerCell.Picker.SelectedIndexChanged += (sender, e) =>
            {
                ViewModel.Lead.Industry = industryPickerCell.Picker.Items[industryPickerCell.Picker.SelectedIndex];
            };
            #endregion

            #region opportunity size entry
            EntryCell opportunitySizeEntryCell = new EntryCell()
            {
                Label       = TextResources.Leads_LeadDetail_OpportunitySize,
                Placeholder = TextResources.Leads_LeadDetail_OpportunitySizePlaceholder,
                Keyboard    = Keyboard.Numeric
            };
            opportunitySizeEntryCell.SetBinding(EntryCell.TextProperty, "Lead.OpportunitySize", BindingMode.TwoWay, new CurrencyDoubleConverter());
            #endregion

            #region opportunity stage picker
            PickerCell opportunityStagePickerCell = new PickerCell();
            opportunityStagePickerCell.Picker.HorizontalOptions = new LayoutOptions(LayoutAlignment.Center, true);
            opportunityStagePickerCell.Picker.Title             = TextResources.Leads_LeadDetail_OpportunityStage;
            foreach (var opportunityStage in Account.OpportunityStages)
            {
                opportunityStagePickerCell.Picker.Items.Add(opportunityStage);
            }
            opportunityStagePickerCell.Picker.SetBinding(Picker.SelectedIndexProperty, "Lead.OpportunityStageCurrentIndex", BindingMode.TwoWay);
            opportunityStagePickerCell.Picker.SelectedIndexChanged += (sender, e) =>
            {
                ViewModel.Lead.OpportunityStage = opportunityStagePickerCell.Picker.Items[opportunityStagePickerCell.Picker.SelectedIndex];
            };
            #endregion

            #region compose table view
            Content = new TableView()
            {
                Intent = TableIntent.Settings,
                Root   = new TableRoot()
                {
                    new TableSection()
                    {
                        companyNameEntryCell,
                        industryPickerCell
                    },
                    new TableSection(TextResources.Leads_LeadDetail_OpportunityHeading)
                    {
                        opportunitySizeEntryCell,
                        opportunityStagePickerCell
                    }
                }
            };
            #endregion
        }
Пример #21
0
        public WalkEntryPage()
        {
            //Tytuł strony
            Title = "Nowy wpis";

            BindingContext = new WalkEntryViewModel();

            //Pola do wypełnienia
            var walkTitle = new EntryCell
            {
                Label       = "Tytuł:",
                Placeholder = "Nazwa szlaku"
            };

            walkTitle.SetBinding(EntryCell.TextProperty, "Title", BindingMode.TwoWay);

            var walkNotes = new EntryCell
            {
                Label       = "Uwagi",
                Placeholder = "Opis"
            };

            walkNotes.SetBinding(EntryCell.TextProperty, "Uwagi", BindingMode.TwoWay);

            var walkLatitude = new EntryCell
            {
                Label       = "Szerokość geograficza",
                Placeholder = "Szerokość",
                Keyboard    = Keyboard.Numeric
            };

            walkLatitude.SetBinding(EntryCell.TextProperty, "Szerokość geograficzna", BindingMode.TwoWay);

            var walkLongitude = new EntryCell
            {
                Label       = "Długość geo",
                Placeholder = "Długość",
                Keyboard    = Keyboard.Numeric
            };

            walkLongitude.SetBinding(Entry.TextProperty, "Długość geograficzna", BindingMode.TwoWay);

            var walkKilometers = new EntryCell
            {
                Label       = "Liczba kilometrów",
                Placeholder = "Liczba kilometrów",
                Keyboard    = Keyboard.Numeric
            };

            walkKilometers.SetBinding(Entry.TextProperty, "Dystans", BindingMode.TwoWay);

            var walkDifficulty = new EntryCell
            {
                Label       = "Poziom trudności",
                Placeholder = "Trudność"
            };

            walkDifficulty.SetBinding(Entry.TextProperty, "Trudność", BindingMode.TwoWay);

            var walkImageUrl = new EntryCell
            {
                Label       = "Url Obrazu",
                Placeholder = "Url"
            };

            walkImageUrl.SetBinding(Entry.TextProperty, "Url Obrazu", BindingMode.TwoWay);

            //generowanie widoku
            Content = new TableView
            {
                Intent = TableIntent.Form,
                Root   = new TableRoot
                {
                    new TableSection()
                    {
                        walkTitle,
                        walkNotes,
                        walkLatitude,
                        walkLongitude,
                        walkKilometers,
                        walkDifficulty,
                        walkImageUrl
                    }
                }
            };

            var saveWalkItem = new ToolbarItem
            {
                Text = "Zapisz"
            };

            saveWalkItem.SetBinding(MenuItem.CommandProperty, "SaveCommand");

            ToolbarItems.Add(saveWalkItem);

            saveWalkItem.Clicked += (sender, e) =>
            {
                Navigation.PopToRootAsync(true);
            };
        }
Пример #22
0
        private void InitTableView()
        {
            var bindingContext = BindingContext as VisitResultViewModel;
            int paddingLeft    = Convert.ToInt32(Application.Current.Resources["paddingLeftFormViewCell"]);

            TableView tableView = new TableView
            {
                Intent        = TableIntent.Form,
                Root          = new TableRoot("Esito visita"),
                HasUnevenRows = true
            };

            tableView.SetBinding(TableView.IsVisibleProperty, nameof(bindingContext.IsReady));

            #region Clients List Picker
            Picker clientsListPicker = new Picker();
            clientsListPicker.Title = "Seleziona cliente";
            clientsListPicker.SetBinding(Picker.ItemsSourceProperty, nameof(bindingContext.ClientsList));
            clientsListPicker.SetBinding(Picker.SelectedItemProperty, nameof(bindingContext.ClientName));
            tableView.Root.Add(new TableSection("Cliente")
            {
                new ViewCell()
                {
                    View = clientsListPicker
                }
            });
            #endregion

            #region Contact
            EntryCell contactName = new EntryCell();
            contactName.Label       = "Contatto:";
            contactName.Placeholder = "Nome Contatto";
            contactName.SetBinding(EntryCell.TextProperty, nameof(bindingContext.ContactName));
            EntryCell contactPhone = new EntryCell();
            contactPhone.Label       = "Telefono:";
            contactPhone.Placeholder = "Numero di telefono";
            contactPhone.Keyboard    = Keyboard.Telephone;
            contactPhone.SetBinding(EntryCell.TextProperty, nameof(bindingContext.ContactPhone));
            EntryCell contactEmail = new EntryCell();
            contactEmail.Label       = "Email:";
            contactEmail.Placeholder = "Indirizzo email";
            contactEmail.Keyboard    = Keyboard.Email;
            contactEmail.SetBinding(EntryCell.TextProperty, nameof(bindingContext.ContactEmail));
            EntryCell contactWebSite = new EntryCell();
            contactWebSite.Label       = "Web:";
            contactWebSite.Placeholder = "Indirizzo sito web";
            contactWebSite.Keyboard    = Keyboard.Url;
            contactWebSite.SetBinding(EntryCell.TextProperty, nameof(bindingContext.ContactWebSite));
            tableView.Root.Add(new TableSection("Contatto")
            {
                contactName,
                contactPhone,
                contactEmail,
                contactWebSite
            });
            #endregion

            #region Visit Date and Time
            DatePicker visitDatePicker = new DatePicker();
            visitDatePicker.SetBinding(DatePicker.DateProperty, nameof(bindingContext.VisitDate));
            TimePicker visitTimePicker = new TimePicker();
            visitTimePicker.SetBinding(TimePicker.TimeProperty, nameof(bindingContext.VisitTime));
            tableView.Root.Add(new TableSection("Data e Ora Visita")
            {
                new ViewCell()
                {
                    View = new StackLayout()
                    {
                        Orientation       = StackOrientation.Horizontal,
                        HorizontalOptions = LayoutOptions.Center,
                        Children          = { visitDatePicker, visitTimePicker }
                    }
                }
            });
            #endregion

            #region Visit Interview

            #region Is Interested
            SwitchCell isInterested = new SwitchCell()
            {
                Text = "Interessato"
            };
            isInterested.SetBinding(SwitchCell.OnProperty, nameof(bindingContext.IsInterested));
            #endregion

            #region Quantity
            Entry quantity = new Entry()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.End
            };
            quantity.SetBinding(Entry.TextProperty, nameof(bindingContext.Quantity));
            Stepper quantityStepper = new Stepper();
            quantityStepper.SetBinding(Stepper.ValueProperty, nameof(bindingContext.Quantity));
            #endregion

            #region Rating
            Entry rating = new Entry()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand, HorizontalTextAlignment = TextAlignment.End
            };
            rating.SetBinding(Entry.TextProperty, nameof(bindingContext.Rating));
            Slider ratingSlider = new Slider()
            {
                Minimum = 0, Maximum = 10
            };
            ratingSlider.SetBinding(Slider.ValueProperty, nameof(bindingContext.Rating));
            ratingSlider.HorizontalOptions = LayoutOptions.FillAndExpand;
            #endregion

            #region Comment
            Editor comment = new Editor();
            comment.SetBinding(Editor.TextProperty, nameof(bindingContext.Comment));
            comment.HorizontalOptions = LayoutOptions.FillAndExpand;
            comment.VerticalOptions   = LayoutOptions.FillAndExpand;
            #endregion

            #region Add controls to the Table Section
            tableView.Root.Add(new TableSection("Intervista")
            {
                isInterested,
                new ViewCell()
                {
                    View = new StackLayout()
                    {
                        Orientation = StackOrientation.Horizontal,
                        Padding     = new Thickness()
                        {
                            Left = paddingLeft
                        },
                        Children =
                        {
                            new Label()
                            {
                                Text = "Quantità",
                                HorizontalOptions = LayoutOptions.StartAndExpand,
                                VerticalOptions   = LayoutOptions.Center,
                            },
                            quantity,
                            quantityStepper
                        }
                    }
                },
                new ViewCell()
                {
                    View = new StackLayout()
                    {
                        Orientation = StackOrientation.Horizontal,
                        Padding     = new Thickness()
                        {
                            Left = paddingLeft
                        },
                        Children =
                        {
                            new Label()
                            {
                                Text = "Valutazione",
                                HorizontalOptions = LayoutOptions.StartAndExpand,
                                VerticalOptions   = LayoutOptions.Center,
                            },
                            rating,
                            ratingSlider
                        }
                    }
                },
                new ViewCell()
                {
                    View = new StackLayout()
                    {
                        Orientation = StackOrientation.Horizontal,
                        Padding     = new Thickness()
                        {
                            Left = paddingLeft
                        },
                        Children =
                        {
                            new Label()
                            {
                                Text = "Commento",
                                HorizontalOptions = LayoutOptions.Start,
                                VerticalOptions   = LayoutOptions.Center,
                            },
                            comment
                        }
                    }
                }
            });
            #endregion

            #endregion

            #region Addresses
            //List<AddressViewCell> addressViewsList = new List<AddressViewCell>();
            //TableSection addressesTableSection = new TableSection("Indirizzi");
            //foreach (AddressModel addressModel in bindingContext.AddressesList)
            //{
            //    addressesTableSection.Add(new AddressViewCell() { BindingContext = addressModel });
            //}
            //tableView.Root.Add(addressesTableSection);

            Button btnAddAddress = new Button()
            {
                Text = "Aggiungi indirizzo"
            };
            btnAddAddress.Clicked += BtnAddAddress_Clicked;
            //stackLayout.Children.Add(btnAddAddress);

            ListView addressesViews = new ListView();
            addressesViews.SetBinding(ListView.ItemsSourceProperty, nameof(bindingContext.AddressesList));
            addressesViews.ItemTemplate = new DataTemplate(typeof(AddressViewCell));
            addressesViews.RowHeight    = 200;
            //stackLayout.Children.Add(addressesViews);

            tableView.Root.Add(new TableSection("Indirizzi")
            {
                new ViewCell()
                {
                    View = btnAddAddress
                },
                new ViewCell()
                {
                    View = addressesViews
                }
            });
            #endregion

            stackLayout.Children.Add(tableView);
        }
Пример #23
0
        public SettingsPage()
        {
            BindingContext = new SettingsViewModel();

            var cameraSwitch = new SwitchCell {
                Text = "Rear Camera"
            };

            cameraSwitch.SetBinding(SwitchCell.OnProperty, new Binding("DefaultCameraRear"));

            var cameraLocation = new EntryCell {
                Label = "Camera Location", Keyboard = Keyboard.Default
            };

            cameraLocation.SetBinding(EntryCell.TextProperty, new Binding("CameraLocation", BindingMode.TwoWay));

            var timerEntry = new EntryCell {
                Label = "Camera Refresh", Keyboard = Keyboard.Numeric
            };

            timerEntry.SetBinding(EntryCell.TextProperty, new Binding("TimerInterval", BindingMode.TwoWay));

            var historyEntry = new EntryCell {
                Label = "History Refresh", Keyboard = Keyboard.Numeric
            };

            timerEntry.SetBinding(EntryCell.TextProperty, new Binding("HistoryInterval", BindingMode.TwoWay));

            //var clearDataLabel = new TextCell { Text = "Clear All Data" };
            //clearDataLabel.Tapped += async (s, e) =>
            //{
            //	var result = await DisplayAlert("Delete All Data", "Are you sure you wish to clear all stored data online?", "YES", "Cancel");
            //	if (result)
            //	{
            //		var response = await (BindingContext as SettingsModel).ResetData();
            //		DisplayAlert(response, "", "Ok");
            //	}
            //};

            Title   = "Settings";
            Content = new TableView
            {
                Root = new TableRoot {
                    new TableSection("Camera")
                    {
                        cameraLocation,
                        cameraSwitch
                    },

                    new TableSection("Monitor Interval")
                    {
                        timerEntry
                    },

                    new TableSection("History Interval")
                    {
                        timerEntry
                    },

                    //new TableSection("Data"){
                    //	clearDataLabel
                    //},
                }
            };
        }
        public SettingsPage(LaneModel laneModelTapped)
        {
            var viewModel = new SettingsViewModel(laneModelTapped);

            BindingContext = viewModel;

            #region create the IsOpen Switch
            var isOpenSwitch = new SwitchCell
            {
                Text = "Is Open"
            };
            isOpenSwitch.SetBinding(SwitchCell.OnProperty, "IsOpen");
            #endregion

            #region Create the Needs Maintenance Switch
            var needsMaintenanceSwitch = new SwitchCell
            {
                Text = "Needs Maintenance"
            };
            needsMaintenanceSwitch.SetBinding(SwitchCell.OnProperty, "NeedsMaintenance");
            #endregion

            #region create the IP Address Entry
            var ipAddressText = new EntryCell
            {
                Label = "IP Address",
                HorizontalTextAlignment = TextAlignment.End
            };
            ipAddressText.SetBinding(EntryCell.TextProperty, "IPAddress");
            #endregion

            #region Create Image Cell
            var imageCell = new ImageCell();
            imageCell.SetBinding(ImageCell.ImageSourceProperty, "ImageCellIcon");
            #endregion

            #region Create the Icon Toggle Button
            var iconToggleButton = new Button();
            iconToggleButton.SetBinding(Button.CommandProperty, "IconToggleButtonTapped");
            iconToggleButton.SetBinding(Button.TextProperty, "ToggleButtonText");
            #endregion

            #region create the TableView
            var tableView = new TableView
            {
                Intent = TableIntent.Settings,
                Root   = new TableRoot
                {
                    new TableSection {
                        isOpenSwitch,
                        needsMaintenanceSwitch,
                        ipAddressText,
                        imageCell
                    }
                }
            };
            #endregion

            #region Create StackLayout to Include a Button
            var settingsStack = new StackLayout
            {
                Children =
                {
                    tableView,
                    iconToggleButton
                }
            };
            #endregion

            NavigationPage.SetTitleIcon(this, "cogwheel_navigation");

            Title   = $"Lane {laneModelTapped.ID + 1} Settings";
            Content = settingsStack;
        }
Пример #25
0
        public TokenEntryPage()
        {
            //	Set	the	Content	Page	Title
            Title = "New Token Entry";

            //	Declare	and	initialize	our	Model	Binding	Context
            BindingContext = new TokenEntryViewModel(DependencyService.Get <IChikwamaNavService>());

            //	Define	our	New	Token	fields
            var tokenName = new EntryCell
            {
                Label       = "Name:",
                Placeholder = "Ether"
            };

            tokenName.SetBinding(EntryCell.TextProperty, "TokenName", BindingMode.TwoWay);

            var tokenAddress = new EntryCell
            {
                Label = "Account:",
                Text  = scannedAddress
            };

            tokenAddress.SetBinding(EntryCell.TextProperty, "TokenAddress", BindingMode.TwoWay);

            var qrCode = new TextCell
            {
                Text = "Scan QRCode"
            };

            qrCode.Tapped += ScanCustomPage;

            async void ScanCustomPage(object sender, EventArgs e)
            {
            }

            var tokenSymbol = new EntryCell
            {
                Label       = "Symbol:",
                Placeholder = "Eth",
            };

            tokenSymbol.SetBinding(EntryCell.TextProperty, "TokenSymbol", BindingMode.TwoWay);

            //	Define	our	TableView
            Content = new TableView
            {
                Intent = TableIntent.Form,
                Root   = new TableRoot
                {
                    new TableSection()
                    {
                        tokenName,
                        tokenAddress,
                        qrCode,
                        tokenSymbol
                    }
                }
            };


            var saveToken = new ToolbarItem
            {
                Text = "Save"
            };

            saveToken.SetBinding(MenuItem.CommandProperty, "SaveCommand");

            ToolbarItems.Add(saveToken);
        }
Пример #26
0
        public App()
        {
            var current = new TextCell {
                Text = "Use Current GPS Coords"
            };

            current.SetBinding(TextCell.CommandProperty, "UseCurrentGps");

            var lat = new EntryCell {
                Label = "Center Lat"
            };

            lat.SetBinding(EntryCell.TextProperty, "CenterLatitude", converter: new DoubleConverter());

            var lng = new EntryCell {
                Label = "Center Lng"
            };

            lng.SetBinding(EntryCell.TextProperty, "CenterLongitude", converter: new DoubleConverter());

            var radius = new EntryCell {
                Label = "Radius (meters)"
            };

            radius.SetBinding(EntryCell.TextProperty, "DistanceMeters", converter: new DoubleConverter());

            var btn = new TextCell {
                Text = "Set Geofence"
            };

            btn.SetBinding(TextCell.CommandProperty, "SetGeofence");

            var btnStop = new TextCell {
                Text = "Stop Geofence"
            };

            btnStop.SetBinding(TextCell.CommandProperty, "StopGeofence");

            var btnStatus = new TextCell {
                Text = "Request Current Status"
            };

            btnStatus.SetBinding(TextCell.CommandProperty, "RequestStatus");

            this.MainPage = new NavigationPage(new ContentPage
            {
                Title          = "ACR Geofencing",
                BindingContext = new MainViewModel(),
                Content        = new TableView
                {
                    Root = new TableRoot
                    {
                        new TableSection("Details")
                        {
                            lat,
                            lng,
                            radius
                        },
                        new TableSection("Actions")
                        {
                            current,
                            btn,
                            btnStop,
                            btnStatus
                        }
                    }
                }
            });
        }
Пример #27
0
        public OrderDetailPage(Order order)
        {
            BindingContext = orderModel = new OrderDetailModel(order);

            Title = "Order " + order.OrderNumber;

            var image = new Image();

            image.SetBinding(Image.SourceProperty, new Binding("ImageUrl", BindingMode.Default, new UrlToImageSourceConverter()));
            image.Aspect        = Aspect.AspectFit;
            image.WidthRequest  = 200;
            image.HeightRequest = 200;

            //-------------

            var entryOrderStatus = new EntryCell {
                Label = "Status", Placeholder = "", IsEnabled = false
            };

            entryOrderStatus.SetBinding(EntryCell.TextProperty, new Binding("OrderStatus"));

            var entryOrderDate = new EntryCell {
                Label = "Order Date", Placeholder = "", IsEnabled = false
            };

            entryOrderDate.SetBinding(EntryCell.TextProperty, new Binding("Date"));

            var entryDescription = new EntryCell {
                Label = "Order", IsEnabled = false
            };

            entryDescription.SetBinding(EntryCell.TextProperty, new Binding("Description"));

            var entryTotal = new EntryCell {
                Label = "Total", Placeholder = "", IsEnabled = false
            };

            entryTotal.SetBinding(EntryCell.TextProperty, new Binding("Total", BindingMode.TwoWay));

            //-------------
            var entryFirstName = new EntryCell {
                Label = "First Name", Placeholder = "", IsEnabled = false
            };

            entryFirstName.SetBinding(EntryCell.TextProperty, new Binding("FirstName"));

            var entryLastName = new EntryCell {
                Label = "Last Name", Placeholder = "", IsEnabled = false
            };

            entryLastName.SetBinding(EntryCell.TextProperty, new Binding("LastName"));

            var entryGender = new EntryCell {
                Label = "Gender", Placeholder = "", IsEnabled = false
            };

            entryGender.SetBinding(EntryCell.TextProperty, new Binding("Gender", BindingMode.Default));

            var entryAge = new EntryCell {
                Label = "Age", Placeholder = "", IsEnabled = false
            };

            entryAge.SetBinding(EntryCell.TextProperty, new Binding("Age", BindingMode.Default, stringFormat: "{0:F1}"));

            var entryEmotion = new EntryCell {
                Label = "Emotion", Placeholder = "", IsEnabled = false
            };

            entryEmotion.SetBinding(EntryCell.TextProperty, new Binding("Emotion", BindingMode.Default));

            var labelPreviousOrders = new TextCell();

            labelPreviousOrders.Text    = "Previous Orders";
            labelPreviousOrders.Tapped += (sender, e) =>
            {
                Console.WriteLine("Navigate to details");
            };

            Content = new TableView
            {
                HasUnevenRows = true,
                Root          = new TableRoot {
                    new TableSection("Order")
                    {
                        entryOrderDate,
                        entryOrderStatus,
                        entryDescription,
                        entryTotal
                    },

                    new TableSection("Photo")
                    {
                        new ViewCell()
                        {
                            View = image
                        }
                    },
                    new TableSection("Customer")
                    {
                        entryFirstName,
                        entryLastName,
                        entryGender,
                        entryAge,
                        entryEmotion,
                        labelPreviousOrders
                    }
                },
                Intent = TableIntent.Settings
            };

            this.ToolbarItems.Add(
                new ToolbarItem("Status", null, async() => OnActionSheetSimpleClicked())
                );
        }
Пример #28
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;
        }
Пример #29
0
        public LeadDetailPage()
        {
            #region name entry
            EntryCell companyNameEntryCell = new EntryCell()
            {
                Label       = TextResources.Leads_LeadDetail_CompanyName,
                Placeholder = TextResources.Leads_LeadDetail_CompanyNamePlaceholder,
                Keyboard    = Keyboard.Text
            };
            companyNameEntryCell.SetBinding(EntryCell.TextProperty, "Lead.Company", BindingMode.TwoWay);
            #endregion

            #region industry picker
            PickerCell industryPickerCell = new PickerCell();
            industryPickerCell.Label.Text = TextResources.Leads_LeadDetail_Industry;
            foreach (var industry in Account.IndustryTypes)
            {
                industryPickerCell.Picker.Items.Add(industry);
            }
            industryPickerCell.Picker.SetBinding(Picker.SelectedIndexProperty, "Lead.IndustryTypeCurrentIndex", BindingMode.TwoWay);
            industryPickerCell.Picker.SelectedIndexChanged += (sender, e) =>
            {
                ViewModel.Lead.Industry = industryPickerCell.Picker.Items[industryPickerCell.Picker.SelectedIndex];
            };
            #endregion

            #region opportunity size entry
            EntryCell opportunitySizeEntryCell = new EntryCell()
            {
                Label       = TextResources.Leads_LeadDetail_OpportunitySize,
                Placeholder = TextResources.Leads_LeadDetail_OpportunitySizePlaceholder,
                Keyboard    = Keyboard.Numeric
            };
            opportunitySizeEntryCell.SetBinding(EntryCell.TextProperty, "Lead.OpportunitySize", BindingMode.TwoWay, new CurrencyDoubleConverter());
            #endregion

            #region opportunity stage picker
            PickerCell opportunityStagePickerCell = new PickerCell();
            opportunityStagePickerCell.Label.Text = TextResources.Leads_LeadDetail_OpportunityStage;
            foreach (var opportunityStage in Account.OpportunityStages)
            {
                opportunityStagePickerCell.Picker.Items.Add(opportunityStage);
            }
            opportunityStagePickerCell.Picker.SetBinding(Picker.SelectedIndexProperty, "Lead.OpportunityStageCurrentIndex", BindingMode.TwoWay);
            opportunityStagePickerCell.Picker.SelectedIndexChanged += (sender, e) =>
            {
                ViewModel.Lead.OpportunityStage = opportunityStagePickerCell.Picker.Items[opportunityStagePickerCell.Picker.SelectedIndex];
            };
            #endregion

            #region roleEntry
            EntryCell roleEntryCell = new EntryCell()
            {
                Label    = TextResources.Leads_LeadContactDetail_Role, LabelColor = Palette._007,
                Keyboard = Keyboard.Text
            };
            roleEntryCell.SetBinding(EntryCell.TextProperty, "Lead.JobTitle", BindingMode.TwoWay);
            #endregion

            #region firstNameEntry
            EntryCell firstNameEntryCell = new EntryCell()
            {
                Label    = TextResources.Leads_LeadContactDetail_FirstName,
                Keyboard = Keyboard.Text
            };
            firstNameEntryCell.SetBinding(EntryCell.TextProperty, "Lead.FirstName", BindingMode.TwoWay);
            #endregion

            #region lastNameEntry
            EntryCell lastNameEntryCell = new EntryCell()
            {
                Label    = TextResources.Leads_LeadContactDetail_LastName,
                Keyboard = Keyboard.Text
            };
            lastNameEntryCell.SetBinding(EntryCell.TextProperty, "Lead.LastName", BindingMode.TwoWay);
            #endregion

            #region phoneEntry
            EntryCell phoneEntryCell = new EntryCell()
            {
                Label    = TextResources.Leads_LeadContactDetail_Phone,
                Keyboard = Keyboard.Telephone
            };
            phoneEntryCell.SetBinding(EntryCell.TextProperty, "Lead.Phone", BindingMode.TwoWay);
            #endregion

            #region emailEntry
            EntryCell emailEntryCell = new EntryCell()
            {
                Label    = TextResources.Leads_LeadContactDetail_Email,
                Keyboard = Keyboard.Email
            };
            emailEntryCell.SetBinding(EntryCell.TextProperty, "Lead.Email", BindingMode.TwoWay);
            #endregion

            #region streetEntry
            EntryCell streetEntryCell = new EntryCell()
            {
                Label    = TextResources.Leads_LeadContactDetail_Address,
                Keyboard = Keyboard.Text
            };
            streetEntryCell.SetBinding(EntryCell.TextProperty, "Lead.Street", BindingMode.TwoWay);
            #endregion

            #region postalCodeEntry
            EntryCell postalCodeEntryCell = new EntryCell()
            {
                Label    = TextResources.Leads_LeadContactDetail_PostalCode,
                Keyboard = Keyboard.Numeric
            };
            postalCodeEntryCell.SetBinding(EntryCell.TextProperty, "Lead.PostalCode", BindingMode.TwoWay);
            #endregion

            #region cityEntry
            EntryCell cityEntryCell = new EntryCell()
            {
                Label    = TextResources.Leads_LeadContactDetail_City,
                Keyboard = Keyboard.Text
            };
            cityEntryCell.SetBinding(EntryCell.TextProperty, "Lead.City", BindingMode.TwoWay);
            #endregion

            #region stateEntry
            EntryCell stateEntryCell = new EntryCell()
            {
                Label    = TextResources.Leads_LeadContactDetail_State,
                Keyboard = Keyboard.Text
            };
            stateEntryCell.SetBinding(EntryCell.TextProperty, "Lead.State", BindingMode.TwoWay);
            #endregion

            #region countryEntry
            EntryCell countryEntryCell = new EntryCell()
            {
                Label    = TextResources.Leads_LeadContactDetail_Country,
                Keyboard = Keyboard.Text
            };
            countryEntryCell.SetBinding(EntryCell.TextProperty, "Lead.Country", BindingMode.TwoWay);
            #endregion

            #region compose view hierarchy

            Content = new TableView()
            {
                Intent = TableIntent.Settings,
                Root   = new TableRoot()
                {
                    new TableSection("Company")
                    {
                        companyNameEntryCell,
                        industryPickerCell
                    },
                    new TableSection(TextResources.Leads_LeadDetail_OpportunityHeading)
                    {
                        opportunitySizeEntryCell,
                        opportunityStagePickerCell
                    },
                    new TableSection("Info")
                    {
                        roleEntryCell,
                        firstNameEntryCell,
                        lastNameEntryCell
                    },
                    new TableSection("Contact")
                    {
                        phoneEntryCell,
                        emailEntryCell
                    },
                    new TableSection("Address")
                    {
                        streetEntryCell,
                        postalCodeEntryCell,
                        cityEntryCell,
                        stateEntryCell,
                        countryEntryCell
                    }
                }
            };

            #endregion
        }
Пример #30
0
        // NOTE: the ViewModel is contained in the base class

        public LeadContactDetailPage()
        {
            #region roleEntry
            EntryCell roleEntryCell = new EntryCell()
            {
                Label      = TextResources.Leads_LeadContactDetail_Role,
                LabelColor = Palette._007,
                Keyboard   = Keyboard.Text
            };
            roleEntryCell.SetBinding(EntryCell.TextProperty, "Lead.JobTitle", BindingMode.TwoWay);
            #endregion

            #region firstNameEntry
            EntryCell firstNameEntryCell = new EntryCell()
            {
                Label    = TextResources.Leads_LeadContactDetail_FirstName,
                Keyboard = Keyboard.Text
            };
            firstNameEntryCell.SetBinding(EntryCell.TextProperty, "Lead.FirstName", BindingMode.TwoWay);
            #endregion

            #region lastNameEntry
            EntryCell lastNameEntryCell = new EntryCell()
            {
                Label    = TextResources.Leads_LeadContactDetail_LastName,
                Keyboard = Keyboard.Text
            };
            lastNameEntryCell.SetBinding(EntryCell.TextProperty, "Lead.LastName", BindingMode.TwoWay);
            #endregion

            #region phoneEntry
            EntryCell phoneEntryCell = new EntryCell()
            {
                Label    = TextResources.Leads_LeadContactDetail_Phone,
                Keyboard = Keyboard.Telephone
            };
            phoneEntryCell.SetBinding(EntryCell.TextProperty, "Lead.Phone", BindingMode.TwoWay);
            #endregion

            #region emailEntry
            EntryCell emailEntryCell = new EntryCell()
            {
                Label    = TextResources.Leads_LeadContactDetail_Email,
                Keyboard = Keyboard.Email
            };
            emailEntryCell.SetBinding(EntryCell.TextProperty, "Lead.Email", BindingMode.TwoWay);
            #endregion

            #region streetEntry
            EntryCell streetEntryCell = new EntryCell()
            {
                Label    = TextResources.Leads_LeadContactDetail_Address,
                Keyboard = Keyboard.Text
            };
            streetEntryCell.SetBinding(EntryCell.TextProperty, "Lead.Street", BindingMode.TwoWay);
            #endregion

            #region postalCodeEntry
            EntryCell postalCodeEntryCell = new EntryCell()
            {
                Label    = TextResources.Leads_LeadContactDetail_PostalCode,
                Keyboard = Keyboard.Numeric
            };
            postalCodeEntryCell.SetBinding(EntryCell.TextProperty, "Lead.PostalCode", BindingMode.TwoWay);
            #endregion

            #region cityEntry
            EntryCell cityEntryCell = new EntryCell()
            {
                Label    = TextResources.Leads_LeadContactDetail_City,
                Keyboard = Keyboard.Text
            };
            cityEntryCell.SetBinding(EntryCell.TextProperty, "Lead.City", BindingMode.TwoWay);
            #endregion

            #region stateEntry
            EntryCell stateEntryCell = new EntryCell()
            {
                Label    = TextResources.Leads_LeadContactDetail_State,
                Keyboard = Keyboard.Text
            };
            stateEntryCell.SetBinding(EntryCell.TextProperty, "Lead.State", BindingMode.TwoWay);
            #endregion

            #region countryEntry
            EntryCell countryEntryCell = new EntryCell()
            {
                Label    = TextResources.Leads_LeadContactDetail_Country,
                Keyboard = Keyboard.Text
            };
            countryEntryCell.SetBinding(EntryCell.TextProperty, "Lead.Country", BindingMode.TwoWay);
            #endregion

            #region compose view hierarchy
            Content = new TableView()
            {
                Intent = TableIntent.Settings,
                Root   = new TableRoot()
                {
                    new TableSection()
                    {
                        roleEntryCell,
                        firstNameEntryCell,
                        lastNameEntryCell
                    },
                    new TableSection()
                    {
                        phoneEntryCell,
                        emailEntryCell
                    },
                    new TableSection()
                    {
                        streetEntryCell,
                        postalCodeEntryCell,
                        cityEntryCell,
                        stateEntryCell,
                        countryEntryCell
                    }
                }
            };
            #endregion
        }
Пример #31
0
        public RelayCardPage()
        {
            //Bind the name of the card to the title of the page
            this.SetBinding(Page.TitleProperty, "Name");

            //Enable NavigationBar
            NavigationPage.SetHasNavigationBar(this, true);

            // Create the Name Section
            var nameSection = new TableSection();

            nameSection.Title = "Name of the card";
            //Create the name cell and bind it to the Name
            var nameCell = new EntryCell();

            nameCell.SetBinding(EntryCell.TextProperty, "Name");
            nameCell.Label = "Name:";
            //add the name cell to the section
            nameSection.Add(nameCell);
            //Create the username cell and bind it to the Username
            var loginCell = new EntryCell();

            loginCell.SetBinding(EntryCell.TextProperty, "Username");
            loginCell.Label = "Username:"******"Password");
            passwordCell.Label = "Password:"******"Local Network Settings";
            var localIPCell = new EntryCell();

            localIPCell.Label = "Local IP:";
            localIPCell.SetBinding(EntryCell.TextProperty, "LocalIp");
            var localPortCell = new EntryCell();

            localPortCell.Label = "Local Port:";
            localPortCell.SetBinding(EntryCell.TextProperty, "LocalPort");
            localPortCell.Keyboard = Keyboard.Numeric;
            localNetworkSection.Add(localIPCell);
            localNetworkSection.Add(localPortCell);


            //External Table Section
            var externalNetworkSection = new TableSection();

            externalNetworkSection.Title = "Extern Network Settings";
            var externIPCell = new EntryCell();

            externIPCell.Label = "External IP:";
            externIPCell.SetBinding(EntryCell.TextProperty, "ExternalIp");
            var externPortCell = new EntryCell();

            externPortCell.Label = "External Port:";
            externPortCell.SetBinding(EntryCell.TextProperty, "ExternalPort");
            externPortCell.Keyboard = Keyboard.Numeric;
            externalNetworkSection.Add(externIPCell);
            externalNetworkSection.Add(externPortCell);

            var localConnectSection = new TableSection();

            localConnectSection.Title = "CONNECT TO LOCAL IP";
            var localConnectCell = new SwitchCell();

            localConnectCell.Text = "Connect to local network;";
            localConnectCell.SetBinding(SwitchCell.OnProperty, "ConnectLocal");
            localConnectSection.Add(localConnectCell);

            //Create Scan Button
            var scanButton = new Button {
                Text = "Scan"
            };

            //
            scanButton.Clicked += (object sender, EventArgs e) => {
                var discoveryPage = new RelayCardDiscoveryPage();

                discoveryPage.BindingContext = BindingContext;

                Navigation.PushAsync(discoveryPage);
            };

            var cancelButton = new Button {
                Text = "Cancel"
            };

            cancelButton.Clicked += (sender, e) => this.Navigation.PopAsync();

            Content = new StackLayout {
                VerticalOptions = LayoutOptions.StartAndExpand,
                Children        =
                {
                    new TableView {
                        Intent = TableIntent.Form,
                        Root   = new TableRoot("RelayCard")
                        {
                            nameSection,
                            localNetworkSection,
                            externalNetworkSection,
                            localConnectSection
                        }
                    }, scanButton
                }
            };
        }