public ImageSettingsControl()
        {
            _lblCaption = new TextElement("<image parameter>")
                {
                    Size = new Size(SettingsConsts.MaxWidth, 50),
                };
            AddElement(_lblCaption);

            _pictureBox = new SettingsImageElement(new Bitmap(1, 1))
                {
                  Size = new Size(SettingsConsts.MaxWidth, 175),
                };
            AddElement(_pictureBox);

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

            var buttonPanel = new Canvas { Size = new Size(SettingsConsts.MaxWidth, 50), };
            AddElement(buttonPanel);

            var buttonSelectImage = new Fleux.UIElements.Button("select".Localize())
                {
                    Size = new Size(SettingsConsts.MaxWidth / 2 - 10, 50),
                    Location = new Point(0, 0),
                    TapHandler = p => ButtonSelectBgClick(),
                };
            buttonPanel.AddElement(buttonSelectImage);

            var buttonClearImage = new Fleux.UIElements.Button("clear".Localize())
               {
                   Size = new Size(SettingsConsts.MaxWidth / 2 - 10, 50),
                   Location = new Point(SettingsConsts.MaxWidth / 2 + 10, 0),
                   TapHandler = p => { Value = ""; return true; },
               };
            buttonPanel.AddElement(buttonClearImage);
        }
Beispiel #2
0
 public Tile(string tileName, Image icon, int x, int y, bool wide)
 {
     this.Size = new Size(wide ? 358 : 173, 173);
     this.Location = new Point(x, y);
     m_Icon = new ImageElement(icon);
     //m_Icon.Location = new Point((this.Size.Width - m_Icon.Size.Width) / 2, (this.Size.Height - m_Icon.Size.Height) / 2);
     m_Icon.Location = new Point(0, 0);
     m_Text = new TextElement(tileName) { Style = MetroTheme.TileTextStyle, Location = new Point(13, 140) };
 }
        public FontSettingsControl()
        {
            _lblCaption = new TextElement("<input parameter>")
            {
                Size = new Size(SettingsConsts.MaxWidth, 50),
            };
            AddElement(_lblCaption);

            _fontEdit = new FontEdit {
                Size = new Size(SettingsConsts.MaxWidth, 50),
            };
            _fontEdit.Value.PropertyChanged += (s, e) => NotifyPropertyChanged("Value");
            AddElement(_fontEdit);
        }
Beispiel #4
0
        public void horizontal_stack_panel_should_have_desired_size_with_columns_when_autoResize_is_true()
        {
            var stackPanel = new StackPanel(false) {AutoResize = true, Size = new Size(500, 25),Columns = 2};

            var child1 = new TextElement("someText 1") { Size = new Size(18, 100) };
            var child2 = new TextElement("someText 2") { Size = new Size(100, 100) };
            var child3 = new TextElement("someText 3") { Size = new Size(100, 100) };

            stackPanel.AddElement(child1);
            stackPanel.AddElement(child2);
            stackPanel.AddElement(child3);

            Assert.AreEqual(child2.Width + child3.Width, stackPanel.Width);
        }
        public SelectSettingsControl()
        {
            _lblCaption = new TextElement("<select parameter>")
            {
                Size = new Size(SettingsConsts.MaxWidth, 50),
            };
            AddElement(_lblCaption);

            _comboSelect = new ComboBox
            {
                Size = new Size(SettingsConsts.MaxWidth, 50),
            };
            _comboSelect.SelectedIndexChanged += (s, e) => NotifyPropertyChanged("SelectedIndex");
            AddElement(_comboSelect);
        }
