Example #1
0
        void BtnAddFavorite_Click(object sender, RoutedEventArgs e)
        {
            if (PopupFavorite.IsOpen && PopupFavorite.DataContext is Favorite)
            {
                var fav = (Favorite)PopupFavorite.DataContext;
                Favorites.List.Add(fav);

                try
                {
                    Favorites.Save();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, ex.Message, Title, MessageBoxButton.OK, MessageBoxImage.Error);
                }

                PopupFavorite.IsOpen      = false;
                PopupFavorite.DataContext = null;
            }
        }