public override ICollection<UIElement> EditControls(FleuxControlPage settingsPage)
        {
            var controls = base.EditControls(settingsPage);
            var bindingManager = new BindingManager();

            var colorControl = new ColorSettingsControl(true)
                                   {
                                       Caption = "Tile color".Localize(),
                                       ARGBValue = _tileColor,
                                   };
            controls.Add(colorControl);
            bindingManager.Bind(this, "TileColor", colorControl, "ARGBValue");

            var imgControl = new ImageSettingsControl()
                                 {
                                     Caption = "Button background".Localize(),
                                     Value = TileImage,
                                 };
            controls.Add(imgControl);
            bindingManager.Bind(this, "TileImage", imgControl, "Value");

            return controls;
        }
Example #2
0
        public virtual ICollection<UIElement> EditControls(FleuxControlPage settingsPage, BindingManager bindingManager)
        {
            var controls = new List<UIElement>();

            var ctrLockScreenImage = new ImageSettingsControl
                                         {
                                             Caption = "Lock screen background",
                                         };
            controls.Add(ctrLockScreenImage);
            bindingManager.Bind(this, "Background", ctrLockScreenImage, "Value", true);

            var formatControl = new SelectSettingsControl
                                    {
                                        Caption = "Date format",
                                        Items = _dateSamples,
                                    };
            controls.Add(formatControl);
            bindingManager.Bind(this, "DateSampleIndex", formatControl, "SelectedIndex", true);

            var flagControl = new FlagSettingsControl
                                  {
                                      Caption = "24-Hours",
                                  };
            controls.Add(flagControl);
            bindingManager.Bind(this, "Is24Hour", flagControl, "Value", true);
            /*****************************************************************************************************/
            // Top Bar
            /* Блокируем нет пока иконок черного цвета
            var TopBarWhiteIconflagControl = new FlagSettingsControl { Caption = "TopBar white Icon", };
            controls.Add(TopBarWhiteIconflagControl);
            bindingManager.Bind(this, "TopBarWhiteIcon", TopBarWhiteIconflagControl, "Value", true);*/

            var TopBarColorBatteryflagControl = new FlagSettingsControl { Caption = "TopBar color battery", };
            controls.Add(TopBarColorBatteryflagControl);
            bindingManager.Bind(this, "TopBarColorBattery", TopBarColorBatteryflagControl, "Value", true);

            var TopBarFontColorControl = new ColorSettingsControl(true) { Caption = "TopBar time color", };
            controls.Add(TopBarFontColorControl);
            bindingManager.Bind(this, "TopBarFontColorIndex", TopBarFontColorControl, "Value", true);
            /*****************************************************************************************************/
            // Media Player
            var PlayerWhiteIconflagControl = new FlagSettingsControl { Caption = "Player white icon", };
            controls.Add(PlayerWhiteIconflagControl);
            bindingManager.Bind(this, "PlayerWhiteIcon", PlayerWhiteIconflagControl, "Value", true);

            var PlayerFontColorControl = new ColorSettingsControl(true) { Caption = "Player text color", };
            controls.Add(PlayerFontColorControl);
            bindingManager.Bind(this, "PlayerFontColorIndex", PlayerFontColorControl, "Value", true);
            /*****************************************************************************************************/
            // Date Time
            /* Пока не сделал отображение будильника
            var DateTimeWhiteIconflagControl = new FlagSettingsControl { Caption = "Alarm white icon", };
            controls.Add(DateTimeWhiteIconflagControl);
            bindingManager.Bind(this, "DateTimeWhiteIcon", DateTimeWhiteIconflagControl, "Value", true);*/

            var DateTimeFontColorControl = new ColorSettingsControl(true) { Caption = "Date text color", };
            controls.Add(DateTimeFontColorControl);
            bindingManager.Bind(this, "DateTimeFontColorIndex", DateTimeFontColorControl, "Value", true);
            /*****************************************************************************************************/
            // Appointment
            var AppointmentWhiteIconflagControl = new FlagSettingsControl { Caption = "Appointment white icon", };
            controls.Add(AppointmentWhiteIconflagControl);
            bindingManager.Bind(this, "AppointmentWhiteIcon", AppointmentWhiteIconflagControl, "Value", true);

            var AppointmentFontColorControl = new ColorSettingsControl(true) { Caption = "Appointment text color", };
            controls.Add(AppointmentFontColorControl);
            bindingManager.Bind(this, "AppointmentFontColorIndex", AppointmentFontColorControl, "Value", true);
            /*****************************************************************************************************/
            // Status
            var StatusWhiteIconflagControl = new FlagSettingsControl { Caption = "Status white icon", };
            controls.Add(StatusWhiteIconflagControl);
            bindingManager.Bind(this, "StatusWhiteIcon", StatusWhiteIconflagControl, "Value", true);

            var StatusFontColorControl = new ColorSettingsControl(true) { Caption = "Status text color", };
            controls.Add(StatusFontColorControl);
            bindingManager.Bind(this, "StatusFontColorIndex", StatusFontColorControl, "Value", true);

            return controls;
        }
Example #3
0
        public override ICollection<UIElement> EditControls(FleuxControlPage settingsPage)
        {
            var controls = base.EditControls(settingsPage);
            var bindingManager = new BindingManager();

            var WhiteIconflagControl = new FlagSettingsControl { Caption = "Player white icon", };
            controls.Add(WhiteIconflagControl);
            bindingManager.Bind(this, "WhiteIcon", WhiteIconflagControl, "Value", true);

            var fontNameControl = new SelectSettingsControl { Caption = "Font Name", Items = _fontNamesData, };
            controls.Add(fontNameControl);
            bindingManager.Bind(this, "FontNameIndex", fontNameControl, "SelectedIndex", true);

            var fontSizeControl = new SelectSettingsControl { Caption = "Font Size", Items = _fontSizesData, };
            controls.Add(fontSizeControl);
            bindingManager.Bind(this, "FontSizeIndex", fontSizeControl, "SelectedIndex", true);

            var fontColorControl = new ColorSettingsControl(true) { Caption = "Font Color", };
            controls.Add(fontColorControl);
            bindingManager.Bind(this, "FontColorIndex", fontColorControl, "Value", true);

            foreach (var control in controls)
                if (control.Name.Contains("Icon"))
                {
                    controls.Remove(control);
                    break;
                }
            foreach (var control in controls)
                if (control.Name.Contains("Caption"))
                {
                    controls.Remove(control);
                    break;
                }

            return controls;
        }
        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());
        }
Example #5
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();
            }
        }