Beispiel #6
0
        public void horizontal_stack_panel_should_increase_width_for_children_if_need()
        {
            var stackPanel = new StackPanel(false);

            var child1 = new TextElement("someText 1") {Size = new Size(100, 75)};
            var child2 = new TextElement("someText 2") {Size = new Size(100, 75)};
            var child3 = new TextElement("someText 3") {Size = new Size(100, 75)};

            stackPanel.AddElement(child1);
            stackPanel.AddElement(child2);
            stackPanel.AddElement(child3);

            stackPanel.Size = new Size(100, 200);

            Assert.AreEqual(child1.Width + child2.Width + child3.Width, stackPanel.Size.Width);
        }
        public StringSettingsControl(FleuxControlPage settingsPage)
        {
            _lblCaption = new TextElement("<input parameter>")
            {
                Size = new Size(SettingsConsts.MaxWidth, 50),
            };
            AddElement(_lblCaption);

            _inputBox = new TextBox(settingsPage)
            {
                Size = new Size(SettingsConsts.MaxWidth, 50),
                MultiLine = false,
            };
            _inputBox.TextChanged += (s, e) => NotifyPropertyChanged("Value");
            AddElement(_inputBox);
        }
        public ColorSettingsControl(bool withDefaultColor)
        {
            _lblCaption = new TextElement("<select color>")
            {
                Size = new Size(SettingsConsts.MaxWidth, 50),
            };
            AddElement(_lblCaption);

            // colors consts for wp7 - see http://msdn.microsoft.com/en-us/library/ff402557%28v=vs.92%29.aspx
            var items = new List<object>()
                            {
                                new ColorItem(Color.FromArgb(216,0,115), "magenta"),
                                new ColorItem(Color.FromArgb(162,0,255), "purple"),
                                new ColorItem(Color.FromArgb(0,171,169), "teal"),
                                new ColorItem(Color.FromArgb(162,193,57), "lime"),
                                new ColorItem(Color.FromArgb(160,80,0), "brown"),
                                new ColorItem(Color.FromArgb(230,113,184), "pink"),
                                new ColorItem(Color.FromArgb(240,150,9), "orange"),
                                new ColorItem(Color.FromArgb(27,161,226), "blue"),
                                new ColorItem(Color.FromArgb(229,20,0), "red"),
                                new ColorItem(Color.FromArgb(51,153,51), "green"),
                                new ColorItem(Color.FromArgb(255,255,255), "white"),
                                new ColorItem(Color.FromArgb(0,0,0), "black"),
                            };
            if (withDefaultColor)
                items.Insert(0, new ColorItem(Color.Empty, "<default>"));

            _comboSelect = new ColorComboBox
            {
                Size = new Size(SettingsConsts.MaxWidth, 50),
                Items = items,
            };

            _comboSelect.SelectedIndexChanged += (s, e) =>
                                                     {
                                                         NotifyPropertyChanged("Value");
                                                         NotifyPropertyChanged("ARGBValue");
                                                     };
            AddElement(_comboSelect);
        }
        public FileSettingsControl(FleuxControlPage settingsPage)
        {
            _lblCaption = new TextElement("<file selection>")
            {
                Size = new Size(SettingsConsts.MaxWidth, 50),
            };
            AddElement(_lblCaption);

            _inputBox = new TextBox(settingsPage)
            {
                Size = new Size(SettingsConsts.MaxWidth, 150),
                MultiLine = true,
            };
            _inputBox.TextChanged += (s, e) => NotifyPropertyChanged("Value");
            AddElement(_inputBox);

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

            var buttonPanel = new Canvas() { Size = new Size(SettingsConsts.MaxWidth, 50), };
            AddElement(buttonPanel);

            var buttonSelectImage = new Fleux.UIElements.Button("select".Localize())
            {
                Size = new Size(SettingsConsts.MaxWidth / 2 - 10, 50),
                Location = new Point(0, 0),
                TapHandler = p => { BrowseFile(); return true; },
            };
            buttonPanel.AddElement(buttonSelectImage);

            var buttonClearImage = new Fleux.UIElements.Button("clear".Localize())
            {
                Size = new Size(SettingsConsts.MaxWidth / 2 - 10, 50),
                Location = new Point(SettingsConsts.MaxWidth / 2 + 10, 0),
                TapHandler = p => { Value = ""; return true; },
            };
            buttonPanel.AddElement(buttonClearImage);
        }
        public ContactSettingsControl()
        {
            _lblCaption = new TextElement("<contact selection>")
            {
                Size = new Size(SettingsConsts.MaxWidth, 50),
            };
            AddElement(_lblCaption);

            _labelContactName = new TextElement(ContactNotSelected)
            {
                Size = new Size(SettingsConsts.MaxWidth, 50),
                Style = MetroTheme.PhoneTextAccentStyle,
            };
            AddElement(_labelContactName);

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

            var buttonPanel = new Canvas { Size = new Size(SettingsConsts.MaxWidth, 50), };
            AddElement(buttonPanel);

            var buttonSelectImage = new Fleux.UIElements.Button("select")
            {
                Size = new Size(SettingsConsts.MaxWidth / 2 - 10, 50),
                Location = new Point(0, 0),
                TapHandler = p => { BrowseContact(); return true; },
            };
            buttonPanel.AddElement(buttonSelectImage);

            var buttonClearImage = new Fleux.UIElements.Button("clear")
            {
                Size = new Size(SettingsConsts.MaxWidth / 2 - 10, 50),
                Location = new Point(SettingsConsts.MaxWidth / 2 + 10, 0),
                TapHandler = p => { Value = -1; return true; },
            };
            buttonPanel.AddElement(buttonClearImage);
        }
