public AvailableAssessmentList()
        {
            this.Title = "Assessments";

            //IAssessmentManager assessmentManager = new AssessmentManager();
            //List<AssessmentMetadataEntity> assessments = assessmentManager.GetListOfAllAssignedAssessmentsFromDevice();
            AssessmentService assessmentService         = new AssessmentService();
            List <AssessmentMetadataEntity> assessments = assessmentService.GetListOfAllAssignedAssessmentsFromDevice();

            var customAssessmentCell = new DataTemplate(typeof(CustomAssessmentCell));



            //Bind forms
            listView = new ListView
            {
                ItemsSource  = assessments,
                ItemTemplate = customAssessmentCell
            };



            listView.ItemSelected += ListView_ItemSelected;


            Button refreshList = new Button();

            refreshList.Text     = "Get Latest Assignments";
            refreshList.Clicked += RefreshList_Clicked;


            Button deleteList = new Button();

            deleteList.Text     = "deleteList";
            deleteList.Clicked += deleteList_Clicked;

            Content = new StackLayout
            {
                Padding  = 10,
                Children =
                {
                    deleteList,
                    refreshList,
                    listView
                }
            };
        }
Esempio n. 2
0
        public InspectionList()
        {
            Title = "Tom's Inspections";
            NavigationPage.SetHasNavigationBar(this, true);

            activityIndicator                   = new ActivityIndicator();
            activityIndicator.Color             = Color.FromHex("#3693FF");
            activityIndicator.VerticalOptions   = LayoutOptions.Center;
            activityIndicator.HorizontalOptions = LayoutOptions.Center;

            ToolbarItem toolbarItem = new ToolbarItem();

            toolbarItem.Icon = "Contact.png";
            ToolbarItems.Add(toolbarItem);

            newButton = new Button();
            newButton.WidthRequest      = 100;
            newButton.HeightRequest     = 100;
            newButton.CornerRadius      = 50;
            newButton.Text              = "6";
            newButton.BackgroundColor   = Color.FromHex("#C0BF07");
            newButton.HorizontalOptions = LayoutOptions.Start;
            //newButton.Margin = new Thickness(150, 0, 0, 0);
            newButton.FontSize  = 50;
            newButton.TextColor = Color.White;

            Label lblNew = new Label();

            lblNew.Text = "New";
            //lblNew.Margin = new Thickness(185, 0, 0, 0);

            inprogressButton = new Button();
            inprogressButton.WidthRequest      = 100;
            inprogressButton.HeightRequest     = 100;
            inprogressButton.CornerRadius      = 50;
            inprogressButton.Text              = "2";
            inprogressButton.BackgroundColor   = Color.FromHex("#CBCBCB");
            inprogressButton.HorizontalOptions = LayoutOptions.CenterAndExpand;
            inprogressButton.FontSize          = 50;
            inprogressButton.TextColor         = Color.White;

            Label lblInprogress = new Label();

            lblInprogress.Text = "In Progress";
            lblInprogress.HorizontalOptions = LayoutOptions.CenterAndExpand;

            completedButton = new Button();
            completedButton.WidthRequest      = 100;
            completedButton.HeightRequest     = 100;
            completedButton.CornerRadius      = 50;
            completedButton.Text              = "12";
            completedButton.BackgroundColor   = Color.FromHex("#CBCBCB");
            completedButton.HorizontalOptions = LayoutOptions.End;
            //completedButton.Margin = new Thickness(0, 0, 150, 0);
            completedButton.FontSize  = 50;
            completedButton.TextColor = Color.White;

            Label lblCompleted = new Label();

            lblCompleted.Text = "Completed";
            //lblCompleted.Margin= new Thickness(0, 0, 150, 0);
            lblCompleted.HorizontalOptions = LayoutOptions.End;

            syncButton = new Button();
            syncButton.WidthRequest    = 100;
            syncButton.HeightRequest   = 40;
            syncButton.Text            = "Sync All";
            syncButton.BorderColor     = Color.FromHex("#CBCBCB");
            syncButton.BorderWidth     = 1;
            syncButton.BackgroundColor = Color.White;
            syncButton.TextColor       = Color.FromHex("#3693FF");
            //syncButton.Margin = new Thickness(25, 0, 0, 0);
            //syncButton.FontSize = 20;
            syncButton.HorizontalOptions = LayoutOptions.Start;

            deleteList                 = new Button();
            deleteList.Clicked        += DeleteList_Clicked;
            deleteList.WidthRequest    = 100;
            deleteList.HeightRequest   = 40;
            deleteList.Text            = "Delete All";
            deleteList.BorderColor     = Color.FromHex("#CBCBCB");
            deleteList.BorderWidth     = 1;
            deleteList.BackgroundColor = Color.White;
            deleteList.TextColor       = Color.FromHex("#3693FF");
            //deleteList.Padding = new Thickness(25, 0, 0, 0);
            //syncButton.FontSize = 20;
            //deleteList.HorizontalOptions = LayoutOptions.Start;

            refreshList                 = new Button();
            refreshList.Clicked        += RefreshList_Clicked;
            refreshList.WidthRequest    = 100;
            refreshList.HeightRequest   = 40;
            refreshList.Text            = "Get All";
            refreshList.BorderColor     = Color.FromHex("#CBCBCB");
            refreshList.BorderWidth     = 1;
            refreshList.BackgroundColor = Color.White;
            refreshList.TextColor       = Color.FromHex("#3693FF");
            //refreshList.Padding = new Thickness(25, 0, 0, 0);


            inspectionList = new ListView();
            Content        = new StackLayout
            {
                //Padding = 10,
                Orientation = StackOrientation.Vertical,
                Children    =
                {
                    new StackLayout             {
                        HeightRequest   = 175,
                        BackgroundColor = Color.FromHex("#F8F9F9"),

                        Children =
                        {
                            new StackLayout
                            {
                                Padding           = new Thickness(25, 25, 25, 25),
                                Orientation       = StackOrientation.Horizontal,
                                HorizontalOptions = LayoutOptions.CenterAndExpand,
                                Children          =
                                {
                                    new StackLayout
                                    {
                                        Padding = new Thickness(0, 0, 25, 0),//

                                        Orientation = StackOrientation.Vertical,
                                        //HorizontalOptions = LayoutOptions.Start,
                                        Children =
                                        {
                                            newButton,
                                            new StackLayout
                                            {
                                                VerticalOptions   = LayoutOptions.Center,
                                                HorizontalOptions = LayoutOptions.Center,
                                                Children          =
                                                {
                                                    lblNew
                                                }
                                            }
                                        }
                                    },
                                    new StackLayout
                                    {
                                        Orientation = StackOrientation.Vertical,
                                        //HorizontalOptions = LayoutOptions.CenterAndExpand,
                                        Padding  = new Thickness(25, 0, 25, 0),
                                        Children =
                                        {
                                            inprogressButton,
                                            new StackLayout
                                            {
                                                VerticalOptions   = LayoutOptions.Center,
                                                HorizontalOptions = LayoutOptions.Center,
                                                Children          =
                                                {
                                                    lblInprogress
                                                }
                                            }
                                        }
                                    },
                                    new StackLayout
                                    {
                                        Orientation = StackOrientation.Vertical,
                                        //HorizontalOptions = LayoutOptions.End,
                                        Padding  = new Thickness(25, 0, 0, 0),//
                                        Children =
                                        {
                                            completedButton,
                                            new StackLayout
                                            {
                                                VerticalOptions   = LayoutOptions.Center,
                                                HorizontalOptions = LayoutOptions.Center,
                                                Children          =
                                                {
                                                    lblCompleted
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    new StackLayout
                    {
                        Padding     = 25,
                        Orientation = StackOrientation.Horizontal,
                        Children    =
                        {
                            syncButton,
                            deleteList,
                            refreshList
                        }
                    }

                    , inspectionList
                }
            };


            AssessmentService assessmentService         = new AssessmentService();
            List <AssessmentMetadataEntity> assessments = assessmentService.GetListOfAllAssignedAssessmentsFromDevice();
            var customAssessmentCell = new DataTemplate(typeof(CustomInspectionCell));

            //Bind forms
            inspectionList.ItemsSource    = assessments;
            inspectionList.ItemTemplate   = customAssessmentCell;
            inspectionList.ItemSelected  += InspectionList_ItemSelected;
            inspectionList.HeightRequest  = 500;
            inspectionList.RowHeight      = 100;
            inspectionList.SelectionMode  = ListViewSelectionMode.Single;
            inspectionList.SeparatorColor = Color.Gray;
            inspectionList.HasUnevenRows  = false;

            UpdateInspectionCountCircles(assessments);
        }