Ejemplo n.º 1
0
        private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (listBox.SelectedItem != null)
            {
                string text = (string)listBox.SelectedItem;

                TextName.Text = text;
                Contact selectedItem = getContactByUsername(text);
                if (selectedItem.Photo != null)
                {
                    imageProfile.Source = PhotoHandler.ToImage(selectedItem.Photo);
                }
                else
                {
                    imageProfile.Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"../../Img/user.png"));
                }
                if (selectedItem != null)
                {
                    if (selectedItem.IsFavourite)
                    {
                        favourite.Content = "Remove from favourites";
                    }
                    else
                    {
                        favourite.Content = "Mark as favourite";
                    }
                }

                ButtonSet(true, false, false);
            }
            else
            {
                ButtonSet(false, false, false);
            }
        }
Ejemplo n.º 2
0
        public OptionsWindow()
        {
            InitializeComponent();
            Application.Current.MainWindow.Closing += new CancelEventHandler(MainWindow_Closing);
            var image = UserRepo.fetchPhotoByUsername(Globals.currentUserId);

            if (image != null)
            {
                profile_image.Source = PhotoHandler.ToImage(UserRepo.fetchPhotoByUsername(Globals.currentUserId));
            }
            else
            {
                profile_image.Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"../../Img/user.png"));
            }
        }