/*
         * async void Selector_PropertyChanged(object sender, PropertyChangedEventArgs e)
         * {
         *
         *
         *
         *
         * switch(e.PropertyName)
         * {
         * case "SelectedIndex":
         *  var cookieContainer = new CookieContainer();
         *  var currentGetter = nicoSessionComboBox1.Selector.SelectedImporter;
         *  if (currentGetter != null)
         *  {
         * //                        var result = await currentGetter.GetCookiesAsync(TargetUrl);
         *
         * //                        var cookie = result.Status == CookieImportState.Success ? result.Cookies["user_session"] : null;
         *
         *      //logText.Text += cookie.Name + cookie.Value+ cookie.Expires;
         *
         *      //UI更新
         * //                        txtCookiePath.Text = currentGetter.SourceInfo.CookiePath;
         * //                        btnOpenCookieFileDialog.Enabled = true;
         * //                        txtUserSession.Text = cookie != null ? cookie.Value : null;
         * //                        txtUserSession.Enabled = result.Status == CookieImportState.Success;
         *      //Properties.Settings.Default.SelectedSourceInfo = currentGetter.SourceInfo;
         *      //Properties.Settings.Default.Save();
         * //                        config.set("browserNum", nicoSessionComboBox1.Selector.SelectedIndex.ToString());
         * //                        if (cookie != null) config.set("user_session", cookie.Value);
         * //                        config.set("isAllBrowserMode", nicoSessionComboBox1.Selector.IsAllBrowserMode.ToString());
         *  }
         *  else
         *  {
         * //                        txtCookiePath.Text = null;
         * //                        txtUserSession.Text = null;
         * //                        txtUserSession.Enabled = false;
         * //                        btnOpenCookieFileDialog.Enabled = false;
         *  }
         *  break;
         * }
         * }
         *
         * void btnReload_Click(object sender, EventArgs e)
         * {
         *      util.debugWriteLine(DateTime.Now.ToString("{W}"));
         *      var si = nicoSessionComboBox1.Selector.SelectedImporter.SourceInfo;
         *      util.debugWriteLine(si.EngineId + " " + si.BrowserName + " " + si.ProfileName);
         * //			var a = new SunokoLibrary.Application.Browsers.FirefoxImporterFactory();
         * //			foreach (var b in a.GetCookieImporters()) {
         * //				var c = b.GetCookiesAsync(TargetUrl);
         * //				c.ConfigureAwait(false);
         *
         * //				util.debugWriteLine(c.Result.Cookies["user_session"]);
         * //			}
         *      util.debugWriteLine(nicoSessionComboBox1.Selector.SelectedImporter.SourceInfo.CookiePath);
         *      //System.IO.Directory.CreateDirectory("aa/ss/u");
         *      //a.GetCookieImporter(new CookieSourceInfo("
         *      //var tsk = nicoSessionComboBox1.Selector.UpdateAsync();
         * }
         * void btnOpenCookieFileDialog_Click(object sender, EventArgs e)
         * { var tsk = nicoSessionComboBox1.ShowCookieDialogAsync(); }
         * void checkBoxShowAll_CheckedChanged(object sender, EventArgs e)
         * { nicoSessionComboBox1.Selector.IsAllBrowserMode = checkBoxShowAll.Checked;
         * //config.set("isAllBrowserMode", nicoSessionComboBox1.Selector.IsAllBrowserMode.ToString());
         * }
         * void playBtn_Click(object sender, EventArgs e)
         * { player.play();}
         */
        void optionItem_Select(object sender, EventArgs e)
        {
            try {
                optionForm o    = new optionForm(config);
                var        size = config.get("fontSize");
                if (o.ShowDialog() == DialogResult.OK)
                {
                    changeRecBtnClickEvent(bool.Parse(config.get("IsRecBtnOnlyMouse")));

                    var newSize = config.get("fontSize");
                    if (size != newSize)
                    {
                        //var formSize = Size;
                        //var loc = Location;
                        loadControlLayout();
                        util.setFontSize(int.Parse(newSize), this, true, 400);
                        //Size = formSize;
                        //Location = loc;
                        //check.popup.setPopupSize();
                    }
                }
            } catch (Exception ee) {
                util.debugWriteLine(ee.Message + " " + ee.StackTrace);
            }
        }
 /*
  * async void Selector_PropertyChanged(object sender, PropertyChangedEventArgs e)
  * {
  *
  *
  *
  *
  * switch(e.PropertyName)
  * {
  * case "SelectedIndex":
  *  var cookieContainer = new CookieContainer();
  *  var currentGetter = nicoSessionComboBox1.Selector.SelectedImporter;
  *  if (currentGetter != null)
  *  {
  * //                        var result = await currentGetter.GetCookiesAsync(TargetUrl);
  *
  * //                        var cookie = result.Status == CookieImportState.Success ? result.Cookies["user_session"] : null;
  *
  *      //logText.Text += cookie.Name + cookie.Value+ cookie.Expires;
  *
  *      //UI更新
  * //                        txtCookiePath.Text = currentGetter.SourceInfo.CookiePath;
  * //                        btnOpenCookieFileDialog.Enabled = true;
  * //                        txtUserSession.Text = cookie != null ? cookie.Value : null;
  * //                        txtUserSession.Enabled = result.Status == CookieImportState.Success;
  *      //Properties.Settings.Default.SelectedSourceInfo = currentGetter.SourceInfo;
  *      //Properties.Settings.Default.Save();
  * //                        config.set("browserNum", nicoSessionComboBox1.Selector.SelectedIndex.ToString());
  * //                        if (cookie != null) config.set("user_session", cookie.Value);
  * //                        config.set("isAllBrowserMode", nicoSessionComboBox1.Selector.IsAllBrowserMode.ToString());
  *  }
  *  else
  *  {
  * //                        txtCookiePath.Text = null;
  * //                        txtUserSession.Text = null;
  * //                        txtUserSession.Enabled = false;
  * //                        btnOpenCookieFileDialog.Enabled = false;
  *  }
  *  break;
  * }
  * }
  *
  * void btnReload_Click(object sender, EventArgs e)
  * {
  *      util.debugWriteLine(DateTime.Now.ToString("{W}"));
  *      var si = nicoSessionComboBox1.Selector.SelectedImporter.SourceInfo;
  *      util.debugWriteLine(si.EngineId + " " + si.BrowserName + " " + si.ProfileName);
  * //			var a = new SunokoLibrary.Application.Browsers.FirefoxImporterFactory();
  * //			foreach (var b in a.GetCookieImporters()) {
  * //				var c = b.GetCookiesAsync(TargetUrl);
  * //				c.ConfigureAwait(false);
  *
  * //				util.debugWriteLine(c.Result.Cookies["user_session"]);
  * //			}
  *      util.debugWriteLine(nicoSessionComboBox1.Selector.SelectedImporter.SourceInfo.CookiePath);
  *      //System.IO.Directory.CreateDirectory("aa/ss/u");
  *      //a.GetCookieImporter(new CookieSourceInfo("
  *      //var tsk = nicoSessionComboBox1.Selector.UpdateAsync();
  * }
  * void btnOpenCookieFileDialog_Click(object sender, EventArgs e)
  * { var tsk = nicoSessionComboBox1.ShowCookieDialogAsync(); }
  * void checkBoxShowAll_CheckedChanged(object sender, EventArgs e)
  * { nicoSessionComboBox1.Selector.IsAllBrowserMode = checkBoxShowAll.Checked;
  * //config.set("isAllBrowserMode", nicoSessionComboBox1.Selector.IsAllBrowserMode.ToString());
  * }
  * void playBtn_Click(object sender, EventArgs e)
  * { player.play();}
  */
 void optionItem_Select(object sender, EventArgs e)
 {
     try {
         optionForm o = new optionForm(config); o.ShowDialog();
     } catch (Exception ee) {
         util.debugWriteLine(ee.Message + " " + ee.StackTrace);
     }
 }