Beispiel #11
0
        public void vertical_stack_panel_should_relayout_correct_with_columns()
        {
            var stackPanel = new StackPanel(true) {Columns = 2};

            var child1 = new TextElement("someText 1") { Size = new Size(70, 75) };
            var child2 = new TextElement("someText 2") { Size = new Size(70, 75) };
            var child3 = new TextElement("someText 3") { Size = new Size(70, 75) };

            stackPanel.AddElement(child1);
            stackPanel.AddElement(child2);
            stackPanel.AddElement(child3);

            stackPanel.Size = new Size(100, 300);
            var columnSize = stackPanel.Size.Width / stackPanel.Columns;

            Assert.AreEqual(child1.Location.Y, 0);
            Assert.AreEqual(child1.Location.X, 0);

            Assert.AreEqual(child2.Location.Y, 0);

            Assert.AreEqual(child2.Location.X, columnSize);

            Assert.AreEqual(child3.Location.X, 0);
            Assert.AreEqual(child3.Location.Y, child1.Height);
        }
Beispiel #12
0
        public void vertical_stack_panel_should_relayout_correct()
        {
            var stackPanel = new StackPanel(true);

            var child1 = new TextElement("someText 1") {Size = new Size(50, 75)};
            var child2 = new TextElement("someText 2") {Size = new Size(50, 75)};
            var child3 = new TextElement("someText 3") {Size = new Size(50, 75)};

            stackPanel.AddElement(child1);
            stackPanel.AddElement(child2);
            stackPanel.AddElement(child3);

            stackPanel.Size = new Size(100, 300);

            Assert.AreEqual(child1.Location.Y, 0);
            Assert.AreEqual(child2.Location.Y, child1.Height);
            Assert.AreEqual(child3.Location.Y, child1.Height + child2.Height);

            Assert.AreEqual(child1.Location.X, 0);
            Assert.AreEqual(child2.Location.X, 0);
            Assert.AreEqual(child3.Location.X, 0);
        }
Beispiel #13
0
        public void vertical_stack_panel_should_increase_height_for_children_if_need()
        {
            var stackPanel = new StackPanel(true);

            var child1 = new TextElement("someText 1") {Size = new Size(50, 75)};
            var child2 = new TextElement("someText 2") {Size = new Size(50, 75)};
            var child3 = new TextElement("someText 3") {Size = new Size(50, 75)};

            stackPanel.AddElement(child1);
            stackPanel.AddElement(child2);
            stackPanel.AddElement(child3);

            stackPanel.Size = new Size(100, 200);

            Assert.AreEqual(child1.Height + child2.Height + child3.Height, stackPanel.Size.Height);
        }
Beispiel #14
0
        public void vertical_stack_panel_should_have_desired_size_with_columns_when_autoResize_is_true()
        {
            var stackPanel = new StackPanel(false) { AutoResize = true, Size = new Size(50, 250), Columns = 2, IsVertical = true };

            var child1 = new TextElement("someText 1") { Size = new Size(100, 100) };
            var child2 = new TextElement("someText 2") { Size = new Size(100, 150) };
            var child3 = new TextElement("someText 3") { Size = new Size(100, 200) };

            stackPanel.AddElement(child1);
            stackPanel.AddElement(child2);
            stackPanel.AddElement(child3);

            Assert.AreEqual(child2.Height + child3.Height, stackPanel.Height);
        }
Beispiel #15
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;
        }
Beispiel #16
0
        public void horizontal_stack_panel_should_relayout_correct()
        {
            var stackPanel = new StackPanel(false);

            var child1 = new TextElement("someText 1") {Size = new Size(50, 75)};
            var child2 = new TextElement("someText 2") {Size = new Size(50, 75)};
            var child3 = new TextElement("someText 3") {Size = new Size(50, 75)};

            stackPanel.AddElement(child1);
            stackPanel.AddElement(child2);
            stackPanel.AddElement(child3);

            stackPanel.Size = new Size(300, 100);

            Assert.AreEqual(child1.Location.X, 0);
            Assert.AreEqual(child2.Location.X, child1.Width);
            Assert.AreEqual(child3.Location.X, child1.Width + child2.Width);

            Assert.AreEqual(child1.Location.Y, 0);
            Assert.AreEqual(child2.Location.Y, 0);
            Assert.AreEqual(child3.Location.Y, 0);
        }
