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.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls.Primitives;
using System.Text.RegularExpressions;

namespace CSRender
{
    public partial class MainWindow : Window
    {
        //コンボボックスの要素
        public class ComboBoxSet
        {
            public int Id { get; set; }
            public string Item { get; set; }
        }

        //クリックしたときに全体を選択
        private void PageBox_GotFocusSelectAll(object sender, RoutedEventArgs e)
        {
            TextBox box = (TextBox)sender;
            //box.SelectAll();
            this.Dispatcher.InvokeAsync(() => { Task.Delay(10); box.SelectAll(); });
        }

        //ページ指定のプルダウンに応じてテキストボックスを活性化/非活性化
        private void PageRange_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            var SelectedItem = (ComboBoxSet)PageRange.SelectedItem;
            if (SelectedItem == null) return;
            string PageType = (string)SelectedItem.Item;
            if(PageType == "指定")
            {
                pageBox.IsEnabled = true;
                pageLabel.IsEnabled = true;
            }
            else
            {
                pageBox.IsEnabled = false;
                pageLabel.IsEnabled = false;
            }
        }
        
    }

   
}
