using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using TheNovel.Properties;

namespace TheNovel
{
	public partial class Option : Form
	{
		Font myfont;

		public Option ()
		{
			InitializeComponent ();
			Langsup.ApplyOption ( this );
			myfont = Settings.Default.UserFont;
			FontSet.Text = myfont.Name + ", " + myfont.Size;
			Language.SelectedIndex = Settings.Default.Language;
			SystemPeriod.Value = Settings.Default.SystemPeriod;
		}

		private void Save_Click ( object sender, EventArgs e )
		{
			Settings.Default.UserFont = myfont;
			Settings.Default.Language = Language.SelectedIndex;
			Settings.Default.SystemPeriod = Convert.ToInt32 ( SystemPeriod.Value );
			Settings.Default.Save ();
			Langsup.LoadFile ();
			DialogResult = DialogResult.OK;
		}

		private void Font_Click ( object sender, EventArgs e )
		{
			FontDialog fd = new FontDialog ();
			fd.Font = myfont;
			if ( fd.ShowDialog () == DialogResult.Cancel ) return;
			myfont = fd.Font;
			FontSet.Text = myfont.Name + ", " + myfont.Size;
		}
	}
}
