using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Forms;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using CatalogLib;
using GalaSoft.MvvmLight.Messaging;
using MaddoLibrary.Helpers;
using MahApps.Metro.Controls;
using WPFCatalog.Messages;

namespace WPFCatalog
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow
    {
        public PicSettings GlobalSettings = new PicSettings();
        public MainWindow()
        {
            InitializeComponent();
            
            this.DataContext = new MainWindowViewModel();

            SetDefaults();

            //((MainWindowViewModel) DataContext).
            Messenger.Default.Register<OpenFontWindowMessage>(this, OpenFonts);
        }

        private void SetDefaults()
        {

        }

        private void OpenFonts(OpenFontWindowMessage message)
        {
            FontDialog fd = new FontDialog();
            System.Windows.Forms.DialogResult dr = fd.ShowDialog();
            if (dr != System.Windows.Forms.DialogResult.Cancel)
            {
                //DialogHelper.PopUpMessage(fd.Font.Name);
                //cmbFont.Text = fd.Font.Name;
                //tbSomeText.FontFamily = new System.Windows.Media.FontFamily(fd.Font.Name);
                //tbSomeText.FontSize = fd.Font.Size * 96.0 / 72.0;
                //tbSomeText.FontWeight = fd.Font.Bold ? FontWeights.Bold : FontWeights.Regular;
                //tbSomeText.FontStyle = fd.Font.Italic ? FontStyles.Italic : FontStyles.Normal;
                
                message.Callback(new FontData()
                {
                    Name = fd.Font.Name,
                    Size = Math.Round(fd.Font.Size) /* 96.0 / 72.0*/,
                    Bold = fd.Font.Bold,
                    Italic =  fd.Font.Italic
                });
            }
        }

    }
}
