Пример #1
0
        public MainPageLarge()
        {
            InitializeComponent();

            // nullable warning workaround
            var test  = this.listView ?? throw new InvalidOperationException();
            var test2 = this.featureInfo ?? throw new InvalidOperationException();

            allSamples = AllSamples.GetSamples() ?? new List <ISampleBase>();

            var categories = allSamples.Select(s => s.Category).Distinct().OrderBy(c => c);

            picker !.ItemsSource         = categories.ToList <string>();
            picker.SelectedIndexChanged += PickerSelectedIndexChanged;
            picker.SelectedItem          = "Forms";

            mapView !.RotationLock        = false;
            mapView.UnSnapRotationDegrees = 30;
            mapView.ReSnapRotationDegrees = 5;

            mapView.PinClicked += OnPinClicked;
            mapView.MapClicked += OnMapClicked;

            mapView.MyLocationLayer.UpdateMyLocation(new UI.Maui.Position());

            mapView.IsZoomButtonVisible       = true;
            mapView.IsMyLocationButtonVisible = true;
            mapView.IsNorthingButtonVisible   = true;

            mapView.Info += MapView_Info;
            mapView.Renderer.WidgetRenders[typeof(CustomWidget.CustomWidget)] = new CustomWidgetSkiaRenderer();

            StartGPS();
        }
Пример #2
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            int id = item.ItemId;

            if (item.HasSubMenu)
            {
                return(true);
            }

            if (id == Resource.Id.action_settings)
            {
                return(true);
            }

            if (item.TitleFormatted.ToString() == SkiaRenderMode.Software.ToString())
            {
                _mapControl.RenderMode = SkiaRenderMode.Software;
            }
            else if (item.TitleFormatted.ToString() == SkiaRenderMode.Hardware.ToString())
            {
                _mapControl.RenderMode = SkiaRenderMode.Hardware;
            }
            else
            {
                var sample = AllSamples.GetSamples().FirstOrDefault(s => s.Name == item.TitleFormatted.ToString());
                if (sample != null)
                {
                    _mapControl.Map.Layers.Clear();
                    sample.Setup(_mapControl);
                    return(true);
                }
            }

            return(base.OnOptionsItemSelected(item));
        }
Пример #3
0
        public MainPageLarge()
        {
            InitializeComponent();

            allSamples = AllSamples.GetSamples();

            var categories = allSamples.Select(s => s.Category).Distinct().OrderBy(c => c);

            picker.ItemsSource           = categories.ToList <string>();
            picker.SelectedIndexChanged += PickerSelectedIndexChanged;
            picker.SelectedItem          = "Forms";

            mapView.RotationLock          = false;
            mapView.UnSnapRotationDegrees = 30;
            mapView.ReSnapRotationDegrees = 5;

            mapView.PinClicked += OnPinClicked;
            mapView.MapClicked += OnMapClicked;

            mapView.MyLocationLayer.UpdateMyLocation(new UI.Forms.Position());

            mapView.IsZoomButtonVisible       = true;
            mapView.IsMyLocationButtonVisible = true;
            mapView.IsNorthingButtonVisible   = true;

            mapView.Info += MapView_Info;
            mapView.Renderer.WidgetRenders[typeof(CustomWidget.CustomWidget)] = new CustomWidgetSkiaRenderer();

            StartGPS();
        }
Пример #4
0
        public MainPageLarge()
        {
            InitializeComponent();

            allSamples = AllSamples.GetSamples();

            var categories = allSamples.Select(s => s.Category).Distinct().OrderBy(c => c);

            foreach (var category in categories)
            {
                picker.Items?.Add(category);
            }
            picker.SelectedIndexChanged += PickerSelectedIndexChanged;
            picker.SelectedItem          = "Forms";

            mapView.RotationLock          = false;
            mapView.UnSnapRotationDegrees = 30;
            mapView.ReSnapRotationDegrees = 5;

            mapView.PinClicked += OnPinClicked;
            mapView.MapClicked += OnMapClicked;

            mapView.MyLocationLayer.UpdateMyLocation(new UI.Forms.Position());

            mapView.IsZoomButtonVisible       = true;
            mapView.IsMyLocationButtonVisible = true;
            mapView.IsNorthingButtonVisible   = true;

            mapView.Info += MapView_Info;

            StartGPS();
        }
