using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace WpfBrowserApplication
{
    /// <summary>
    /// Interaction logic for Page1.xaml
    /// </summary>
    public partial class Page1 : Page
    {
        public Page1()
        {
            InitializeComponent();
        }
        private void hyperlink_Click(object sender, RoutedEventArgs e)
        {
            //nowy obiekt PageFunction
            PageFunction1 pageFunction = new PageFunction1();
            //rejestracja uchwytu dla zdarzenia Return
            pageFunction.Return += new ReturnEventHandler<Favourites>(pageFunction_Return);
            //przekierowanie do strony PageFunction
            this.NavigationService.Navigate(pageFunction);
        }
        void pageFunction_Return(object sender, ReturnEventArgs<Favourites> e)
        {
            if (e != null)
            {
                //odczytanie obiektu Favourites i przepisanie jego danych do textBlock1
                Favourites returnValue = e.Result;
                textBlock1.Text = "Kolor to: " + returnValue.Color + " ,a film to: " + returnValue.Movie;
            }
            else textBlock1.Text = "Brak danych";
        }
    }

}
