Пример #1
0
        public static void OnPreviousKonversionClicked(object sender, EventArgs e)
        {
            ZwKonversionButton aKVBtn = (ZwKonversionButton)sender;

            loadValuesFromKonversion(aKVBtn.btnKonVersion);
        }
Пример #2
0
        public static StackLayout buildWorkSpace()
        {
            KonVersion tKV;

            StackLayout workSpace = new StackLayout
            {
                Padding           = new Thickness(0),
                Margin            = new Thickness(0, 0, 0, 0),
                VerticalOptions   = LayoutOptions.FillAndExpand,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                BackgroundColor   = Color.Transparent
            };

            Grid UnitsGrid = new Grid
            {
                Padding           = new Thickness(0),
                Margin            = new Thickness(0, 0, 0, 0),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Start
            };

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

            UnitsGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });

            UnitsGrid.Children.Add(unitLeftPicker, 0, 0);
            UnitsGrid.Children.Add(unitRightPicker, 1, 0);

            unitLeftPicker.SelectedIndexChanged  += OnUnitPickerChange;
            unitRightPicker.SelectedIndexChanged += OnUnitPickerChange;

            workSpace.Children.Clear();
            workSpace.Children.Add(UnitsGrid);
            //workSpace.Children.Add(convertValue);

            Grid SwipeToConvertGrid = new Grid
            {
                Padding           = new Thickness(0),
                Margin            = new Thickness(0, 0, 0, 0),
                BackgroundColor   = Color.AntiqueWhite,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Start
            };

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

            SwipeToConvertGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });

            var leftSwipeGesture = new SwipeGestureRecognizer {
                Direction = SwipeDirection.Left
            };

            leftSwipeGesture.Swiped += OnDoConversionSwiped;
            var rightSwipeGesture = new SwipeGestureRecognizer {
                Direction = SwipeDirection.Right
            };

            rightSwipeGesture.Swiped += OnDoConversionSwiped;
            var imageTapGesture = new TapGestureRecognizer {
            };

            imageTapGesture.Tapped += OnImageTapped;

            btnLeft2Right.GestureRecognizers.Add(imageTapGesture);
            //btnLeft2Right.Clicked += OnArrowClick;
            btnRight2Left.GestureRecognizers.Add(imageTapGesture);
            //btnRight2Left.Clicked += OnArrowClick;

            btnRight2Left.GestureRecognizers.Add(leftSwipeGesture);
            btnLeft2Right.GestureRecognizers.Add(rightSwipeGesture);

            SwipeToConvertGrid.GestureRecognizers.Add(leftSwipeGesture);
            SwipeToConvertGrid.GestureRecognizers.Add(rightSwipeGesture);

            SwipeToConvertGrid.Children.Add(btnLeft2Right, 0, 0);
            SwipeToConvertGrid.Children.Add(convertValue, 1, 0);
            SwipeToConvertGrid.Children.Add(btnRight2Left, 2, 0);

            workSpace.Children.Add(SwipeToConvertGrid);

            Label tL1 = new Label
            {
                Text              = "Enter Value",
                FontSize          = Device.GetNamedSize(NamedSize.Small, typeof(Label)),
                FontAttributes    = FontAttributes.Bold,
                VerticalOptions   = LayoutOptions.Center,
                Margin            = new Thickness(0, 0, 0, 0),
                HorizontalOptions = LayoutOptions.CenterAndExpand
            };

            workSpace.Children.Add(tL1);
            workSpace.Children.Add(resultValue);

            Grid ButtonGrid = new Grid
            {
                Padding           = new Thickness(0),
                Margin            = new Thickness(0, 0, 0, 0),
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Start
            };

            ButtonGrid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });
            //UnitsGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });

            ButtonGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            ButtonGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            ButtonGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });
            ButtonGrid.RowDefinitions.Add(new RowDefinition {
                Height = new GridLength(1, GridUnitType.Auto)
            });

            for (int i = 0; i < 3; i++)
            {
                string btnText;
                if (TheSet != null && TheSet.myKonVertUserParams.previousKonversions != null)
                {
                    tKV     = TheSet.myKonVertUserParams.previousKonversions[i];
                    btnText = tKV.ToString();
                }
                else
                {
                    tKV     = null;
                    btnText = "Open";
                }
                ZwKonversionButton tbtn = new ZwKonversionButton
                {
                    btnKonVersion     = tKV,
                    Text              = btnText,
                    HorizontalOptions = LayoutOptions.FillAndExpand,
                    VerticalOptions   = LayoutOptions.Center,
                    Padding           = new Thickness(15, 5, 15, 5),
                    Margin            = new Thickness(0, 0, 0, 0),
                };
                tbtn.Clicked += OnPreviousKonversionClicked;
                ButtonGrid.Children.Add(tbtn, 0, i);
            }

            Button tb2 = new Button
            {
                Text = "Settings",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Center,
                Padding           = new Thickness(5, 5, 5, 5),
                Margin            = new Thickness(0, 0, 0, 0),
            };

            tb2.Clicked += OnSettingsClicked;
            ButtonGrid.Children.Add(tb2, 0, 3);

            workSpace.Children.Add(ButtonGrid);
            return(workSpace);
        }