示例#1
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);
        }
示例#2
0
        protected AbstractBaseCell(string bindToProperty)
        {
            m_Layout         = new StackLayout();
            m_Layout.Padding = new Thickness(0, 5);

            m_lblCellText = new HWLabel();
            m_lblCellText.SetBinding(Label.TextProperty, bindToProperty);
            m_Layout.Children.Add(m_lblCellText);

            View = m_Layout;
        }
示例#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());
        }
示例#4
0
        public ReviewTagCell()
        {
            m_Layout = new StackLayout()
            {
                Padding     = new Thickness(2, 2),
                Margin      = new Thickness(20, 5, 20, 5),
                Orientation = StackOrientation.Horizontal
            };

            m_imgCell = new Image
            {
                Aspect        = Aspect.AspectFit,
                WidthRequest  = 70,
                HeightRequest = 70
            };
            m_imgCell.SetBinding(Image.SourceProperty, "ThumbnailUrl");
            m_Layout.Children.Add(m_imgCell);

            StackLayout rows = new StackLayout
            {
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand
            };

            m_Layout.Children.Add(rows);

            m_lblUsername = new HWLabel();
            m_lblUsername.SetBinding(Label.TextProperty, "DisplayUsername");
            m_lblUsername.VerticalTextAlignment   = TextAlignment.Center;
            m_lblUsername.HorizontalTextAlignment = TextAlignment.Start;
            rows.Children.Add(m_lblUsername);

            m_lblUserInfo = new HWLabel();
            m_lblUserInfo.SetBinding(Label.TextProperty, "UserInfo");
            m_lblUserInfo.VerticalTextAlignment   = TextAlignment.Center;
            m_lblUserInfo.HorizontalTextAlignment = TextAlignment.Start;
            rows.Children.Add(m_lblUserInfo);

            m_lblLatitude = new HWLabel();
            m_lblLatitude.SetBinding(Label.TextProperty, "DisplayLatitudeText");
            m_lblLatitude.VerticalTextAlignment   = TextAlignment.Center;
            m_lblLatitude.HorizontalTextAlignment = TextAlignment.Start;
            rows.Children.Add(m_lblLatitude);

            m_lblLongitude = new HWLabel();
            m_lblLongitude.SetBinding(Label.TextProperty, "DisplayLongitudeText");
            m_lblLongitude.VerticalTextAlignment   = TextAlignment.Center;
            m_lblLongitude.HorizontalTextAlignment = TextAlignment.Start;
            rows.Children.Add(m_lblLongitude);

            View = m_Layout;
        }
示例#5
0
        public MenuCell()
        {
            m_Layout         = new StackLayout();
            m_Layout.Padding = new Thickness(0, 5);
            m_Layout.Margin  = new Thickness(20, 8, 20, 0);

            m_lblCellText = new HWLabel()
            {
                FontSize       = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                FontAttributes = FontAttributes.Bold
            };
            m_lblCellText.SetBinding(Label.TextProperty, "Title");
            m_lblCellText.TextColor             = Color.FromHex(UIConstants.MenuListTextColor);
            m_lblCellText.VerticalTextAlignment = TextAlignment.Center;
            m_Layout.Children.Add(m_lblCellText);

            View = m_Layout;
        }
示例#6
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);
        }
示例#8
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();
        }
示例#9
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);
        }