Esempio n. 1
0
        static SfDataGrid CreateDataGridPrev(List <Data.End> ends)
        {
            SfDataGrid dataGrid = new SfDataGrid();

            viewModel            = new Model.PracticeViewModel(ends);
            dataGrid.ItemsSource = viewModel.EndCollection;
            dataGrid.ColumnSizer = ColumnSizer.Auto; //set to auto so it scrolls horizontally

            dataGrid.AllowEditing                 = true;
            dataGrid.EditTapAction                = TapAction.OnTap; //Enter edit mode in single tap instead of default double tap.
            dataGrid.EditorSelectionBehavior      = EditorSelectionBehavior.SelectAll;
            dataGrid.NotificationSubscriptionMode = NotificationSubscriptionMode.PropertyChange;
            dataGrid.NotificationSubscriptionMode = NotificationSubscriptionMode.CollectionChange;


            //so end number column cannot be edited
            GridTextColumn endNo = new GridTextColumn();

            endNo.MappingName            = "EndNum";
            endNo.AllowEditing           = false;
            dataGrid.AutoGenerateColumns = false;

            GridTextColumn arrow1 = new GridTextColumn();

            arrow1.MappingName = "Arrow1";
            arrow1.HeaderText  = "Arrow 1";

            GridTextColumn arrow2 = new GridTextColumn();

            arrow2.MappingName = "Arrow2";
            arrow2.HeaderText  = "Arrow 2";

            GridTextColumn arrow3 = new GridTextColumn();

            arrow3.MappingName = "Arrow3";
            arrow3.HeaderText  = "Arrow 3";

            GridTextColumn arrow4 = new GridTextColumn();

            arrow4.MappingName = "Arrow4";
            arrow4.HeaderText  = "Arrow 4";

            GridTextColumn arrow5 = new GridTextColumn();

            arrow5.MappingName = "Arrow5";
            arrow5.HeaderText  = "Arrow 5";

            GridTextColumn arrow6 = new GridTextColumn();

            arrow6.MappingName = "Arrow6";
            arrow6.HeaderText  = "Arrow 6";

            GridTextColumn endTotal = new GridTextColumn();

            endTotal.MappingName = "EndTotal";
            endTotal.HeaderText  = "End Total";


            //for running total column
            GridTextColumn runningTotal = new GridTextColumn();

            runningTotal.MappingName = "RunningTotal";
            runningTotal.HeaderText  = "Running Total";

            //for Weather column
            GridTextColumn weather = new GridTextColumn();

            weather.MappingName = "Weather";
            weather.HeaderText  = "Weather Conditions";

            //for Notes column
            GridTextColumn notes = new GridTextColumn();

            notes.MappingName = "Notes";
            notes.HeaderText  = "End Notes";

            dataGrid.Columns.Add(endNo);
            dataGrid.Columns.Add(arrow1);
            dataGrid.Columns.Add(arrow2);
            dataGrid.Columns.Add(arrow3);
            dataGrid.Columns.Add(arrow4);
            dataGrid.Columns.Add(arrow5);
            dataGrid.Columns.Add(arrow6);
            dataGrid.Columns.Add(endTotal);
            dataGrid.Columns.Add(runningTotal);
            dataGrid.Columns.Add(weather);
            dataGrid.Columns.Add(notes);

            return(dataGrid);
        }
Esempio n. 2
0
        public UIPractice()
        {
            dataGrid = CreateDataGrid();

            viewModel = new Model.PracticeViewModel();

            notValid     = new SfPopupLayout();
            selectEndRow = new SfPopupLayout();

            StackLayout layout = new StackLayout()
            {
                VerticalOptions   = LayoutOptions.Start,
                HorizontalOptions = LayoutOptions.Start,
                Padding           = new Thickness(50)
            };


            var grid = new Grid {
                RowSpacing = 50
            };

            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(35)
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(35)
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(35)
            });
            grid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Star)
            });

            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(60)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            grid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(100)
            });

            prevPop = new SfPopupLayout();

            Button previousButton = createButton("Search"); //displays previous practice score sheet, searched on score

            previousButton.Clicked += PrevButtonClicked;

            Button mainButton = createButton("Main"); //back to main screen

            mainButton.Clicked += MainButtonClicked;

            Button ntswthrButton = createButton("Notes Weather"); //notes and weather button

            ntswthrButton.Clicked += NotesAndWeatherClicked;

            Button editSightButton = createButton("Edit Sight"); //for editing sight markings

            editSightButton.Clicked += EditSightClicked;

            Button saveButton = createButton("Save"); //saves current sheet and associated notes and weather entries

            saveButton.Clicked += SaveClicked;

            Button detailsButton = createButton("Details");



            Label searchLabel = new Label {
                Text = "Search by score", TextColor = Color.FromHex("#010101"), FontSize = 10
            };
            var searchScore = new Entry {
                Text = " ", FontSize = 10
            };

            searchScore.TextChanged += SearchChanged;

            var newSightMarking = new Entry {
                Text = " ", FontSize = 10
            };

            newSightMarking.TextChanged += SightChanged;


            popupLayout = new SfPopupLayout();

            detailsButton.Clicked += DetailsButtonClicked;


            grid.Children.Add(dataGrid, 0, 3);
            Grid.SetColumnSpan(dataGrid, 3);
            grid.Children.Add(searchLabel, 0, 0);
            grid.Children.Add(searchScore, 1, 0);
            grid.Children.Add(previousButton, 2, 0);
            grid.Children.Add(ntswthrButton, 1, 2);
            grid.Children.Add(mainButton, 0, 2);
            grid.Children.Add(newSightMarking, 0, 1);
            grid.Children.Add(editSightButton, 1, 1);
            grid.Children.Add(detailsButton, 2, 1);
            grid.Children.Add(saveButton, 2, 2);
            layout.Children.Add(grid);

            Content = layout;
        }