Пример #5
0
        private void FillListWithSamples()
        {
            var selectedCategory = CategoryComboBox.SelectedValue?.ToString() ?? "";

            SampleList.Children.Clear();
            foreach (var sample in AllSamples.GetSamples().Where(s => s.Category == selectedCategory))
            {
                SampleList.Children.Add(CreateRadioButton(sample));
            }
        }
Пример #6
0
        private void FillComboBoxWithCategories()
        {
            Tests.Common.Utilities.LoadAssembly();

            var categories = AllSamples.GetSamples().Select(s => s.Category).Distinct().OrderBy(c => c);

            CategoryComboBox.Items = categories;

            CategoryComboBox.SelectedIndex = 1;
        }
Пример #7
0
        private void FillComboBoxWithCategories()
        {
            var categories = AllSamples.GetSamples().Select(s => s.Category).Distinct().OrderBy(c => c);

            foreach (var category in categories)
            {
                CategoryComboBox.Items?.Add(category);
            }

            CategoryComboBox.SelectedIndex = 1;
        }
Пример #8
0
        public MainPage()
        {
            InitializeComponent();

            allSamples = AllSamples.GetSamples();

            var categories = allSamples.Select(s => s.Category).Distinct().OrderBy(c => c);

            picker.ItemsSource           = categories.ToList <string>();
            picker.SelectedIndexChanged += PickerSelectedIndexChanged;
            picker.SelectedItem          = "Forms";
        }
Пример #9
0
        public MainPage()
        {
            InitializeComponent();
            SetupToolbar();

            allSamples = AllSamples.GetSamples();

            var categories = allSamples.Select(s => s.Category).Distinct().OrderBy(c => c).ToList();

            categories.Insert(0, "All");
            picker.ItemsSource           = categories;
            picker.SelectedIndexChanged += PickerSelectedIndexChanged;
            picker.SelectedItem          = "All";
        }
Пример #10
0
        private void FillComboBoxWithCategories()
        {
            // todo: find proper way to load assembly
            DesktopSamplesUtilities.LoadAssembly();
            Tests.Common.Utilities.LoadAssembly();

            var categories = AllSamples.GetSamples().Select(s => s.Category).Distinct().OrderBy(c => c);

            foreach (var category in categories)
            {
                CategoryComboBox.Items.Add(category);
            }

            CategoryComboBox.SelectedIndex = 0;
        }
Пример #11
0
        public MainPage()
        {
            InitializeComponent();

            // nullable warning workaround"
            var test = this.listView ?? throw new InvalidOperationException();

            allSamples = AllSamples.GetSamples() ?? new List <ISample>();

            var categories = allSamples.Select(s => s.Category).Distinct().OrderBy(c => c);

            picker !.ItemsSource         = categories.ToList <string>();
            picker.SelectedIndexChanged += PickerSelectedIndexChanged;
            picker.SelectedItem          = "Forms";
        }
Пример #12
0
        private void FillListWithSamples()
        {
            var selectedCategory = CategoryComboBox.SelectedValue?.ToString() ?? "";

            SampleList.Children.Clear();
            foreach (var sample in AllSamples.GetSamples().Where(s => s.Category == selectedCategory))
            {
                SampleList.Children.Add(CreateRadioButton(sample));
            }

            var firstRadioButton = (RadioButton)SampleList.Children[0];

            firstRadioButton.IsChecked = true;
            firstRadioButton.RaiseEvent(new RoutedEventArgs(ButtonBase.ClickEvent));
        }
Пример #13
0
        private void FillListWithSamples()
        {
            var selectedCategory = CategoryComboBox.SelectedValue?.ToString() ?? "";

            SampleList.Children.Clear();
            var enumerable = AllSamples.GetSamples()?.Where(s => s.Category == selectedCategory);

            if (enumerable == null)
            {
                return;
            }

            foreach (var sample in enumerable)
            {
                SampleList.Children.Add(CreateRadioButton(sample));
            }
        }
Пример #14
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.menu_main, menu);

            var categories = AllSamples.GetSamples().Select(s => s.Category).Distinct().OrderBy(c => c);

            foreach (var category in categories)
            {
                var submenu = menu.AddSubMenu(category);

                foreach (var sample in AllSamples.GetSamples().Where(s => s.Category == category))
                {
                    submenu.Add(sample.Name);
                }
            }
            return(true);
        }
