public TechnicianPage(App application)
        {
            InitializeComponent();

            _vm            = new TechnicianPageViewModel();
            BindingContext = _vm.TechnicianGroup;
        }
        public TechnicianPage(TechnicianPageViewModel viewModel)
        {
            InitializeComponent();

            _vm            = viewModel;
            BindingContext = _vm.TechnicianGroup;
        }
Example #3
0
        //Label _labelTitle;
        //Label _labelTechnicianNo;
        //Label _labelFirstName;
        //Label _labelLastName;
        //ComboBox _pickerTechnicianStatus;
        //Button _buttonOK;

        public TechnicianPage()
        {
            InitializeComponent();

            //  Create a label for the technician list
            //_labelTitle = new Label();
            //_labelTitle.Content = "TECHNICIAN DETAILS";
            //_labelTitle.FontWeight = FontWeights.Bold;
            //_labelTitle.FontSize = 18;
            //_labelTitle.Foreground = new SolidColorBrush(Colors.White);
            //_labelTitle.HorizontalAlignment = HorizontalAlignment.Center;
            //_labelTitle.VerticalAlignment = VerticalAlignment.Center;

            //Grid titleLayout = new Grid()
            //{
            //    Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3498DB")),
            //    //HorizontalAlignment = HorizontalAlignment.Stretch,
            //    Height = 100
            //};
            //titleLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
            //titleLayout.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });
            //titleLayout.Children.Add(_labelTitle);
            //Grid.SetColumn(_labelTitle, 0);
            //Grid.SetRow(_labelTitle, 0);

            _vm = new TechnicianPageViewModel();

            SolidColorBrush asbestos = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#7f8c8d"));

            this.DataContext = _vm.Technician;

            lblTechDeptNumber.Content = _vm.Technician.FormattedTechnicianNumber;
            lblTechnicianName.Content = String.Format("{0} {1}", _vm.Technician.FirstName, _vm.Technician.LastName);

            pkrTechnicianStatus.ItemsSource = _vm.TechnicianStatusList;

            //_labelTechnicianNo = new Label();
            //_labelTechnicianNo.Foreground = asbestos;
            //_labelTechnicianNo.SetBinding(ContentProperty, "FormattedTechnicianNumber");

            //_labelFirstName = new Label();
            //_labelFirstName.Foreground = asbestos;
            //_labelFirstName.SetBinding(ContentProperty, "FirstName");

            //_labelLastName = new Label();
            //_labelLastName.Foreground = asbestos;
            //_labelLastName.SetBinding(ContentProperty, "LastName");

            //_pickerTechnicianStatus = new ComboBox { ItemsSource = _vm.TechnicianStatusList };
            //_pickerTechnicianStatus.DisplayMemberPath =  "StatusDescription";
            SetPickerTechnicianStatus();

            //_buttonOK = new Button();
            //_buttonOK.Content = "OK";
            //_buttonOK.Height = 50;
            //_buttonOK.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#3498DB"));
            //_buttonOK.Foreground = new SolidColorBrush(Colors.White);
            //_buttonOK.Click += ButtonOK_Clicked;

            //gridMain.Children.Add(new StackPanel
            //{
            //    Margin = new Thickness(30, 10, 30, 10),
            //    Children = {
            //titleLayout,
            //_labelTechnicianNo,
            //new StackPanel
            //{
            //    Orientation = Orientation.Horizontal,
            //    Children =
            //    {
            //        _labelFirstName,
            //        new Label { Content = ", ", Foreground = asbestos },
            //        _labelLastName,
            //    }
            //},
            //_pickerTechnicianStatus,
            //_buttonOK
            //    }
            //});
        }
        public TechnicianPage()
        {
            // Set the page title.
            Title = "Technician";

            BackgroundColor = Color.White;
            //  Create a label for the technician list
            _labelTitle            = new Label();
            _labelTitle.Text       = "TECHNICIAN DETAILS";
            _labelTitle.FontFamily = Device.OnPlatform("OpenSans-Bold", "sans-serif-black", null);
            _labelTitle.FontSize   = 22;
            _labelTitle.TextColor  = Color.White;
            _labelTitle.HorizontalTextAlignment = TextAlignment.Center;
            _labelTitle.VerticalTextAlignment   = TextAlignment.Center;

            Grid titleLayout = new Grid()
            {
                BackgroundColor   = Color.FromHex("#2980b9"),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                HeightRequest     = 80
            };

            titleLayout.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });
            titleLayout.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            titleLayout.Children.Add(_labelTitle, 0, 0);

            _vm = new TechnicianPageViewModel();

            Color asbestos = Color.FromHex("#7f8c8d");

            this.BindingContext = _vm.Technician;

            _labelTechnicianNo            = new Label();
            _labelTechnicianNo.TextColor  = asbestos;
            _labelTechnicianNo.FontFamily = Device.OnPlatform("OpenSans-Regular", "sans-serif", null);
            _labelTechnicianNo.SetBinding(Xamarin.Forms.Label.TextProperty, "FormattedTechnicianNumber");

            _labelFirstName            = new Label();
            _labelFirstName.TextColor  = asbestos;
            _labelFirstName.FontFamily = Device.OnPlatform("OpenSans-Regular", "sans-serif", null);
            _labelFirstName.SetBinding(Xamarin.Forms.Label.TextProperty, "FirstName");

            _labelLastName            = new Label();
            _labelLastName.FontFamily = Device.OnPlatform("OpenSans-Regular", "sans-serif", null);
            _labelLastName.TextColor  = asbestos;
            _labelLastName.SetBinding(Xamarin.Forms.Label.TextProperty, "LastName");

            _pickerTechnicianStatus = new BindablePicker {
                Title = "Technician Status", ItemsSource = _vm.TechnicianStatusList
            };
            _pickerTechnicianStatus.SetBinding(BindablePicker.DisplayPropertyProperty, "StatusDescription");
            SetPickerTechnicianStatus();

            _buttonOK                 = new Button();
            _buttonOK.Text            = "OK";
            _buttonOK.VerticalOptions = LayoutOptions.Fill;
            _buttonOK.BackgroundColor = Color.FromHex("#3498DB");
            _buttonOK.TextColor       = Color.White;
            _buttonOK.Clicked        += ButtonOK_Clicked;

            Content = new StackLayout
            {
                Padding  = 30,
                Children =
                {
                    titleLayout,
                    //               new Xamarin.Forms.Label
                    //{ Text = "TECHNICIAN DETAILS", FontFamily = Device.OnPlatform("OpenSans-Bold","sans-serif-black", null), TextColor = asbestos },
                    _labelTechnicianNo,
                    new StackLayout
                    {
                        Orientation = StackOrientation.Horizontal,

                        Children =
                        {
                            _labelFirstName,
                            new Xamarin.Forms.Label {
                                Text = ", ",FontFamily  = Device.OnPlatform("OpenSans-Regular", "sans-serif", null), TextColor = asbestos
                            },
                            _labelLastName,
                        }
                    },
                    _pickerTechnicianStatus,
                    _buttonOK
                }
            };
        }