Example #1
0
        public LoginForm() : base(DisplayConstants.Login)
        {
            m_Header = new HWHeader(DisplayConstants.Login);
            OutsideLayout.Children.Add(m_Header);

            m_txtUsername = new HWTextEntry()
            {
                Title       = DisplayConstants.Username,
                Placeholder = DisplayConstants.UsernameInstruction
            };
            OutsideLayout.Children.Add(m_txtUsername);

            m_txtPassword = new HWTextEntry()
            {
                Title       = DisplayConstants.Password,
                Placeholder = DisplayConstants.PasswordInstruction,
                IsPassword  = true
            };
            OutsideLayout.Children.Add(m_txtPassword);

            m_btnLogin = new HWButton()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Text            = DisplayConstants.Login,
                BackgroundColor = Color.White,
                BorderWidth     = 1,
                BorderColor     = Color.Black,
                Margin          = new Thickness(10, 10, 10, 10)
            };
            m_btnLogin.Clicked += btnLoginClicked;
            OutsideLayout.Children.Add(m_btnLogin);
        }
Example #2
0
        public DefaultForm() : base("Home")
        {
            m_lblTags = new HWLabel
            {
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                Text   = "Loading Tag Count",
                Margin = new Thickness(0, 10, 0, 10)
            };
            OutsideLayout.Children.Add(m_lblTags);

            m_btnTagHydrant = new HWButton
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Text            = "Tag Hydrant",
                BackgroundColor = Color.White,
                BorderWidth     = 1,
                BorderColor     = Color.Black,
                Margin          = new Thickness(10, 10, 10, 10)
            };
            m_btnTagHydrant.Clicked += TagHydrant_Clicked;
            OutsideLayout.Children.Add(m_btnTagHydrant);

            m_lblRecent = new HWLabel
            {
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                Text = "My Recent Tags"
            };

            m_lstRecentTags = new RecentTagsListView();
            OutsideLayout.Children.Add(m_lstRecentTags);
        }
Example #3
0
        public SettingsForm() : base("Settings")
        {
            m_InsideLayout = new StackLayout
            {
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Margin            = new Thickness(10, 10, 10, 10),
            };
            OutsideLayout.Children.Add(m_InsideLayout);

            lblUnsynced = new HWLabel
            {
                Text = "Tags unsent: ?",
                HorizontalTextAlignment = TextAlignment.Center
            };
            m_InsideLayout.Children.Add(lblUnsynced);

            btnSync = new HWButton
            {
                Text            = "Sync Tags",
                BackgroundColor = Color.White,
                BorderWidth     = 1,
                BorderColor     = Color.Black,
                IsEnabled       = false
            };
            btnSync.Clicked += Sync_Clicked;
            m_InsideLayout.Children.Add(btnSync);

            btnLogout = new HWButton
            {
                Text            = "Logout",
                BackgroundColor = Color.White,
                BorderWidth     = 1,
                BorderColor     = Color.Black,
                Margin          = new Thickness(0, 10, 0, 0)
            };
            btnLogout.Clicked += Logout_Clicked;
            m_InsideLayout.Children.Add(btnLogout);

            if (HWManager.GetInstance().PlatformManager.HasNetworkConnectivity)
            {
                btnSync.Text      = "Sync Tags";
                btnSync.IsEnabled = true;
            }
            else
            {
                btnSync.Text      = "Sync Tags - No Network";
                btnSync.IsEnabled = false;
            }

            Task t = Task.Factory.StartNew(() => LoadTagCount());
        }
