Esempio n. 1
0
        public ContactPage()
            : base("", str_Profile.Localize(), false)
        {
            ScreenRoutines.CursorWait();
            try
            {
                Control.ShadowedAnimationMode = Fleux.Controls.FleuxControl.ShadowedAnimationOptions.FromRight;

                theForm.Menu = null;
                Content.Size = new Size(Size.Width, Size.Height - 150);

                var appBar = new ApplicationBar
                                 {
                                     Size = new Size(Content.Size.Width, 48 + 2 * 10),
                                     Location = new Point(0, Content.Size.Height - 48 - 2 * 10)
                                 };
                appBar.AddButton(ResourceManager.Instance.GetBitmapFromEmbeddedResource(
                    (MetroTheme.PhoneBackgroundBrush == Color.White) ?
                        "ContactWidgets.Images.back-light.bmp" : "ContactWidgets.Images.back-dark.bmp"
                    ));
                appBar.AddButton(ResourceManager.Instance.GetBitmapFromEmbeddedResource(
                    (MetroTheme.PhoneBackgroundBrush == Color.White) ?
                        "ContactWidgets.Images.Edit-light.bmp" : "ContactWidgets.Images.Edit-dark.bmp"
                    ));
                appBar.ButtonTap += OnAppBarButtonTap;
                Content.AddElement(appBar.AnimateHorizontalEntrance(false));

                _stackPanel = new StackPanel { Size = new Size(Content.Size.Width - PaddingHor * 2, 1), };

                var scroller = new SolidScrollViewer
                {
                    Content = _stackPanel,
                    Location = new Point(PaddingHor, 0),
                    Size = new Size(Content.Size.Width - PaddingHor, Content.Size.Height - appBar.Size.Height),
                    ShowScrollbars = true,
                    HorizontalScroll = false,
                    VerticalScroll = true,
                };
                Content.AddElement(scroller.AnimateHorizontalEntrance(false));

            }
            finally
            {
                ScreenRoutines.CursorNormal();
            }
        }
Esempio n. 2
0
        private void CreateControls()
        {
            ScreenRoutines.CursorWait();
            try
            {
                Control.ShadowedAnimationMode = FleuxControl.ShadowedAnimationOptions.FromRight;

                var appBar = new ApplicationBar
                {
                    Size = new Size(Size.Width, 48 + 2 * 10),
                    Location = new Point(0, Size.Height - 48 - 2 * 10)
                };
                appBar.AddButton(ResourceManager.Instance.GetBitmapFromEmbeddedResource(
                    (MetroTheme.PhoneBackgroundBrush == Color.White) ?
                        "Metrohome65.Settings.Controls.Images.back-light.bmp" : "Metrohome65.Settings.Controls.Images.back-dark.bmp"
                    ));
                appBar.ButtonTap += (sender, args) => Close();
                Control.AddElement(appBar.AnimateHorizontalEntrance(false));

                var stackPanel = new StackPanel { Size = new Size(SettingsConsts.MaxWidth, 10), };

                // buttons for selecting font family
                stackPanel.AddElement(
                    new TextElement("Font family") { AutoSizeMode = TextElement.AutoSizeModeOptions.OneLineAutoHeight, }
                );

                var fonts = new List<string>
                    {
                        MetroTheme.PhoneFontFamilyNormal,
                        MetroTheme.PhoneFontFamilyLight,
                        MetroTheme.PhoneFontFamilySemiLight,
                        MetroTheme.PhoneFontFamilySemiBold,
                    };
                var fontBindingManager = new BindingManager() { MultiBind = true, };
                foreach (var font in fonts)
                {
                    var button = new ToggleButton(font)
                        {
                            Size = new Size(SettingsConsts.MaxWidth, 50),
                        };
                    stackPanel.AddElement(button);
                    fontBindingManager.Bind(_textStyle, "FontFamily", button, "Value", true);
                    stackPanel.AddElement(new DelegateUIElement() { Size = new Size(10, 10), });
                }

                stackPanel.AddElement(new DelegateUIElement() { Size = new Size(10, 20) });

                // buttons for selecting font size
                stackPanel.AddElement(
                    new TextElement("Font size") { AutoSizeMode = TextElement.AutoSizeModeOptions.OneLineAutoHeight, }
                );

                var sizePanel = new Canvas()
                {
                    Size = new Size(SettingsConsts.MaxWidth, 10),
                };
                stackPanel.AddElement(sizePanel);

                var sizeBindingManager = new BindingManager() { MultiBind = true, };
                var sizes = new List<int>
                    {
                         8, 10, 11, 12, 14,
                        16, 18, 20, 22, 24,
                        26, 28, 30, 32, 34,
                        36, 38, 42, 46, 50,
                    };
                var i = 0;
                foreach (var size in sizes)
                {
                    var button = new ToggleButton(size)
                            {
                                Location = new Point((i%5)*90, (i/5)*60),
                                Size = new Size(80, 50),
                            };
                    sizeBindingManager.Bind(_textStyle, "FontSize", button, "Value", true);
                    sizePanel.AddElement(button);
                    i++;
                }

                stackPanel.AddElement(new DelegateUIElement() { Size = new Size(10, 20)});

                // font color
                var fontColor = new ColorSettingsControl(false)
                    {
                        Size = new Size(SettingsConsts.MaxWidth, 50),
                        Caption = "Font color",
                    };
                fontBindingManager.Bind(_textStyle, "Foreground", fontColor, "Value", true);
                stackPanel.AddElement(fontColor);

                stackPanel.AddElement(new DelegateUIElement() { Size = new Size(10, 20) });

                // example text block
                _example = new TextElement("Example")
                    {
                        AutoSizeMode = TextElement.AutoSizeModeOptions.OneLineAutoHeight,
                        Style = _textStyle,
                    };
                _textStyle.PropertyChanged += (sender, args) => _example.Update();
                stackPanel.AddElement(_example);

                var scroller = new SolidScrollViewer
                {
                    Content = stackPanel,
                    Location = new Point(SettingsConsts.PaddingHor, SettingsConsts.PaddingHor),
                    Size = new Size(this.Size.Width - SettingsConsts.PaddingHor, this.Size.Height - appBar.Size.Height - SettingsConsts.PaddingHor),
                    ShowScrollbars = true,
                    HorizontalScroll = false,
                    VerticalScroll = true,
                };

                Control.AddElement(scroller);
            }
            finally
            {
                ScreenRoutines.CursorNormal();
            }
        }