Exemplo n.º 1
0
        public void OnResize(ViewportSize viewport)
        {
            var bufferSizeFactor = 1 / UserSettings.Instance.Graphics.UpSample;

            var w = (int)(viewport.Width * bufferSizeFactor);
            var h = (int)(viewport.Height * bufferSizeFactor);

            if (viewport == this.viewport && w == bufferSize.X && h == bufferSize.Y)
            {
                return;
            }

            bufferSize = new ScreenCoords(w, h);

            this.viewport = viewport;
            needsResize   = true;
        }
Exemplo n.º 2
0
 private static void renderTo(RenderTarget target, ScreenCoords viewport)
 {
     GL.Viewport(0, 0, viewport.X, viewport.Y);
     GL.BindFramebuffer(FramebufferTarget.DrawFramebuffer, target);
 }
Exemplo n.º 3
0
        public void ShowSortingPopUp <T>(string buttonText, View element, List <Models.SortOption> SortOptions, T request, Func <Task> ucitajProizvodeCallback)
        {
            this.sortOptions             = SortOptions;
            this.requestType             = typeof(T);
            this.request                 = request;
            this.ucitajProizvodeCallback = ucitajProizvodeCallback;
            DataTemplate templateView;
            Grid         layout;

            templateView = new DataTemplate(() =>
            {
                layout        = new Grid();
                layout.Margin = new Thickness(10, 10, 10, 10);

                var counter = 0;

                layout.RowDefinitions.Add(new RowDefinition {
                    Height = GridLength.Auto
                });

                StackLayout stack = new StackLayout
                {
                    Orientation = StackOrientation.Vertical
                };

                Label label = new Label
                {
                    Text = "Poredak",
                    HorizontalTextAlignment = TextAlignment.Start,
                    VerticalTextAlignment   = TextAlignment.Center,
                    VerticalOptions         = LayoutOptions.Center,
                    FontAttributes          = FontAttributes.Bold,
                    FontFamily = Device.RuntimePlatform == Device.iOS ? "Montserrat-SemiBold" :
                                 Device.RuntimePlatform == Device.Android ? "Montserrat-SemiBold.ttf#Montserrat-SemiBold" : "Assets/Montserrat-SemiBold.ttf#Montserrat-SemiBold"
                };
                stack.Children.Add(label);

                SfRadioGroup radioGroup = new SfRadioGroup();
                radioGroup.Spacing      = 0;
                foreach (var item in sortOptions)
                {
                    SfRadioButton option = new SfRadioButton
                    {
                        Text    = item.Text,
                        Padding = new Thickness {
                            Left = 0, Bottom = 0, Right = 0, Top = 0
                        },
                    };

                    option.IsChecked = GetSortRadioButtonChecked("Poredak", item.Value.ToString());

                    option.StateChanged += SortingOption_StateChanged;
                    radioGroup.Children.Add(option);
                }
                stack.Children.Add(radioGroup);


                layout.Children.Add(stack, 0, counter++);

                layout.RowDefinitions.Add(new RowDefinition {
                    Height = GridLength.Auto
                });
                SfButton button        = new SfButton();
                button.Text            = buttonText;
                button.Margin          = new Thickness(20, 0, 20, 20);
                button.VerticalOptions = LayoutOptions.End;
                button.Clicked        += Button_Clicked1;
                layout.Children.Add(button, 0, counter++);

                var scrollView = new ScrollView()
                {
                    Content = layout, HeightRequest = 150
                };

                return(scrollView);
            });

            this.PopupView.ShowHeader       = false;
            this.PopupView.ShowFooter       = false;
            this.PopupView.HeightRequest    = 300;
            this.PopupView.WidthRequest     = 300;
            this.PopupView.ShowCloseButton  = false;
            this.PopupView.AcceptButtonText = "OK";

            // Adding ContentTemplate of the SfPopupLayout
            this.PopupView.ContentTemplate = templateView;

            //this.ShowRelativeToView(element, RelativePosition.AlignBottom, 0, 0);

            // The default height and width of PopupView is 250 and 300 respectively.
            // You can set any desired values as the height and width of the popup view.

            (double btnX, double btnY) = ScreenCoords.GetScreenCoordinates(element);

            this.Show(btnX - 0, btnY + 75);
        }