Exemplo n.º 1
0
        public GamesView()
        {
            this.InitializeComponent();
            Users = new ObservableCollection<UserViewModel>();
            Games = new ObservableCollection<GameViewModel>();
            TeamWork = new ObservableCollection<UserViewModel>();
            ComputerIAs = new ObservableCollection<UserViewModel>();

            var JarvisIA = new ComputerIA();
            JarvisIA.Id = 1;
            JarvisIA.Name = "Jarvis";
            JarvisIA.Email = "*****@*****.**";
            JarvisIA.PictureUri = new Uri("ms-appx:///Assets/Jarvis.png");
            JarvisIA.JobTitle = "FullTime IA";
            UserViewModel jarvis = UserViewModel.MergeFromComputerIA(JarvisIA);
            ComputerIAs.Add(jarvis);
            var MarkovIA = new ComputerIA();
            JarvisIA.Id = 2;
            MarkovIA.Name = "Markov";
            MarkovIA.Email = "*****@*****.**";
            MarkovIA.PictureUri = new Uri("ms-appx:///Assets/Markov.png");
            MarkovIA.JobTitle = "FullTime IA";
            UserViewModel markov = UserViewModel.MergeFromComputerIA(MarkovIA);
            ComputerIAs.Add(markov);

            AutoSuggestBox.Text = string.Empty;
            this.NavigationCacheMode = NavigationCacheMode.Required;
        }
Exemplo n.º 2
0
        internal static UserViewModel MergeFromComputerIA(ComputerIA u)
        {
            UserViewModel userViewModel = new UserViewModel();
            userViewModel.id = u.Id.ToString();
            userViewModel.Name = u.Name;
            userViewModel.JobTitle = u.JobTitle;
            userViewModel.Email = u.Email;
            userViewModel.photoUri = u.PictureUri;

            var folder = ApplicationData.Current.LocalFolder;
            BitmapImage photo = new BitmapImage(userViewModel.photoUri);

            userViewModel.Photo = (ImageSource) photo;
            userViewModel.IsLoadedPhoto = true;

            return userViewModel;
        }