Пример #15
0
        public MainPage()
        {
            InitializeComponent();

            allSamples = AllSamples.GetSamples();

            var categories = allSamples.Select(s => s.Category).Distinct().OrderBy(c => c);

            foreach (var category in categories)
            {
                picker.Items?.Add(category);
            }
            picker.SelectedIndexChanged += PickerSelectedIndexChanged;
            picker.SelectedItem          = "Forms";

            listView.ItemsSource = allSamples.Select(k => k.Name).ToList();
        }
Пример #16
0
        public override bool OnOptionsItemSelected(IMenuItem item)
        {
            var id = item.ItemId;

            if (item.HasSubMenu)
            {
                return(true);
            }

            if (id == Resource.Id.action_settings)
            {
                return(true);
            }

            if (_mapControl == null)
            {
                return(false);
            }

            if (item.TitleFormatted?.ToString() == SkiaRenderMode.Software.ToString())
            {
                _mapControl.RenderMode = SkiaRenderMode.Software;
            }
            else if (item.TitleFormatted?.ToString() == SkiaRenderMode.Hardware.ToString())
            {
                _mapControl.RenderMode = SkiaRenderMode.Hardware;
            }
            else
            {
                var sample = AllSamples.GetSamples()?.FirstOrDefault(s => s.Name == item.TitleFormatted?.ToString());
                if (sample != null)
                {
                    _mapControl?.Map?.Layers.Clear();

                    Catch.Exceptions(async() =>
                    {
                        await sample.SetupAsync(_mapControl !);
                    });

                    return(true);
                }
            }

            return(base.OnOptionsItemSelected(item));
        }
Пример #17
0
    public MainPage()
    {
        MapControl.Map?.Layers.Add(OpenStreetMap.CreateTileLayer());

        Content = new Grid
        {
            ColumnDefinitions =
            {
                new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Auto)
                },
                new ColumnDefinition {
                    Width = new GridLength(2, GridUnitType.Star)
                }
            },
            Children =
            {
                new VerticalStackLayout()
                {
                    Spacing  = 20,
                    Children =
                    {
                        SampleCategoryPicker,
                        SampleList
                    }
                }.Column(0).Padding(20),
                MapControl.Column(1)
            }
        };

        SampleList.ItemSelected += SampleList_ItemSelected;

        allSamples = AllSamples.GetSamples() ?? new List <ISampleBase>();
        var categories = allSamples.Select(s => s.Category).Distinct().OrderBy(c => c);

        SampleCategoryPicker !.ItemsSource         = categories.ToList <string>();
        SampleCategoryPicker.SelectedIndexChanged += SampleCategoryPicker_SelectedIndexChanged;;
        SampleCategoryPicker.SelectedItem          = "Info";
    }
Пример #18
0
        public override bool OnCreateOptionsMenu(IMenu menu)
        {
            MenuInflater.Inflate(Resource.Menu.menu_main, menu);

            var rendererMenu = menu.AddSubMenu(nameof(SkiaRenderMode));

            rendererMenu.Add(SkiaRenderMode.Regular.ToString());
            rendererMenu.Add(SkiaRenderMode.Accelerated.ToString());

            var categories = AllSamples.GetSamples().Select(s => s.Category).Distinct().OrderBy(c => c);

            foreach (var category in categories)
            {
                var submenu = menu.AddSubMenu(category);

                foreach (var sample in AllSamples.GetSamples().Where(s => s.Category == category))
                {
                    submenu.Add(sample.Name);
                }
            }
            return(true);
        }
Пример #19
0
        public override bool OnCreateOptionsMenu(IMenu?menu)
        {
            MenuInflater.Inflate(Resource.Menu.menu_main, menu);

            if (menu == null)
            {
                return(false);
            }

            var rendererMenu = menu.AddSubMenu(nameof(SkiaRenderMode));

            rendererMenu?.Add(SkiaRenderMode.Software.ToString());
            rendererMenu?.Add(SkiaRenderMode.Hardware.ToString());

            var categories = AllSamples.GetSamples()?.Select(s => s.Category).Distinct().OrderBy(c => c);

            if (categories == null)
            {
                return(false);
            }

            foreach (var category in categories)
            {
                var submenu = menu.AddSubMenu(category);

                var allSamples = AllSamples.GetSamples()?.Where(s => s.Category == category);
                if (allSamples == null)
                {
                    return(false);
                }

                foreach (var sample in allSamples)
                {
                    submenu?.Add(sample.Name);
                }
            }
            return(true);
        }