Example #4
0
 private void HWButton_Click(object sender, EventArgs e)
 {
     HWLabel.Show();
     HWButton.Hide();
     ExitButton.Show();
 }
        public HydrantDetailsForm() : base("Hydrant Details")
        {
            m_Header = new HWHeader("Hydrant Details")
            {
                Margin = new Thickness(0, 0, 0, 0)
            };
            OutsideLayout.Children.Add(m_Header);

            m_ButtonLayout = new HWButtonBar();
            OutsideLayout.Children.Add(m_ButtonLayout);

            CancelButton          = m_ButtonLayout.Add("Cancel", LayoutOptions.StartAndExpand);
            CancelButton.Clicked += CancelButton_Clicked;

            Frame imageFrame = new Frame
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                HasShadow         = false,
                OutlineColor      = Color.Black,
                Margin            = new Thickness(10, 0, 10, 0)
            };

            OutsideLayout.Children.Add(imageFrame);

            m_imgMainImage = new Image()
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Aspect            = Aspect.AspectFit,
            };
            imageFrame.Content = m_imgMainImage;

            StackLayout labelLayout = new StackLayout
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Margin            = new Thickness(0, 0, 0, 10)
            };

            OutsideLayout.Children.Add(labelLayout);

            m_lblUsername = new HWLabel
            {
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center,
            };
            labelLayout.Children.Add(m_lblUsername);

            m_lblLatitude = new HWLabel
            {
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center
            };
            labelLayout.Children.Add(m_lblLatitude);

            m_lblLongitude = new HWLabel
            {
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                VerticalTextAlignment   = TextAlignment.Center,
                HorizontalTextAlignment = TextAlignment.Center
            };
            labelLayout.Children.Add(m_lblLongitude);
        }
Example #6
0
 private void BindButton(HWButton button, string componentId)
 {
     button.Port = emulator.FindComponentById(componentId) as GpioPort;
 }
