Esempio n. 1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            // Username
            OldUsername          = e?.Parameter as string;
            UserNameTextBox.Text = OldUsername;

            // Profile colors
            var colors = new List <string> {
                "218:47:47", "233:127:13", "220:163:0",
                "101:163:3", "32:128:32", "13:152:186",
                "48:108:194", "145:86:178", "120:128:136"
            };
            var userColor = DressingRoom.ColorFor(OldUsername);

            if (!colors.Contains(userColor))
            {
                colors.Add(userColor);
            }
            UserColorGrid.ItemsSource = colors.Select(c => new ColorWrapper
            {
                Color = c
            });
            var color = (UserColorGrid.ItemsSource as IEnumerable <ColorWrapper>)
                        .First(c => c.Color.Equals(userColor, StringComparison.InvariantCulture));

            UserColorGrid.SelectedIndex = colors.IndexOf(color.Color);

            // Profile icons
            var icons = new List <string>
            {
                "Assets/Icons/man.png",
                "Assets/Icons/woman.png",
                "Assets/Icons/baby-girl.png"
            };
            var userIcon = DressingRoom.IconFor(OldUsername);

            if (!icons.Contains(userIcon))
            {
                icons.Add(userIcon);
            }
            UserIconGrid.ItemsSource = icons.Select(i => new IconWrapper
            {
                Icon = i
            });
            var icon = (UserIconGrid.ItemsSource as IEnumerable <IconWrapper>)
                       .First(i => i.Icon.Equals(userIcon, StringComparison.InvariantCulture));

            UserIconGrid.SelectedIndex = icons.IndexOf(icon.Icon);
        }
Esempio n. 2
0
        public MainPage()
        {
            InitializeComponent();

            // Bind users to list
            var users = DressingRoom.ListAvailable();

            UserPanel.ItemsSource = users.Select(u => new
            {
                Username         = u,
                ProfileColor     = DressingRoom.ColorFor(u),
                ProfileIcon      = DressingRoom.IconFor(u),
                UserClickCommand = UserClickCommand.Instance
            });
        }