Ejemplo n.º 1
0
        public override bool Flick(Point from, Point to, int millisecs, Point startPoint)
        {
            if (GesturesEngine.IsHorizontal(from, to))
            {
                if (this.pivotItems.Count > 1)
                {
                    if (to.X - from.X < 0)
                    {
                        this.CurrentItem = this.pivotItems[this.pivotItems.IndexOf(this.currentItem) + 1];
                    }
                    else
                    {
                        this.currentFromLeft = true;
                        this.CurrentItem     = this.pivotItems.Last();
                    }
                }
                else
                {
                    this.AnimateCurrentReposition();
                }
                return(true);
            }
            else if (this.offsetForPanning != 0)
            {
                this.AnimateCurrentReposition();
            }

            return(base.Flick(from, to, millisecs, startPoint));
        }
Ejemplo n.º 2
0
 public void AddPivotItem(PivotItem item)
 {
     this.pivotItems.Add(item);
     this.body.Size     = new Size(this.Size.Width - BodyLocation.X, this.Size.Height - BodyLocation.Y);
     item.Body.Size     = this.body.Size;
     item.Body.Location = new Point(0, 0);
     this.RefreshHeaders();
     if (this.pivotItems.Count == 1)
     {
         this.currentItem = item;
     }
 }
Ejemplo n.º 3
0
        private TextElement CreateHeader(PivotItem i, PivotItem selected)
        {
            var style = i == selected ? this.HeaderStyleActive : this.HeaderStylePassive;

            return(new TextElement(i.Title)
            {
                Style = style,
                Size = this.CalculateHeaderSize(i.Title),
                TapHandler = p =>
                {
                    if (this.currentItem != i)
                    {
                        this.CurrentItem = i;
                    }
                    return true;
                }
            });
        }
Ejemplo n.º 4
0
        private PivotItem CreateFirstPage()
        {
            var page = new PivotItem { Title = "first", };
            var stackPanel = new StackPanel { Size = new Size(480, 700) };
            page.Body = stackPanel;

            var txtIntro =
                new TextElement(
                "Change your phone's background and accent color to match your mood today, this week, or all month.\n\r\n\r")
                {
                    Size = new Size(stackPanel.Size.Width - 10, 50),
                    Style = new TextStyle(MetroTheme.PhoneFontFamilyNormal, MetroTheme.PhoneFontSizeSmall, MetroTheme.PhoneForegroundBrush),
                    AutoSizeMode = TextElement.AutoSizeModeOptions.WrapText,
                };
            stackPanel.AddElement(txtIntro);

            stackPanel.AddElement(
                new FontEdit()
                {
                    Size = new Size(300, 50),
                }
            );
            stackPanel.AddElement(new Canvas() { Size = new Size(100, 100), });

            stackPanel.AddElement(new ComboBox()
            {
                Size = new Size(300, 50),
                Items = new List<object>() { "dark", "light" },
                Style = MetroTheme.PhoneTextNormalStyle,
            }
                );
            stackPanel.AddElement(new Canvas() { Size = new Size(100, 100), });

            stackPanel.AddElement(new ComboBox()
                    {
                        Size = new Size(300, 50),
                        Items = new List<object>() { "11111", "222222", "333333", "444444", "5", "6", "7", "8" },
                        Style = MetroTheme.PhoneTextNormalStyle,
                    }
                );
            stackPanel.AddElement(new Canvas() { Size = new Size(100, 100), });

            stackPanel.AddElement(new ColorComboBox()
                    {
                        Size = new Size(300, 50),
                        Items = new List<object>()
                                    {
                                        new ColorItem(Color.Magenta, "magenta"),
                                        new ColorItem(Color.Purple, "purple"),
                                        new ColorItem(Color.Teal, "teal"),
                                        new ColorItem(Color.Lime, "lime"),
                                        new ColorItem(Color.Brown, "brown"),
                                        new ColorItem(Color.Pink, "pink"),
                                        new ColorItem(Color.Orange, "orange"),
                                        new ColorItem(Color.Blue, "blue"),
                                        new ColorItem(Color.Red, "red"),
                                        new ColorItem(Color.Green, "green")
                                    },
                        Style = MetroTheme.PhoneTextNormalStyle,
                    }
                );
            stackPanel.AddElement(new Canvas() { Size = new Size(100, 100), });

            return page;
        }
Ejemplo n.º 5
0
        private PivotItem CreateSecondPage()
        {
            var page = new PivotItem { Title = "second" };
            var stackPanel = new StackPanel { Size = new Size(480, 700) };
            page.Body = stackPanel;

            stackPanel.AddElement(
                new Button("Test button 1")
                    {
                        Size = new Size(300, 50),
                        AutoSizeMode = Button.AutoSizeModeOptions.None,
                        TapHandler = point => OpenFile(),
                    }
                );

            return page;
        }
