/// <summary> /// 窗口加载初始化 /// </summary> private void MainGUI_Load(object sender, EventArgs e) { // 检查更新 CheckUpdateUtils.CheckUpdate(); // 设定标题带版本号 Text = Text + " " + CheckUpdateUtils.VERSION; // 探测JDK JDKUtils.DetectJDKs(); if (JDKUtils.JDKVersions.Count == 0) { jdkAutoSetOption.Enabled = false; jdkAutoSetValue.Enabled = false; jdkNotFoundTip.Visible = true; jdkRecheck.Visible = true; jdkManualSetOption.Checked = true; } else { foreach (string version in JDKUtils.JDKVersions.Keys) { jdkAutoSetValue.Items.Add(version); } jdkAutoSetValue.SelectedIndex = 0; } // 探测Python PyUtils.GetPyVersions(); if (PyUtils.PythonVersions.Count == 0) { pyAutoSetOption.Enabled = false; pyAutoSetValue.Enabled = false; pyNotFoundTip.Visible = true; pyRecheck.Visible = true; pyManualSetOption.Checked = true; } else { foreach (string version in PyUtils.PythonVersions.Keys) { pyAutoSetValue.Items.Add(version); } pyAutoSetValue.SelectedIndex = 0; } mainToolTip.SetToolTip(isAppend, "勾选此项,指定值会被追加到Path变量最后,优先级最低;反之值会被插入到Path变量最前,优先级最高。"); mainToolTip.SetToolTip(JDKok, "点击以设定JDK环境变量。若已经设置JDK环境变量,还可以选择列表中其它版本JDK然后点击设定按钮以切换至指定JDK版本。"); mainToolTip.SetToolTip(pyOk, "点击以设定Python环境变量。若已经设置Python环境变量,还可以选择列表中其它版本Python然后点击设定按钮以切换至指定Python版本。"); }
/// <summary> /// 重新探测JDK按钮 /// </summary> private void jdkRecheck_Click(object sender, EventArgs e) { JDKUtils.DetectJDKs(); if (JDKUtils.JDKVersions.Count != 0) { jdkAutoSetOption.Enabled = true; jdkAutoSetValue.Enabled = true; jdkNotFoundTip.Visible = false; jdkRecheck.Visible = false; jdkAutoSetOption.Checked = true; foreach (string version in JDKUtils.JDKVersions.Keys) { jdkAutoSetValue.Items.Add(version); } jdkAutoSetValue.SelectedIndex = 0; } }