コード例 #1
0
        public void AdaptLayoytToScreenWidth(bool narrow)
        {
            if (narrow && (!testSessionsNarrow.HasValue || !testSessionsNarrow.Value))
            {
                ClearBindings();
                testSessionsNarrow = true;

                var ts = new TestSessionsNarrow();

                Children.Clear();
                Children.Add(ts);
            }
            else if (!narrow && (!testSessionsNarrow.HasValue || testSessionsNarrow.Value))
            {
                ClearBindings();
                testSessionsNarrow = false;

                var ts = new TestSessions();

                Children.Clear();
                Children.Add(ts);
            }
        }
コード例 #2
0
        private void AdaptLayoytToScreenWidth()
        {
            var testResultsNarrow  = false;
            var testSessionsNarrow = false;
            var narrowWidth        = 640;

            SizeChanged += (s, e) =>
            {
                buttons.AdaptLayoytToScreenWidth(Width < narrowWidth);

                if (Width < narrowWidth)
                {
                    if (!testResultsNarrow)
                    {
                        testResultsNarrow = true;

                        var tr = new TestResultsNarrow()
                        {
                            BindingContext         = ViewModelContainer.DriveTestViewModel,
                            IsFooterVisible        = true,
                            ShowFooterIfEmptyItems = true
                        };

                        tr.SetBinding(GridRepeater.ItemsSourceProperty, nameof(ViewModelContainer.DriveTestViewModel.TestResults));

                        testResultsPlaceholder.Children.Clear();
                        testResultsPlaceholder.Children.Add(tr);
                    }
                    if (!testSessionsNarrow)
                    {
                        testSessionsNarrow = true;

                        var ts = new TestSessionsNarrow();

                        testSessionsPlaceholder.Children.Clear();
                        testSessionsPlaceholder.Children.Add(ts);
                    }
                }
                else if (Width >= narrowWidth)
                {
                    if (testResultsNarrow)
                    {
                        testResultsNarrow = false;

                        var tr = new TestResults()
                        {
                            BindingContext         = ViewModelContainer.DriveTestViewModel,
                            IsFooterVisible        = true,
                            ShowFooterIfEmptyItems = true
                        };

                        tr.SetBinding(GridRepeater.ItemsSourceProperty, nameof(ViewModelContainer.DriveTestViewModel.TestResults));

                        testResultsPlaceholder.Children.Clear();
                        testResultsPlaceholder.Children.Add(tr);
                    }
                    if (testSessionsNarrow)
                    {
                        testSessionsNarrow = false;

                        var ts = new TestSessions();

                        testSessionsPlaceholder.Children.Clear();
                        testSessionsPlaceholder.Children.Add(ts);
                    }
                }
            };
        }
コード例 #3
0
 void Share_Clicked(object sender, System.EventArgs e)
 {
     TestSessions.ShareHandler(sender, e);
 }