Beispiel #17
0
        private void CreateVisual()
        {
            _background = new ScaledBackground(Settings.Background);
            AddElement(_background);

            const int leftOffset = 20;
            const int rightOffset = 10;

            var lineHeight = FleuxApplication.DummyDrawingGraphics.Style(_style).CalculateMultilineTextHeight("0", 100);

            _lblClock = new TextElement(GetText())
                            {
                                Style = _style,
                                AutoSizeMode = TextElement.AutoSizeModeOptions.None,
                                Size = new Size(ScreenConsts.ScreenWidth.ToLogic() - leftOffset - rightOffset, lineHeight * 4),
                                Location = new Point(leftOffset, ScreenConsts.ScreenHeight.ToLogic() - lineHeight * 4),
                            };
            AddElement(_lblClock);

            this.TapHandler = OnTap;
        }
Beispiel #18
0
        private void CreateVisual()
        {
            _background = new ScaledBackground(Settings.Background);
            AddElement(_background);

            this.AddElement(_topBar = new ScreenTopBar(new Size(ScreenConsts.ScreenWidth.ToLogic(), topbarHeight), true)
            {
                Location = new Point(0,0),
            });

            this.AddElement(_mediaPlayer = new ScreenMedia(new Size(ScreenConsts.ScreenWidth.ToLogic(), 150), true)
            {
                Location = new Point(0,topbarHeight),
            });

            this.AddElement(_statusPhone = new ScreenStatus(new Size(ScreenConsts.ScreenWidth.ToLogic(), 80), true)
            {
                Location = new Point(0, this.Size.Height - 80 - bottomOffset),
            });

            this.AddElement(_appointment = new ScreenAppointment(new Size(ScreenConsts.ScreenWidth.ToLogic(), 10), true)
            {
                Location = new Point(0, this._statusPhone.Location.Y),
            });
            _appointment.Location = new Point(0, this._statusPhone.Location.Y - _appointment.Size.Height);

            var lineHeight = FleuxApplication.DummyDrawingGraphics.Style(_style).CalculateMultilineTextHeight("0", 100);

            this.AddElement(_lblClock = new TextElement(GetText())
            {
                Style = _style,
                AutoSizeMode = TextElement.AutoSizeModeOptions.None,
                Size = new Size(ScreenConsts.ScreenWidth.ToLogic() - leftOffset - rightOffset, lineHeight * 3),
                Location = new Point(leftOffset, _appointment.Location.Y - bottomOffset - lineHeight * 3),
            });

            this.TapHandler = OnTap;
            _topBar.Active();
            _mediaPlayer.Active();
            UpdateTime();
            _appointment.Active();
            _statusPhone.Active();

            var messenger = TinyIoCContainer.Current.Resolve<ITinyMessengerHub>();
            messenger.Subscribe<FullScreenMessage>(OnFullScreen);
        }
