using System.Windows;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Reactive;
using System.Diagnostics;
using System.Threading;
using System.Linq;

namespace WPRx1
{
    public partial class MainPage : PhoneApplicationPage
    {
        NumberObserver n1;
        // Constructor
        public MainPage()
        {
            InitializeComponent();
            n1 = new NumberObserver();
            n1.Subscribe(
                x =>
                {
                    tbResults.Text += x + "\r\n";
                },
                ex => Debug.WriteLine("Whoops - Error"),
                () => Debug.WriteLine("Completed"));
        }

        private void btnAddNumber_Click(object sender, RoutedEventArgs e)
        {
            n1.AddNumber(2);
        }
    }
}
