public ConferenceSelectionPage(string identifier)
        {
            Title = "Conference";
            ViewModel.ConferenceIdentifier = identifier;
            _conferenceIdentifier          = ViewModel.ConferenceIdentifier;

            var label = new Label {
                StyleId           = "label_instructions",
                Style             = StyleKit.DarkLabelStyles.Action,
                Text              = "Please enter the number for the SQL Saturday you will be attending.",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                XAlign            = TextAlignment.Center,
            };

            var conferenceEntry = new DoneEntry {
                StyleId           = "text_conference",
                Placeholder       = "Conference #",
                Keyboard          = Keyboard.Numeric,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                TextColor         = Device.OnPlatform(Colors.SecondaryTextColor, Colors.TextColor, Colors.TextColor)
            };

            conferenceEntry.SetBinding(Entry.TextProperty, "ConferenceIdentifier");

            var buttonStack = CreateButtonStack(!string.IsNullOrEmpty(_conferenceIdentifier));

            var innerStackLayout = new StackLayout {
                Padding     = new Thickness(20, 45, 20, 5),
                Spacing     = 30,
                Orientation = StackOrientation.Vertical,
                Children    = { label, conferenceEntry, buttonStack }
            };

            var stackLayout = new StackLayout {
                BackgroundColor = Colors.DarkPrimaryColor,
                Children        = { innerStackLayout }
            };

            Content = stackLayout;
        }
Пример #2
0
        public ContactPage()
        {
            this.SetBinding(ContentPage.TitleProperty, "FirstName");
            NavigationPage.SetHasNavigationBar(this, true);

            var firstNameLabel = new Label { Text = "First Name" };
            var firstNameEntry = new DoneEntry { Keyboard = Keyboard.Text };
            firstNameEntry.SetBinding(Entry.TextProperty, "FirstName");

            var lastNameLabel = new Label { Text = "Last Name" };
            var lastNameEntry = new DoneEntry { Keyboard = Keyboard.Text };
            lastNameEntry.SetBinding(Entry.TextProperty, "LastName");

            var homePhoneNumberLabel = new Label { Text = "Home Phone" };
            var homePhoneNumberEntry = new DoneEntry { Keyboard = Keyboard.Telephone };
            homePhoneNumberEntry.SetBinding(Entry.TextProperty, "HomePhoneNumber");

            var workPhoneNumberLabel = new Label { Text = "Work Phone" };
            var workPhoneNumberEntry = new DoneEntry { Keyboard = Keyboard.Telephone };
            workPhoneNumberEntry.SetBinding(Entry.TextProperty, "WorkPhoneNumber");

            var mobileNumberLabel = new Label { Text = "Mobile Number" };
            var mobileNumberEntry = new DoneEntry { Keyboard = Keyboard.Telephone };
            mobileNumberEntry.SetBinding(Entry.TextProperty, "MobileNumber");

            var emailLabel = new Label { Text = "Email" };
            var emailEntry = new DoneEntry { Keyboard = Keyboard.Email };
            emailEntry.SetBinding(Entry.TextProperty, "EmailAddress");

            var saveButton = new Button { Text = "Save"};
            saveButton.Clicked += async (sender, e) =>
            {
                var contact = (Contact)BindingContext;
                var id = await AmazonUtils.Credentials.GetIdentityIdAsync();
                DynamoDBOperationConfig config = new DynamoDBOperationConfig
                {
                    IgnoreNullValues = false
                };
                if (string.IsNullOrEmpty(contact.UserId))
                {
                    var userId = Guid.NewGuid().ToString();
                    contact.Id = id;
                    contact.UserId = userId;
                }
                await AmazonUtils.DDBContext.SaveAsync<Contact>(contact, config);
                Navigation.PopAsync();
            };

            var deleteButton = new Button { Text = "Delete", BorderColor = Color.Red, BorderRadius = 2 };
            deleteButton.Clicked += async (sender, e) =>
            {
                var contact = (Contact)BindingContext;
                if (!string.IsNullOrEmpty(contact.UserId))
                {
                    contact.Id = await AmazonUtils.Credentials.GetIdentityIdAsync();
                    await AmazonUtils.DDBContext.DeleteAsync<Contact>(contact);
                }

                Navigation.PopAsync();
            };

            var cancelButton = new Button { Text = "Cancel", BorderColor = Color.Gray, BorderRadius = 2 };
            cancelButton.Clicked += (sender, e) =>
            {
                Navigation.PopAsync();
            };

            Content = new ScrollView
            {
                Content = new StackLayout
                {
                    VerticalOptions = LayoutOptions.StartAndExpand,
                    Padding = new Thickness(20),
                    Children = {
					    firstNameLabel, firstNameEntry, 
					    lastNameLabel, lastNameEntry,
					    homePhoneNumberLabel, homePhoneNumberEntry,
                        workPhoneNumberLabel, workPhoneNumberEntry,
                        mobileNumberLabel, mobileNumberEntry,
                        emailLabel, emailEntry,
					    saveButton, cancelButton,deleteButton
				    }
                }
            };
        }