Beispiel #19
0
        private PanoramaSection CreateFeaturedSection()
        {
            var img1 = ResourceManager.Instance.GetBitmapFromEmbeddedResource("thumbnail.png");
            var img2 = ResourceManager.Instance.GetBitmapFromEmbeddedResource("squareimg.png");
            var img3 = ResourceManager.Instance.GetBitmapFromEmbeddedResource("thumbnail2.png");

            var titleStyle = new TextStyle(HOBD.theme.PhoneFontFamilySemiBold, HOBD.theme.PhoneFontSizeLarge, Color.White);
            var subtitleStyle = HOBD.theme.PhoneTextBlockBase;
            var moreStyle = new TextStyle(HOBD.theme.PhoneTextLargeStyle.FontFamily, HOBD.theme.PhoneFontSizeMediumLarge, HOBD.theme.PanoramaNormalBrush);

            var section = new PanoramaSection("small");

            var grid = new Grid
            {
                Columns = new MeasureDefinition[] { 120, 180 },
                Rows = new MeasureDefinition[] { 70, 50, 70, 50, 70, 50, 75 }
            };

            grid[0, 0] = new ImageElement(img1) { Size = new Size(100, 100) };
            grid[0, 1] = new DynamicElement("ONE") { Style = titleStyle };
            grid[1, 1] = new DynamicElement("LOREM IPSUM LOREM") { Style = subtitleStyle };

            grid[2, 0] = new ImageElement(img2) { Size = new Size(100, 100) };
            grid[2, 1] = new DynamicElement("TWO") { Style = titleStyle };
            grid[3, 1] = new DynamicElement("LOREM IPSUM LOREM") { Style = subtitleStyle };

            grid[4, 0] = new ImageElement(img3) { Size = new Size(100, 100) };
            grid[4, 1] = new DynamicElement("THREE") { Style = titleStyle };
            grid[5, 1] = new DynamicElement("LOREM IPSUM LOREM") { Style = subtitleStyle };

            grid[6, 1] = new TextElement("more") { Style = moreStyle };

            section.AddElement(grid);
            // , 0, 0, 300, 700

            return section;
        }
        public MainSettingsPage(CustomSettingsPage<MainSettings> page)
        {
            _page = page;
            _page.OnApplySettings += (sender, settings) => OnApplySettings(settings);

            //!!Size = new Size(Size.Width - SettingsConsts.PaddingHor * 2, 1);

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

            this.AddElement(new Separator());

            // light/dark theme switcher
            var ctrTheme = new SelectSettingsControl
            {
                Caption = "Theme".Localize(),
                Items = new List<object> { "dark".Localize(), "light".Localize() },
            };
            this.AddElement(ctrTheme);
            _page.BindingManager.Bind(this, "ThemeIndex", ctrTheme, "SelectedIndex", true);

            this.AddElement(new Separator());

            // accent color
            var ctrAccent = new ColorSettingsControl(false)
            {
                Caption = "Accent Color".Localize(),
            };
            this.AddElement(ctrAccent);
            _page.BindingManager.Bind(this, "AccentColor", ctrAccent, "Value", true);

            this.AddElement(new Separator());

            // theme background
            var ctrThemeImage = new ImageSettingsControl
            {
                Caption = "Theme background".Localize(),
            };
            this.AddElement(ctrThemeImage);
            _page.BindingManager.Bind(_page.Settings, "ThemeImage", ctrThemeImage, "Value", true);

            this.AddElement(new Separator());

            // full screen
            var ctrFullScreen = new FlagSettingsControl()
            {
                Caption = "Full screen".Localize(),
            };
            this.AddElement(ctrFullScreen);
            _page.BindingManager.Bind(_page.Settings, "FullScreen", ctrFullScreen, "Value", true);

            this.AddElement(new Separator());

            // tile screen style
            var ctrTileTheme = new SelectSettingsControl
            {
                Caption = "Tiles style".Localize(),
                Items = new List<object> { "Windows Phone 7", "Windows 8" },
            };
            this.AddElement(ctrTileTheme);
            _page.BindingManager.Bind(_page.Settings, "TileThemeIndex", ctrTileTheme, "SelectedIndex", true);

            this.AddElement(new Separator());
        }
Beispiel #21
0
        public HubPage(string folderGuid)
            : base(false)
        {
            _folderGuid = folderGuid;

            ScreenRoutines.CursorWait();
            try
            {
                theForm.Menu = null;

                Control.ShadowedAnimationMode = FleuxControl.ShadowedAnimationOptions.FromRight;

                _background = new ScaledBackground("") { Size = this.Size.ToPixels() };
                Control.AddElement(_background);

                Content = new Canvas
                {
                    Size = new Size(this.Size.Width, this.Size.Height),
                    Location = new Point(0, 0)
                };
                Control.AddElement(Content);

                _appBar = new ApplicationBar
                {
                    Size = new Size(Content.Size.Width, AppBarHeight),
                    Location = new Point(0, Content.Size.Height - AppBarHeight)
                };
                _appBar.ButtonTap += OnAppBarButtonTap;
                _appBar.AddButton(ResourceManager.Instance.GetBitmapFromEmbeddedResource(
                    (MetroTheme.PhoneBackgroundBrush == Color.White) ?
                        "FolderWidget.Images.back-light.bmp" : "FolderWidget.Images.back-dark.bmp"
                    ));
                Content.AddElement(_appBar.AnimateHorizontalEntrance(false));

                _title = new TextElement("Folder hub")
                {
                    Style = MetroTheme.PhoneTextTitle1Style,
                    Location = new Point(24 - 3, 5), // -3 is a correction for Segoe fonts
                    AutoSizeMode = TextElement.AutoSizeModeOptions.OneLineAutoHeight,
                };
                _title.ResizeForWidth(Content.Size.Width);
                Content.AddElement(_title);

                _tileGrid = new HubPageTileGrid(new TileThemeWP7() { TilesPaddingTop = 0 },
                    _background, "", 4, 100)
                                {
                                    OnReadSettings = ReadSettings,
                                    OnWriteSettings = WriteSettings,
                                    OnShowMainSettings = ShowHubSettings,
                                };
                SetTilesLocation(_title.Bounds.Bottom + 50);
                Content.AddElement(_tileGrid);

                ReadSettings();

            }
            finally
            {
                ScreenRoutines.CursorNormal();
            }
        }
Beispiel #22
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();
            }
        }