Beispiel #1
0
 public void Pop()
 {
     if (this.navigating)
     {
         return;
     }
     this.navigating = true;
     this.drawContent(null, false);
     CLField.PlaySound("MenuNav.mp3");
     this.drawContent = null;
     if (this.drawContentPrev == null)
     {
         this.Show = false;
         this.Dispose();
         this.navigating = false;
         return;
     }
     Device.BeginInvokeOnMainThread(() => {
         this.titleLabel.Text = this.titlePrev;
         this.titlePrev       = null;
     });
     this.drawContent     = this.drawContentPrev;
     this.drawContentPrev = null;
     this.navigating      = false;
 }
Beispiel #2
0
        public CLCheckBox(bool check, string text, float x, float y, float width, float height, Color textColour, TextAlignment align, float textScale = 1.337f)
        {
            this.x          = x;
            this.y          = y;
            this.width      = width;
            this.height     = height;
            this.align      = align;
            this.textColour = textColour;
            this.label      = new CLFormsLabel()
            {
                Text      = text,
                TextColor = this.textColour,
                HorizontalTextAlignment = this.align,
                TextScale = textScale
            };
            var tapped = new TapGestureRecognizer();

            tapped.Tapped += (sender, ev) => {
                if (this.IsEnabled)
                {
                    CLField.PlaySound("MenuNav.mp3");
                    this.Check = !this.Check;
                }
            };
            this.label.GestureRecognizers.Add(tapped);
            this.yn = new CLFormsLabel()
            {
                TextColor = this.textColour,
                HorizontalTextAlignment = (this.align == TextAlignment.End) ? TextAlignment.Start : TextAlignment.End,
                TextScale = textScale
            };
            this.yn.GestureRecognizers.Add(tapped);
            this.added     = false;
            this.Check     = check;
            this.IsEnabled = true;
        }
Beispiel #3
0
        public CLLabel(string text, float x, float y, float width, float height, Color textColour, TextAlignment align, float textScale = 1.0f, View hackyView = null)
        {
            this.x      = x;
            this.y      = y;
            this.width  = width;
            this.height = height;
            this.align  = align;
            if (hackyView == null || !(hackyView is CLFormsLabel))
            {
                this.added = false;
                this.label = new CLFormsLabel()
                {
                    Text      = text,
                    TextColor = textColour,
                    HorizontalTextAlignment = this.align,
                    TextScale = textScale
                };
            }
            else
            {
                this.added = true;
                this.label = (CLFormsLabel)hackyView;
                Device.BeginInvokeOnMainThread(() => {
                    this.label.Text      = text;
                    this.label.TextColor = textColour;
                    this.label.HorizontalTextAlignment = this.align;
                    this.label.TextScale = textScale;
                });
            }
            bool actionDelayed = false;
            var  tapped        = new TapGestureRecognizer();

            tapped.Tapped += (sender, ev) => {
                if (actionDelayed)
                {
                    return;
                }
                actionDelayed = true;
                Task.Run(async() => {
                    await Task.Delay(500);
                    actionDelayed = false;
                });
                if (this != null && this.Action != null)
                {
                    CLField.PlaySound("MenuNav.mp3");
                    this.Action();
                }
            };
            this.label.GestureRecognizers.Add(tapped);
            this.outTap = new BoxView()
            {
                BackgroundColor = Color.Transparent
            };
//			bool outActionDelayed = false;
            tapped         = new TapGestureRecognizer();
            tapped.Tapped += (sender, ev) => {
                if (actionDelayed)
                {
                    return;
                }
                actionDelayed = true;
                Task.Run(async() => {
                    await Task.Delay(500);
                    actionDelayed = false;
                });
                if (this != null && this.OutAction != null)
                {
                    CLField.PlaySound("MenuNav.mp3");
                    this.OutAction();
                }
            };
            this.outTap.GestureRecognizers.Add(tapped);
        }