Ejemplo n.º 6
0
        private PivotItem CreateFontPage()
        {
            var page = new PivotItem { Title = "incoming", };
            var stackPanel = new StackPanel { Size = new Size(480, 700) };

            var scroller = new ScrollViewer
            {
                Content = stackPanel,
                Location = new Point(0, 0),
                ShowScrollbars = true,
                HorizontalScroll = false,
                VerticalScroll = true,
            };

            stackPanel.AddElement(
                new TextBox(this)
                    {
                        Size = new Size(300, 50),
                        MultiLine = false,
                        Text = "abc",
                    });

            stackPanel.AddElement(
                new TextBox(this)
                {
                    Size = new Size(300, 150),
                    MultiLine = true,
                    Text = "abc\n123",
                });

            stackPanel.AddElement(
                new FileSettingsControl(this)
                {
                }
                );

            stackPanel.AddElement(
                new StringSettingsControl(this)
                {
                    Value = "123",
                    Caption = "Name",
                }
                );

            page.Body = scroller;
            return page;
        }
Ejemplo n.º 7
0
        private PivotItem CreateFirstPage()
        {
            var page = new PivotItem { Title = "incoming", };
            _stackPanel = new StackPanel { Size = new Size(480, 700) };

            var scroller = new ScrollViewer
            {
                Content = _stackPanel,
                Location = new Point(0, 0),
                ShowScrollbars = true,
                HorizontalScroll = false,
                VerticalScroll = true,
            };

            page.Body = scroller;
            return page;
        }
Ejemplo n.º 8
0
Archivo: Pivot.cs Proyecto: flts/fleux
 public void AddPivotItem(PivotItem item)
 {
     this.pivotItems.Add(item);
     this.body.Size = new Size(this.Size.Width - BodyLocation.X, this.Size.Height - BodyLocation.Y);
     item.Body.Size = this.body.Size;
     item.Body.Location = new Point(0, 0);
     this.RefreshHeaders();
     if (this.pivotItems.Count == 1)
     {
         this.currentItem = item;
     }
 }
Ejemplo n.º 9
0
Archivo: Pivot.cs Proyecto: flts/fleux
 private TextElement CreateHeader(PivotItem i, PivotItem selected)
 {
     var style = i == selected ? this.HeaderStyleActive : this.HeaderStylePassive;
     return new TextElement(i.Title)
     {
         Style = style,
         Size = this.CalculateHeaderSize(i.Title),
         TapHandler = p =>
             {
                 if (this.currentItem != i)
                 {
                     this.CurrentItem = i;
                 }
                 return true;
             }
     };
 }
Ejemplo n.º 10
0
Archivo: Pivot.cs Proyecto: flts/fleux
        public override bool Flick(Point from, Point to, int millisecs, Point startPoint)
        {
            if (GesturesEngine.IsHorizontal(from, to))
            {
                if (this.pivotItems.Count > 1)
                {
                    if (to.X - from.X < 0)
                    {
                        this.CurrentItem = this.pivotItems[this.pivotItems.IndexOf(this.currentItem) + 1];
                    }
                    else
                    {
                        this.currentFromLeft = true;
                        this.CurrentItem = this.pivotItems.Last();
                    }
                }
                else
                {
                    this.AnimateCurrentReposition();
                }
                return true;
            }
            else if (this.offsetForPanning != 0)
            {
                this.AnimateCurrentReposition();
            }

            return base.Flick(from, to, millisecs, startPoint);
        }
Ejemplo n.º 11
0
        public void AddPivotItem(PivotItem item)
        {
            this.pivotItems.Add(item);
            this.body.Size = new Size(this.Size.Width - 21, this.Size.Height - 150);
            item.Body.Size = this.body.Size;
            item.Body.Location = new Point(0, 0);

            //! metrohome65
            item.Body.Parent = this;
            item.Body.ParentControl = this.ParentControl;

            this.RefreshHeaders();
            if (this.pivotItems.Count == 1)
            {
                this.currentItem = item;
            }
        }
Ejemplo n.º 12
0
 private TextElement CreateHeader(PivotItem i, PivotItem selected)
 {
     var style = MetroTheme.PhoneTextPageTitle2Style;
     style.Foreground = i == selected ? MetroTheme.PhoneForegroundBrush : MetroTheme.PhoneSubtleBrush;
     return new TextElement(i.Title)
     {
         Style = style,
         Size = new Size(this.CalculateHeaderWidth(i.Title), 80),
         TapHandler = p =>
             {
                 if (this.currentItem != i)
                 {
                     this.CurrentItem = i;
                 }
                 return true;
             }
     };
 }