using System.ComponentModel.Composition;
using System.Windows;
using System.Windows.Browser;
using TaskIt.Modules.Help.ViewModels;

namespace TaskIt.Modules.Help.Views
{
    public partial class HelpPage
    {
        public HelpPage()
        {
            InitializeComponent();
            CompositionInitializer.SatisfyImports(this);
            DataContext = PageViewModel;

            PageViewModel.ViewHtml += OnViewHtml;
        }

        void OnViewHtml(object sender, RoutedEventArgs e)
        {
            // TODO: Ross - This is a workaround because binding to the SourceUrl property is not working
            //HTMLViewer.SourceUrl = ViewModel.HtmlSourceUri;
            //HTMLViewerWindow.ShowDialog();
            HtmlPage.Window.Navigate(PageViewModel.HtmlSourceUri, "_blank");
        }

        [Import]
        public HelpPageViewModel PageViewModel { get; set; }
    }
}