Example #7
0
        public TagHydrant()
            : base("Tag Hydrant")
        {
            m_MediaPicker = DependencyService.Get <IMediaPicker>();
            var device = Resolver.Resolve <IDevice>();

            m_MediaPicker = m_MediaPicker ?? device.MediaPicker;


            m_Header = new HWHeader("Hydrant Details")
            {
                Margin = new Thickness(0, 0, 0, 0)
            };
            OutsideLayout.Children.Add(m_Header);

            m_ButtonLayout = new HWButtonBar();
            OutsideLayout.Children.Add(m_ButtonLayout);

            CancelButton          = m_ButtonLayout.Add("Cancel", LayoutOptions.StartAndExpand);
            CancelButton.Clicked += CancelButton_Clicked;

            SaveButton          = m_ButtonLayout.Add("Save", LayoutOptions.EndAndExpand);
            SaveButton.Clicked += SaveButton_Clicked;

            m_layoutPhoto = new StackLayout
            {
                Orientation       = StackOrientation.Horizontal,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Margin            = new Thickness(5, 0, 5, 0)
            };
            OutsideLayout.Children.Add(m_layoutPhoto);

            Frame imageFrame = new Frame
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                OutlineColor      = Color.Black,
                HasShadow         = false,
                Margin            = new Thickness(3, 3, 3, 3),
                Padding           = new Thickness(0, 0, 0, 0)
            };

            m_layoutPhoto.Children.Add(imageFrame);

            m_imgHydrant = new Image
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Aspect            = Aspect.AspectFit,
                Margin            = new Thickness(0, 0, 0, 0)
            };
            imageFrame.Content = m_imgHydrant;

            m_btnTakePhoto = new HWButton
            {
                Text            = "Take Photo",
                VerticalOptions = LayoutOptions.Center,
                WidthRequest    = 80,
                HeightRequest   = 40,
                BorderColor     = Color.Black,
                BorderWidth     = 1,
                BackgroundColor = Color.White,
                FontAttributes  = FontAttributes.Bold,
                FontSize        = Device.GetNamedSize(NamedSize.Small, typeof(Button))
            };
            m_btnTakePhoto.Clicked += TakePhoto_Clicked;
            m_layoutPhoto.Children.Add(m_btnTakePhoto);

            if (m_MediaPicker.IsCameraAvailable)
            {
                m_btnTakePhoto.IsEnabled = true;
                SaveButton.IsEnabled     = false;
            }
            else
            {
                m_btnTakePhoto.IsEnabled = false;
                SaveButton.IsEnabled     = true;
            }

            StackLayout lableLayout = new StackLayout
            {
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Margin            = new Thickness(5, 10, 5, 10)
            };

            OutsideLayout.Children.Add(lableLayout);

            m_lblCount = new HWLabel
            {
                Text = "Position Count:",
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            lableLayout.Children.Add(m_lblCount);

            m_lblLatitude = new HWLabel
            {
                Text = "Latitude:",
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            lableLayout.Children.Add(m_lblLatitude);

            m_lblLongitude = new HWLabel
            {
                Text = "Longitude:",
                HorizontalOptions = LayoutOptions.FillAndExpand
            };
            lableLayout.Children.Add(m_lblLongitude);

            m_Location = new LocationManager();
            m_Location.StartListening();

            m_Averager = new PositionAverager(m_Location, 10);
            m_Averager.PositionUpdated += Averager_PositionUpdated;
            StartUpdateLocation();
        }
Example #8
0
        public ReviewTagForm() : base("Review Tag")
        {
            m_Header = new HWHeader("Review Tag");
            OutsideLayout.Children.Add(m_Header);

            m_Cancel = new HWButton
            {
                Text      = "Cancel",
                TextColor = Color.White,
                FontSize  = Device.GetNamedSize(NamedSize.Medium, typeof(Button)),
            };
            m_Cancel.Clicked += Cancel_Clicked;
            m_Header.SetLeftButton(m_Cancel);

            AbsoluteLayout layout = new AbsoluteLayout
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill
            };

            OutsideLayout.Children.Add(layout);

            //Add approve and reject buttons
            m_Buttons = new Grid
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                },
            };

            AbsoluteLayout.SetLayoutBounds(m_Buttons, new Rectangle(0, 0, AbsoluteLayout.AutoSize, 50));
            layout.Children.Add(m_Buttons);

            m_Reject = new HWButton
            {
                Text              = "Reject",
                WidthRequest      = 100,
                HeightRequest     = 30,
                HorizontalOptions = LayoutOptions.Start,
                VerticalOptions   = LayoutOptions.Center,
                Margin            = new Thickness(10, 10, 10, 10),
                BorderColor       = Color.Black,
                BorderWidth       = 1,
                BackgroundColor   = Color.White
            };
            m_Buttons.Children.Add(m_Reject, 0, 0);

            m_Approve = new HWButton
            {
                Text              = "Approve",
                WidthRequest      = 100,
                HeightRequest     = 30,
                HorizontalOptions = LayoutOptions.End,
                Margin            = new Thickness(10, 10, 10, 10),
                BorderColor       = Color.Black,
                BorderWidth       = 1,
                BackgroundColor   = Color.White
            };
            m_Buttons.Children.Add(m_Approve, 1, 0);

            //Add the tag's user
            m_User = new HWLabel
            {
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                HorizontalTextAlignment = TextAlignment.Start,
                VerticalTextAlignment   = TextAlignment.Center,
                Margin = new Thickness(10, 0, 10, 10)
            };

            AbsoluteLayout.SetLayoutBounds(m_User, new Rectangle(0, 50, AbsoluteLayout.AutoSize, 30));
            layout.Children.Add(m_User);

            //Add Map and Image
            m_Middle = new Grid
            {
                VerticalOptions   = LayoutOptions.Fill,
                HorizontalOptions = LayoutOptions.Fill,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = 300
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                },
                MinimumHeightRequest = 300
            };
            AbsoluteLayout.SetLayoutBounds(m_Middle, new Rectangle(0, 80, AbsoluteLayout.AutoSize, 300));
            layout.Children.Add(m_Middle);

            m_Map = new Map
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill
            };
            m_Middle.Children.Add(m_Map, 0, 0);

            m_Image = new Image
            {
                HorizontalOptions = LayoutOptions.Fill,
                VerticalOptions   = LayoutOptions.Fill
            };
            m_Middle.Children.Add(m_Image, 1, 0);

            //Add nearby hydrants
            m_Nearby = new HWLabel
            {
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                HorizontalTextAlignment = TextAlignment.Start,
                VerticalTextAlignment   = TextAlignment.Center,
                Text   = "Nearby Hydrants",
                Margin = new Thickness(10, 5, 10, 10)
            };
            AbsoluteLayout.SetLayoutBounds(m_Nearby, new Rectangle(0, 380, AbsoluteLayout.AutoSize, 30));
            layout.Children.Add(m_Nearby);

            m_Hydrants = new ReviewTagHydrantsListView
            {
                VerticalOptions   = LayoutOptions.Fill,
                HorizontalOptions = LayoutOptions.Fill,
                HeightRequest     = 100
            };
            AbsoluteLayout.SetLayoutBounds(m_Hydrants, new Rectangle(0, 410, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize));
            layout.Children.Add(m_Hydrants);
        }