Пример #3
0
        public ServerPage()
        {
            var serverLabel = new Label
            {
                FontFamily = "HelveticaNeue-Medium",
                FontSize   = Device.OnPlatform(18, 18, 24),
                TextColor  = Color.White,
                Text       = "Server",
                StyleId    = "serverLabel"
            };
            var serverText = new Entry
            {
                StyleId = "serverEntry"
            };

            serverText.SetBinding <ServerViewModel>(Entry.TextProperty, x => x.Host);

            var portLabel = new Label
            {
                FontFamily = "HelveticaNeue-Medium",
                FontSize   = Device.OnPlatform(18, 18, 24),
                TextColor  = Color.White,
                Text       = "Port",
                StyleId    = "portLabel"
            };
            var portText = new DoneEntry
            {
                Keyboard = Keyboard.Numeric,
                StyleId  = "portEntry",
            };

            portText.SetBinding <ServerViewModel>(Entry.TextProperty, x => x.Port);

            serverText.Completed += (sender, e) => portText.Focus();

            var save = new Button
            {
                Text    = "Save",
                StyleId = "saveButton"
            };

            save.Clicked += OnSaveButtonClicked;
            save.SetBinding <ServerViewModel>(Button.IsEnabledProperty, x => x.CanSave);

            var delete = new Button
            {
                Text      = "Delete",
                StyleId   = "deleteButton",
                TextColor = Color.Red
            };

            delete.Clicked += OnDeleteButtonClicked;
            delete.SetBinding <ServerViewModel>(Button.IsVisibleProperty, x => x.CanDelete);

            var layout = new StackLayout
            {
                VerticalOptions = LayoutOptions.StartAndExpand,
                Padding         = new Thickness(10),
                Children        =
                {
                    serverLabel, serverText,
                    portLabel,   portText,
                    save,        delete
                }
            };

            Content         = layout;
            BackgroundColor = Color.Black;
            Title           = "Server Settings";
            StyleId         = "settingsPage";
        }
Пример #4
0
        public ContactPage()
        {
            this.SetBinding(ContentPage.TitleProperty, "FirstName");
            NavigationPage.SetHasNavigationBar(this, true);

            var firstNameLabel = new Label {
                Text = "First Name"
            };
            var firstNameEntry = new DoneEntry {
                Keyboard = Keyboard.Text
            };

            firstNameEntry.SetBinding(Entry.TextProperty, "FirstName");

            var lastNameLabel = new Label {
                Text = "Last Name"
            };
            var lastNameEntry = new DoneEntry {
                Keyboard = Keyboard.Text
            };

            lastNameEntry.SetBinding(Entry.TextProperty, "LastName");

            var homePhoneNumberLabel = new Label {
                Text = "Home Phone"
            };
            var homePhoneNumberEntry = new DoneEntry {
                Keyboard = Keyboard.Telephone
            };

            homePhoneNumberEntry.SetBinding(Entry.TextProperty, "HomePhoneNumber");

            var workPhoneNumberLabel = new Label {
                Text = "Work Phone"
            };
            var workPhoneNumberEntry = new DoneEntry {
                Keyboard = Keyboard.Telephone
            };

            workPhoneNumberEntry.SetBinding(Entry.TextProperty, "WorkPhoneNumber");

            var mobileNumberLabel = new Label {
                Text = "Mobile Number"
            };
            var mobileNumberEntry = new DoneEntry {
                Keyboard = Keyboard.Telephone
            };

            mobileNumberEntry.SetBinding(Entry.TextProperty, "MobileNumber");

            var emailLabel = new Label {
                Text = "Email"
            };
            var emailEntry = new DoneEntry {
                Keyboard = Keyboard.Email
            };

            emailEntry.SetBinding(Entry.TextProperty, "EmailAddress");

            var saveButton = new Button {
                Text = "Save"
            };

            saveButton.Clicked += async(sender, e) =>
            {
                var contact = (Contact)BindingContext;
                var id      = await AmazonUtils.Credentials.GetIdentityIdAsync();

                DynamoDBOperationConfig config = new DynamoDBOperationConfig
                {
                    IgnoreNullValues = false
                };
                if (string.IsNullOrEmpty(contact.UserId))
                {
                    var userId = Guid.NewGuid().ToString();
                    contact.Id     = id;
                    contact.UserId = userId;
                }
                await AmazonUtils.DDBContext.SaveAsync <Contact>(contact, config);

                Navigation.PopAsync();
            };

            var deleteButton = new Button {
                Text = "Delete", BorderColor = Color.Red, BorderRadius = 2
            };

            deleteButton.Clicked += async(sender, e) =>
            {
                var contact = (Contact)BindingContext;
                if (!string.IsNullOrEmpty(contact.UserId))
                {
                    contact.Id = await AmazonUtils.Credentials.GetIdentityIdAsync();

                    await AmazonUtils.DDBContext.DeleteAsync <Contact>(contact);
                }

                Navigation.PopAsync();
            };

            var cancelButton = new Button {
                Text = "Cancel", BorderColor = Color.Gray, BorderRadius = 2
            };

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

            Content = new ScrollView
            {
                Content = new StackLayout
                {
                    VerticalOptions = LayoutOptions.StartAndExpand,
                    Padding         = new Thickness(20),
                    Children        =
                    {
                        firstNameLabel,       firstNameEntry,
                        lastNameLabel,        lastNameEntry,
                        homePhoneNumberLabel, homePhoneNumberEntry,
                        workPhoneNumberLabel, workPhoneNumberEntry,
                        mobileNumberLabel,    mobileNumberEntry,
                        emailLabel,           emailEntry,
                        saveButton,           cancelButton, deleteButton
                    }
                }
            };
        }