Пример #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();
            }
        }
Пример #2
0
        public WirelessControlPage()
            : base("WIRELESS CONTROL", "", false)
        {
            ScreenRoutines.CursorWait();

            try
            {
                theForm.Menu = null;
                theForm.ControlBox = false;
                Control.ShadowedAnimationMode = FleuxControl.ShadowedAnimationOptions.FromRight;

                Content.Location = new Point(0, 80);
                Content.Size = new Size(Size.Width, Size.Height - 80);

                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(ResPatch +
                    ((MetroTheme.PhoneBackgroundBrush == Color.White) ?
                        "back-light.bmp" : "back-dark.bmp"
                    )));
                appBar.ButtonTap += (sender, args) => Close();
                Content.AddElement(appBar.AnimateHorizontalEntrance(false));

                UpdateStatus();

                if (_phoneCur == "phone")
                {
                    CreateButton(_phoneCur, 27, 0, TapPhone);
                }
                else
                {
                    CreateButton(_phoneCur, 254, 227, TapAir);
                }

                CreateButton(_wifiCur, 254, 0, TapWifi);
                CreateButton(_blueCur, 27, 227, TapBlue);
            }
            finally
            {
                ScreenRoutines.CursorNormal();
            }
        }
Пример #3
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();
            }
        }
Пример #4
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();
            }
        }