Here are the examples of the csharp api System.Windows.Forms.Form.Close() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3505 Examples
19
View Source File : GmicConfigDialog.cs
License : GNU General Public License v3.0
Project Creator : 0xC0000054
License : GNU General Public License v3.0
Project Creator : 0xC0000054
private void GmicThreadFinished(DialogResult result)
{
workerThread.Join();
workerThread = null;
if (result == DialogResult.OK)
{
DialogResult = ProcessOutputImages();
}
else
{
DialogResult = DialogResult.Cancel;
}
Close();
}
19
View Source File : GmicConfigDialog.cs
License : GNU General Public License v3.0
Project Creator : 0xC0000054
License : GNU General Public License v3.0
Project Creator : 0xC0000054
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
Opacity = 0;
if (File.Exists(GmicPath))
{
workerThread = new Thread(new ThreadStart(GmicThread)) { IsBackground = true };
// The thread must use a single-threaded apartment to access the clipboard.
workerThread.SetApartmentState(ApartmentState.STA);
workerThread.Start();
}
else
{
ShowErrorMessage(Resources.GmicNotFound);
DialogResult = DialogResult.Cancel;
Close();
}
}
19
View Source File : Login.cs
License : MIT License
Project Creator : 1-EXON
License : MIT License
Project Creator : 1-EXON
private void log_in_click()
{
if (webhookLink.Text == string.Empty)
{
MessageBox.Show("WebHook Link를 입력하시지 않았습니다.");
return;
}
Data.discordLink = webhookLink.Text;
this.Close();
}
19
View Source File : FileAttrForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
19
View Source File : ConditionTaskForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
private void button2_Click(object sender, EventArgs e)
{
string name = task_name.Text;
int count = customShellListView.Items.Count;
Object item1 = scb_condition1.SelectedItem;
Object item2 = scb_condition2.SelectedItem;
Object item3 = scb_condition3.SelectedItem;
if (string.IsNullOrWhiteSpace(name))
{
MessageBox.Show(this, "请输入任务名称");
task_name.Focus();
}
else if (item1 == null)
{
MessageBox.Show(this, "请至少选择一个条件");
}
else if (count == 0)
{
MessageBox.Show(this, "请添加任务指令脚本(Shell)");
shell_name.Focus();
}
else
{
string condition = "";
ConditionItem ci1 = (ConditionItem)item1;
condition += gereplacedemUuid(ci1) + "," + (scb_status1.SelectedIndex == 1 ? "Y" : "N");
if(item2 != null){
ConditionItem ci2 = (ConditionItem)item2;
condition += gereplacedemCondi(1) + gereplacedemUuid(ci2) + "," + (scb_status2.SelectedIndex == 1 ? "Y" : "N");
if (item3 != null)
{
ConditionItem ci3 = (ConditionItem)item2;
condition += gereplacedemCondi(2) + gereplacedemUuid(ci3) + "," + (scb_status3.SelectedIndex == 1 ? "Y" : "N");
}
}
ListView.ListViewItemCollection coll = customShellListView.Items;
if (null == cmdShell)
{
cmdShell = new CmdShell();
cmdShell.Uuid = Guid.NewGuid().ToString("N");
}
JObject obj = null;
JArray list = new JArray();
List<TaskShell> shellList = new List<TaskShell>();
TaskShell task = null;
cmdShell.Name = name;
cmdShell.TaskType = TaskType.Condition;
cmdShell.Condition = condition;
cmdShell.Type = "条件任务";
foreach(ListViewItem item in coll){
obj = (JObject)item.Tag;
task = new TaskShell();
task.Uuid = Guid.NewGuid().ToString("N");
task.Shell = obj["code"].ToString();
task.Name = obj["name"].ToString();
shellList.Add(task);
}
cmdShell.ShellList = shellList;
if (null != this.callback)
{
this.callback(cmdShell);
}
this.Close();
}
}
19
View Source File : CustomScriptForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
private void button2_Click(object sender, EventArgs e)
{
// 取消
this.Close();
}
19
View Source File : InputForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
private void btn_sure_Click(object sender, EventArgs e)
{
if(result != null){
result(this.input.Text);
}
this.Close();
}
19
View Source File : InputForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
private void btn_cancel_Click(object sender, EventArgs e)
{
this.Close();
}
19
View Source File : InputSshPwdForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
void SkinTxt_KeyUp(object sender, KeyEventArgs e)
{
if(e.KeyCode == Keys.Enter){
string pwd = preplacedword.Text;
if(pwd.Length > 0){
this.Close();
pwdDelegate(pwd, cb_remenber.Checked);
}
}
}
19
View Source File : InputSshPwdForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
private void button1_Click(object sender, EventArgs e)
{
string pwd = preplacedword.Text;
if (pwd.Length > 0)
{
this.Close();
pwdDelegate(pwd, cb_remenber.Checked);
}
}
19
View Source File : MonitorItemForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
19
View Source File : MonitorItemForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
private void button1_Click(object sender, EventArgs e)
{
int index = tabControl1.SelectedIndex;
bool isnew = false;
if (monitorConfig == null)
{
isnew = true;
}
else
{
index = tabIndex;
}
if (index == 0)
{ // springboot
SpringBootMonitorItem item = new SpringBootMonitorItem();
item.AppName = stb_app_name.Text;
item.BuildFileName = stb_build_file.Text;
item.CrlFileName = stb_ctl_file.Text;
item.ShFileDir = stb_sh_dir.Text;
if (item.ShFileDir.EndsWith("/"))
{
item.ShFileDir = item.ShFileDir.Substring(0, item.ShFileDir.Length);
}
item.ProjectSourceDir = stb_project_source_dir.Text;
if (item.ProjectSourceDir.EndsWith("/"))
{
item.ProjectSourceDir = item.ProjectSourceDir.Substring(0, item.ProjectSourceDir.Length);
}
item.HomeUrl = stb_home_url.Text;
item.RunStatus = RunState.NoCheck;
if (string.IsNullOrWhiteSpace(item.HomeUrl))
{
item.HomeUrl = "http://" + config.Host + ":8080/";
}
if (string.IsNullOrWhiteSpace(item.AppName) || hasNonChar(item.AppName))
{
MessageBox.Show(this, "请填写应用名称,且不能包含'\",:;|");
return;
}
else if (string.IsNullOrWhiteSpace(item.ShFileDir))
{
MessageBox.Show(this, "请填写应用脚本目录");
return;
}
else if (string.IsNullOrWhiteSpace(item.BuildFileName))
{
MessageBox.Show(this, "请填写应用编译脚本文件名称");
return;
}
else if (string.IsNullOrWhiteSpace(item.CrlFileName))
{
MessageBox.Show(this, "请填写应用控制脚本文件名称");
return;
}
else if (string.IsNullOrWhiteSpace(item.ProjectSourceDir))
{
MessageBox.Show(this, "请填写应用代码存放目录");
return;
}
item.NeedAdd = cb_need_add.Checked;
if (item.NeedAdd)
{
item.ProjectSvnUrl = stb_project_svn.Text;
if (string.IsNullOrWhiteSpace(item.ProjectSvnUrl))
{
MessageBox.Show(this, "请填写应用SVN地址");
return;
}
}
if (isnew)
{
item.Uuid = Guid.NewGuid().ToString("N");
monitorConfig = new MonitorItemConfig();
}
else
{
item.Uuid = monitorConfig.spring.Uuid;
}
monitorConfig.spring = item;
}
else if (index == 1)
{ // tomcat
TomcatMonitorItem item = new TomcatMonitorItem();
item.TomcatName = stb_tomcat_name.Text;
item.TomcatDir = stb_tomcat_path.Text;
item.TomcatPort = stb_tomcat_port.Text;
item.RunStatus = RunState.NoCheck;
if (string.IsNullOrWhiteSpace(item.TomcatName) || hasNonChar(item.TomcatName))
{
MessageBox.Show(this, "请填写Tomcat名称,且不能包含'\",:;|");
return;
}
else if (string.IsNullOrWhiteSpace(item.TomcatDir))
{
MessageBox.Show(this, "请填写Tomcat根目录");
return;
}
else if (string.IsNullOrWhiteSpace(item.TomcatPort))
{
item.TomcatPort = "8080";
}
if (isnew)
{
item.Uuid = Guid.NewGuid().ToString("N");
monitorConfig = new MonitorItemConfig();
}
else
{
item.Uuid = monitorConfig.tomcat.Uuid;
}
monitorConfig.tomcat = item;
}
else if (index == 2)
{ // nginx
NginxMonitorItem item = new NginxMonitorItem();
item.NginxName = stb_nginx_name.Text;
item.NginxPath = stb_nginx_path.Text;
item.NginxConfig = stb_nginx_conf.Text;
item.RunStatus = RunState.NoCheck;
if (string.IsNullOrWhiteSpace(item.NginxName) || hasNonChar(item.NginxName))
{
MessageBox.Show(this, "请填写Nginx名称,且不能包含'\",:;|");
return;
}
else if (string.IsNullOrWhiteSpace(item.NginxPath))
{
MessageBox.Show(this, "请填写Nginx执行文件完整路径");
return;
}
else if (string.IsNullOrWhiteSpace(item.NginxConfig))
{
MessageBox.Show(this, "请填写Nginx配置文件完整路径");
return;
}
if (isnew)
{
monitorConfig = new MonitorItemConfig();
item.Uuid = Guid.NewGuid().ToString("N");
}
else
{
item.Uuid = monitorConfig.nginx.Uuid;
}
monitorConfig.nginx = item;
}
else if (index == 3)
{ // ice
IceMonitorItem item = new IceMonitorItem();
item.AppName = stb_ice_appname.Text;
item.IceSrvDir = stb_ice_srvpath.Text;
item.NodePorts = stb_ice_ports.Text;
item.ServerName = stb_ice_servername.Text;
item.RunStatus = RunState.NoCheck;
if (string.IsNullOrWhiteSpace(item.AppName) || hasNonChar(item.AppName))
{
MessageBox.Show(this, "请填写项目名称,且不能包含'\",:;|");
return;
}
else if (string.IsNullOrWhiteSpace(item.IceSrvDir))
{
MessageBox.Show(this, "请填写项目Ice目录完整路径");
return;
}
else if (string.IsNullOrWhiteSpace(item.ServerName))
{
MessageBox.Show(this, "请填写Ice服务名称");
return;
}
else if (string.IsNullOrWhiteSpace(item.NodePorts))
{
MessageBox.Show(this, "请填写项目使用的端口号,多个以逗号(,)分隔");
return;
}
if (isnew)
{
monitorConfig = new MonitorItemConfig();
item.Uuid = Guid.NewGuid().ToString("N");
}
else
{
item.Uuid = monitorConfig.ice.Uuid;
}
monitorConfig.ice = item;
}
if (isnew)
{
config.MonitorConfigList.Add(monitorConfig);
}
AppConfig.Instance.SaveConfig(2);
if (null != parentForm && monitorConfig.spring != null)
{
// TODO 执行checkout
if (monitorConfig.spring.NeedAdd)
{
string home = parentForm.getSftp().getHome();
string buildStr = YSTools.YSFile.readFileToString(MainForm.CONF_DIR + "__build.sh");
string ctlStr = YSTools.YSFile.readFileToString(MainForm.CONF_DIR + "__ctl.sh");
if (monitorConfig.spring.ProjectSourceDir.StartsWith(home))
{
string path = monitorConfig.spring.ProjectSourceDir.Substring(home.Length);
if (path.StartsWith("/"))
{
path = path.Substring(1);
}
buildStr = buildStr.Replace("_sourcePath_", "~/" + path);
ctlStr = ctlStr.Replace("_sourcePath_", "~/" + path);
}
else
{
buildStr = buildStr.Replace("_sourcePath_", monitorConfig.spring.ProjectSourceDir);
ctlStr = ctlStr.Replace("_sourcePath_", monitorConfig.spring.ProjectSourceDir);
}
buildStr = buildStr.Replace("_projectName_", monitorConfig.spring.AppName);
ctlStr = ctlStr.Replace("_projectName_", monitorConfig.spring.AppName);
ctlStr = ctlStr.Replace("_disconfigUrl_", stb_disconfig_url.Text);
string localBuild = MainForm.CONF_DIR + monitorConfig.spring.BuildFileName;
string localCtl = MainForm.CONF_DIR + monitorConfig.spring.CrlFileName;
string remoteBuild = monitorConfig.spring.ShFileDir + "/" + monitorConfig.spring.BuildFileName;
string remoteCtl = monitorConfig.spring.ShFileDir + "/" + monitorConfig.spring.CrlFileName;
YSTools.YSFile.writeFileByString(localBuild, buildStr);
YSTools.YSFile.writeFileByString(localCtl, ctlStr);
ThreadPool.QueueUserWorkItem((a) =>
{
Thread.Sleep(500);
parentForm.BeginInvoke((MethodInvoker)delegate()
{
parentForm.getSftp().put(localBuild, remoteBuild, ChannelSftp.OVERWRITE);
parentForm.getSftp().put(localCtl, remoteCtl, ChannelSftp.OVERWRITE);
parentForm.RunShell("cd " + monitorConfig.spring.ProjectSourceDir, true);
parentForm.RunShell("svn checkout " + monitorConfig.spring.ProjectSvnUrl, true);
File.Delete(localBuild);
File.Delete(localCtl);
});
});
}
}
this.Close();
}
19
View Source File : NginxMappingItemForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
private void button1_Click(object sender, EventArgs e)
{
bool isnew = false;
if(this.pro == null){
pro = new NginxMonitorUrl();
pro.RunStatus = RunState.NoCheck;
isnew = true;
}
pro.url = stb_url.Text;
pro.host = stb_host.Text;
pro.check = cb_check.Checked;
if(isnew){
itemConfig.nginx.MonitorList.Add(pro);
}
this.Close();
}
19
View Source File : CustomScriptForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
private void button1_Click(object sender, EventArgs e)
{
// 保存
string cmd = stb_shell.Text;
if(string.IsNullOrWhiteSpace(cmd) || cmd.Length < 2){
label_info.Text = "请输入正确的Shell命令";
return;
}
if(cb_cr.Checked){
cmd += "&";
}
label_info.Text = "";
DefaultConfig.UpdateShellLisreplacedem(config.ShellList, index, cmd);
this.Close();
}
19
View Source File : FullScreenMonitorForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
public void Exit(){
this.Controls.Remove(form);
this.Close();
form.ExitFullScreen();
}
19
View Source File : AboutBox1.cs
License : MIT License
Project Creator : 1y0n
License : MIT License
Project Creator : 1y0n
private void okButton_Click(object sender, EventArgs e)
{
this.Close();
}
19
View Source File : LockForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
private void button3_Click(object sender, EventArgs e)
{
// 取消
this.Close();
}
19
View Source File : MonitorBaseForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
public virtual void CloseForm()
{
this.Close();
}
19
View Source File : SessionManageForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
private void button_conn_Click(object sender, EventArgs e)
{
this.Close();
// 连接
Program.MAIN.OpenSshSessionWindow(curr_session);
}
19
View Source File : SettingForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
private void buttonSave_Click(object sender, EventArgs e)
{
foreach (ListViewItem item in listView1.Items)
{
if (item.Checked)
{
AppConfig.Instance.MConfig.SkinIndex = Convert.ToInt32(item.Tag.ToString());
break;
}
}
AppConfig.Instance.SaveConfig(1);
this.Close();
}
19
View Source File : SshSettingForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
private void btn_Cancel_Click(object sender, EventArgs e)
{
this.Close();
}
19
View Source File : SshSettingForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
private void btn_Ok_Click(object sender, EventArgs e)
{
// 保存
if (config == null)
{
config = new SessionConfig();
config.Index = AppConfig.Instance.SessionConfigDict.Count + 1;
config.SessionId = "S" + YSTools.YSDateTime.ConvertDateTimeToLong();
config.Name = string.IsNullOrWhiteSpace(tb_name.Text) ? "New Session" + config.Index : tb_name.Text;
config.Host = tb_host.Text;
config.Port = (int) nud_port.Value;
config.Protocol = cb_protocol.SelectedItem.ToString();
config.Method = cb_method.SelectedItem.ToString();
config.RemenberPwd = cb_remenber_pwd.Checked;
config.UserName = tb_userName.Text;
config.Preplacedword = YSEncrypt.EncryptA(tb_preplacedword.Text, KeysUtil.PreplacedKey);
ColorTheme theme = new ColorTheme();
theme.ColorScheme = cb_scheme.SelectedItem.ToString();
theme.FontName = cb_fontName.SelectedItem.ToString();
theme.FontSize = Convert.ToInt32(cb_fontSize.SelectedItem.ToString());
config.Theme = theme;
AppConfig.Instance.SessionConfigDict.Add(config.Index + config.Name, config);
}
else
{
config.Name = string.IsNullOrWhiteSpace(tb_name.Text) ? "New Session" + config.Index : tb_name.Text;
config.Host = tb_host.Text;
config.Port = (int)nud_port.Value;
config.Protocol = cb_protocol.SelectedItem.ToString();
config.Method = cb_method.SelectedItem.ToString();
config.RemenberPwd = cb_remenber_pwd.Checked;
config.UserName = tb_userName.Text;
config.Preplacedword = YSEncrypt.EncryptA(tb_preplacedword.Text, KeysUtil.PreplacedKey);
config.Theme.ColorScheme = cb_scheme.SelectedItem.ToString();
config.Theme.FontName = cb_fontName.SelectedItem.ToString();
config.Theme.FontSize = Convert.ToInt32(cb_fontSize.SelectedItem.ToString());
if (AppConfig.Instance.SessionConfigDict.ContainsKey(config.SessionId))
{
AppConfig.Instance.SessionConfigDict.Remove(config.SessionId);
}
AppConfig.Instance.SessionConfigDict.Add(config.SessionId, config);
}
// 保存
AppConfig.Instance.SaveConfig();
this.Close();
}
19
View Source File : TextFindForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
private void btn_close_Click(object sender, EventArgs e)
{
this.Close();
}
19
View Source File : TimedTaskForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
private void button2_Click(object sender, EventArgs e)
{
string name = task_name.Text;
int count = customShellListView.Items.Count;
if (string.IsNullOrWhiteSpace(name))
{
MessageBox.Show(this, "请输入任务名称");
task_name.Focus();
}
else if (count == 0)
{
MessageBox.Show(this, "请添加任务指令脚本(Shell)");
shell_name.Focus();
}
else
{
ListView.ListViewItemCollection coll = customShellListView.Items;
if (null == cmdShell)
{
cmdShell = new CmdShell();
cmdShell.Type = "定时任务";
cmdShell.TaskType = TaskType.Timed;
}
cmdShell.Name = name;
JObject obj = null;
JArray list = new JArray();
List<TaskShell> shellList = new List<TaskShell>();
TaskShell task = null;
foreach(ListViewItem item in coll){
obj = (JObject)item.Tag;
task = new TaskShell();
task.Uuid = Guid.NewGuid().ToString("N");
task.DateTime = obj["time"].ToString();
task.Shell = obj["code"].ToString();
task.Name = obj["name"].ToString();
shellList.Add(task);
}
cmdShell.ShellList = shellList;
if (null != this.callback)
{
this.callback(cmdShell);
}
this.Close();
}
}
19
View Source File : CustomShellForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
private void button1_Click(object sender, EventArgs e)
{
string name = stb_name.Text;
string cmdstr = cmd.Text;
if(string.IsNullOrWhiteSpace(name)){
MessageBox.Show(this, "请定义一个名称");
return;
}
if (string.IsNullOrWhiteSpace(cmdstr))
{
MessageBox.Show(this, "请输入要执行的命令");
return;
}
List<TaskShell> cmdList = new List<TaskShell>();
string[] cmds = cmdstr.Split('\n');
TaskShell task = null;
foreach(string c in cmds){
if (!string.IsNullOrWhiteSpace(c.Trim()))
{
task = new TaskShell();
task.Uuid = Guid.NewGuid().ToString("N");
task.Name = "";
task.Shell = c.Trim();
cmdList.Add(task);
}
}
bool isnew = false;
if(shell == null){
shell = new CmdShell();
shell.Uuid = Guid.NewGuid().ToString("N");
shell.Target = uuid;
isnew = true;
}
shell.Name = name;
shell.Type = "自定义脚本";
shell.TaskType = TaskType.Default;
shell.ShellList = cmdList;
if (isnew)
{
config.CustomShellList.Add(shell);
}
AppConfig.Instance.SaveConfig(2);
this.Close();
}
19
View Source File : YmlNodeForm.cs
License : Apache License 2.0
Project Creator : 214175590
License : Apache License 2.0
Project Creator : 214175590
private void btn_sure_Click(object sender, EventArgs e)
{
if (treeNode != null)
{
YmlItem item = (YmlItem)treeNode.Tag;
item.Key = name.Text;
item.Value = value.Text;
item.Common = common.Text;
if (!item.Common.TrimStart().StartsWith("#") && item.Common != "")
{
item.Common = "#" + item.Common;
}
if(!item.Key.TrimStart().StartsWith("#")){
if (string.IsNullOrWhiteSpace(item.Value))
{
item.ImageIndex = 3;
}
else
{
item.ImageIndex = 1;
}
}
else
{
item.ImageIndex = 2;
}
treeNode.SubItems[0].Text = item.Key;
treeNode.SubItems[1].Text = item.Value;
treeNode.SubItems[3].Text = item.Common;
treeNode.ImageIndex = item.ImageIndex;
if (parenreplacedem != null)
{
treeNode.SubItems[2].Text = "" + (parenreplacedem.Level + 1);
item.Level = (parenreplacedem.Level + 1);
item.SpcCount = item.Level * 4;
treeNode.SubItems[2].Text = "" + item.Level;
if (callback != null)
{
callback(parenreplacedem);
}
}
}
this.Close();
}
19
View Source File : MainForm.cs
License : GNU General Public License v3.0
Project Creator : 2dust
License : GNU General Public License v3.0
Project Creator : 2dust
private void btnOK_Click(object sender, EventArgs e)
{
try
{
Process[] existing = Process.GetProcessesByName("v2rayN");
foreach (Process p in existing)
{
string path = p.MainModule.FileName;
if (path == GetPath("v2rayN.exe"))
{
p.Kill();
p.WaitForExit(100);
}
}
}
catch (Exception ex)
{
// Access may be denied without admin right. The user may not be an administrator.
showWarn("Failed to close v2rayN(关闭v2rayN失败).\n" +
"Close it manually, or the upgrade may fail.(请手动关闭正在运行的v2rayN,否则可能升级失败。\n\n" + ex.StackTrace);
}
StringBuilder sb = new StringBuilder();
try
{
if (!File.Exists(fileName))
{
if (File.Exists(defaultFilename))
{
fileName = defaultFilename;
}
else
{
showWarn("Upgrade Failed, File Not Exist(升级失败,文件不存在).");
return;
}
}
string thisAppOldFile = Application.ExecutablePath + ".tmp";
File.Delete(thisAppOldFile);
string startKey = "v2rayN/";
using (ZipArchive archive = ZipFile.OpenRead(fileName))
{
foreach (ZipArchiveEntry entry in archive.Entries)
{
try
{
if (entry.Length == 0)
{
continue;
}
string fullName = entry.FullName;
if (fullName.StartsWith(startKey))
{
fullName = fullName.Substring(startKey.Length, fullName.Length - startKey.Length);
}
if (Application.ExecutablePath.ToLower() == GetPath(fullName).ToLower())
{
File.Move(Application.ExecutablePath, thisAppOldFile);
}
string entryOuputPath = GetPath(fullName);
FileInfo fileInfo = new FileInfo(entryOuputPath);
fileInfo.Directory.Create();
entry.ExtractToFile(entryOuputPath, true);
}
catch (Exception ex)
{
sb.Append(ex.StackTrace);
}
}
}
}
catch (Exception ex)
{
showWarn("Upgrade Failed(升级失败)." + ex.StackTrace);
return;
}
if (sb.Length > 0)
{
showWarn("Upgrade Failed,Hold ctrl + c to copy to clipboard.\n" +
"(升级失败,按住ctrl+c可以复制到剪贴板)." + sb.ToString());
return;
}
Process.Start("v2rayN.exe");
MessageBox.Show("Upgrade successed(升级成功)", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
Close();
}
19
View Source File : MainForm.cs
License : GNU General Public License v3.0
Project Creator : 2dust
License : GNU General Public License v3.0
Project Creator : 2dust
private void btnClose_Click(object sender, EventArgs e)
{
Close();
}
19
View Source File : dlgAddVM.cs
License : MIT License
Project Creator : 86Box
License : MIT License
Project Creator : 86Box
private void btnAdd_Click(object sender, EventArgs e)
{
if (main.VMCheckIfExists(txtName.Text))
{
MessageBox.Show("A virtual machine with this name already exists. Please pick a different name.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (txtName.Text.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
{
MessageBox.Show("There are invalid characters in the name you specified. You can't use the following characters: \\ / : * ? \" < > |", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (existingVM && string.IsNullOrWhiteSpace(txtImportPath.Text))
{
MessageBox.Show("If you wish to import VM files, you must specify a path.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (existingVM)
{
main.VMImport(txtName.Text, txtDescription.Text, txtImportPath.Text, cbxOpenCFG.Checked, cbxStartVM.Checked);
}
else
{
main.VMAdd(txtName.Text, txtDescription.Text, cbxOpenCFG.Checked, cbxStartVM.Checked);
}
Close();
}
19
View Source File : dlgCloneVM.cs
License : MIT License
Project Creator : 86Box
License : MIT License
Project Creator : 86Box
private void btnClone_Click(object sender, EventArgs e)
{
if (main.VMCheckIfExists(txtName.Text))
{
MessageBox.Show("A virtual machine with this name already exists. Please pick a different name.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (txtName.Text.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
{
MessageBox.Show("There are invalid characters in the name you specified. You can't use the following characters: \\ / : * ? \" < > |", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
//Just import stuff from the existing VM
main.VMImport(txtName.Text, txtDescription.Text, oldPath, cbxOpenCFG.Checked, cbxStartVM.Checked);
Close();
}
19
View Source File : dlgEditVM.cs
License : MIT License
Project Creator : 86Box
License : MIT License
Project Creator : 86Box
private void btnCancel_Click(object sender, EventArgs e)
{
Close();
}
19
View Source File : dlgEditVM.cs
License : MIT License
Project Creator : 86Box
License : MIT License
Project Creator : 86Box
private void btnApply_Click(object sender, EventArgs e)
{
//Check if a VM with this name already exists
if (!originalName.Equals(txtName.Text) && main.VMCheckIfExists(txtName.Text))
{
MessageBox.Show("A virtual machine with this name already exists. Please pick a different name.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else if (txtName.Text.IndexOfAny(Path.GetInvalidFileNameChars()) >= 0)
{
MessageBox.Show("There are invalid characters in the name you specified. You can't use the following characters: \\ / : * ? \" < > |", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
main.VMEdit(txtName.Text, txtDesc.Text);
Close();
}
}
19
View Source File : dlgSettings.cs
License : MIT License
Project Creator : 86Box
License : MIT License
Project Creator : 86Box
private void btnOK_Click(object sender, EventArgs e)
{
if (settingsChanged)
{
SaveSettings();
}
Close();
}
19
View Source File : ExportOptions.cs
License : MIT License
Project Creator : 91Act
License : MIT License
Project Creator : 91Act
private void fbxOKbutton_Click(object sender, EventArgs e)
{
Properties.Settings.Default["exportNormals"] = exportNormals.Checked;
Properties.Settings.Default["exportTangents"] = exportTangents.Checked;
Properties.Settings.Default["exportUVs"] = exportUVs.Checked;
Properties.Settings.Default["exportColors"] = exportColors.Checked;
Properties.Settings.Default["exportDeformers"] = exportDeformers.Checked;
Properties.Settings.Default["scaleFactor"] = scaleFactor.Value;
Properties.Settings.Default["upAxis"] = upAxis.SelectedIndex;
Properties.Settings.Default["convertTexture"] = converttexture.Checked;
Properties.Settings.Default["convertfsb"] = convertfsb.Checked;
foreach (Control c in panel1.Controls)
{
if (((RadioButton)c).Checked)
{
Properties.Settings.Default["convertType"] = c.Text;
break;
}
}
Properties.Settings.Default.Save();
DialogResult = DialogResult.OK;
Close();
}
19
View Source File : ExportOptions.cs
License : MIT License
Project Creator : 91Act
License : MIT License
Project Creator : 91Act
private void fbxCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
19
View Source File : FrmAbout.cs
License : GNU General Public License v3.0
Project Creator : 9vult
License : GNU General Public License v3.0
Project Creator : 9vult
private void OkButton_Click(object sender, EventArgs e)
{
this.Close();
}
19
View Source File : FrmChapterSelect.cs
License : GNU General Public License v3.0
Project Creator : 9vult
License : GNU General Public License v3.0
Project Creator : 9vult
private void BtnDone_Click(object sender, EventArgs e)
{
DialogResult result = MessageBox.Show("Altering chapter downloads will disable the Update Chapters feature for this replacedle.\n" +
"If you wish to revert this decision in the future, use the Default button.\n\n" +
"Proceed?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);
if (result == DialogResult.Yes)
{
List<string> selected = new List<string>();
foreach (object item in lstChapters.CheckedItems)
{
selected.Add(item.ToString());
}
ReturnValue = selected.ToArray();
this.DialogResult = DialogResult.OK;
this.Close();
}
}
19
View Source File : FrmChapterSelect.cs
License : GNU General Public License v3.0
Project Creator : 9vult
License : GNU General Public License v3.0
Project Creator : 9vult
private void BtnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Close();
}
19
View Source File : FrmChapterSelect.cs
License : GNU General Public License v3.0
Project Creator : 9vult
License : GNU General Public License v3.0
Project Creator : 9vult
private void BtnResetToDefault_Click(object sender, EventArgs e)
{
ReturnValue = new string[] { "-1" };
this.DialogResult = DialogResult.OK;
this.Close();
}
19
View Source File : FrmEdit.cs
License : GNU General Public License v3.0
Project Creator : 9vult
License : GNU General Public License v3.0
Project Creator : 9vult
private void BtnSave_Click(object sender, EventArgs e)
{
replacedle.UpdateProperties(txtreplacedle.Text, cmboLang.SelectedItem.ToString(), cmboGroup.SelectedItem.ToString());
userreplacedle = txtreplacedle.Text;
userlang = cmboLang.SelectedItem.ToString();
usergroup = cmboGroup.SelectedItem.ToString();
if (replacedle is Manga m)
{
if (m.GetDLChapters() == null)
{
m.UpdateDLChapters(new string[] { "-1" });
}
}
else
if (notFirstTime)
MessageBox.Show("Changes saved! Refresh to view.");
this.Close();
}
19
View Source File : FrmEdit.cs
License : GNU General Public License v3.0
Project Creator : 9vult
License : GNU General Public License v3.0
Project Creator : 9vult
private void BtnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
19
View Source File : FrmMangaSettings.cs
License : GNU General Public License v3.0
Project Creator : 9vult
License : GNU General Public License v3.0
Project Creator : 9vult
private void FrmMangaSettings_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
this.Close();
}
}
19
View Source File : FrmHentaiSettings.cs
License : GNU General Public License v3.0
Project Creator : 9vult
License : GNU General Public License v3.0
Project Creator : 9vult
private void FrmHentaiSettings_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
this.Close();
}
}
19
View Source File : FrmUpdate.cs
License : GNU General Public License v3.0
Project Creator : 9vult
License : GNU General Public License v3.0
Project Creator : 9vult
private void BtnContinue_Click(object sender, EventArgs e)
{
if (rbWait.Checked)
{
this.Close();
}
else // Download Update
{
System.Diagnostics.Process.Start(info.Download_url);
Application.Exit();
}
}
19
View Source File : FrmAbout.cs
License : MIT License
Project Creator : a2633063
License : MIT License
Project Creator : a2633063
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
19
View Source File : WindowManager.cs
License : GNU General Public License v3.0
Project Creator : a4004
License : GNU General Public License v3.0
Project Creator : a4004
public static void UnmountWindow(Control.ControlCollection parent, Form window)
{
if (window.InvokeRequired)
{
Program.Debug("windowmgr", $"Request to unmount {window.Name} into {parent.Owner.Name} requires control invokation.");
Program.Debug("windowmgr", "Invoking the request on the UI thread.");
window.Invoke(new Action(() => UnmountWindow(parent, window)));
return;
}
foreach (Form w in parent.OfType<Form>().Where(a => a.Handle == window.Handle))
{
Program.Debug("windowmgr", $"Removing window {window.Name} from {parent.Owner.Name}");
parent.Remove(w);
w.Close();
w.Dispose();
}
}
19
View Source File : config.cs
License : MIT License
Project Creator : aaaddress1
License : MIT License
Project Creator : aaaddress1
private void button1_Click(object sender, EventArgs e)
{
var gwPathInput = this.gwPathTB.Text;
if (!new DirectoryInfo(gwPathInput).Exists)
{
MessageBox.Show(string.Format("MinGW path \"{0}\" not found!", gwPathInput));
return;
}
if (!new FileInfo(Path.Combine(gwPathInput, "gcc.exe")).Exists)
{
MessageBox.Show(string.Format("MinGW compiler \"{0}\" not found!", Path.Combine(gwPathInput, "gcc.exe")));
return;
}
if (!new FileInfo(Path.Combine(gwPathInput, "ld.exe")).Exists)
{
MessageBox.Show(string.Format("MinGW linker \"{0}\" not found!", Path.Combine(gwPathInput, "ld.exe")));
return;
}
int p = 0;
if (!int.TryParse(this.obfusPcntTB.Text, out p))
{
MessageBox.Show(string.Format("Obfuscate % \"{0}\" not found!", this.obfusPcntTB.Text));
return;
}
Properties.Settings.Default.gwPath = this.gwPathTB.Text;
Properties.Settings.Default.linkArg = this.lkArgTB.Text;
Properties.Settings.Default.clArg = this.clArgTB.Text;
Properties.Settings.Default.obfusPcnt = p;
Properties.Settings.Default.cnfseCode = this.cnfOrgJunk.Checked;
Properties.Settings.Default.insrtJunk = this.insrtJunkCB.Checked;
Properties.Settings.Default.clnAftCompile = this.clnComplieCB.Checked;
Properties.Settings.Default.Save();
MessageBox.Show("save config successfully!");
this.Close();
}
19
View Source File : OculusDemoForm.cs
License : MIT License
Project Creator : ab4d
License : MIT License
Project Creator : ab4d
private void RenderScene()
{
if (_dxDevice == null)
return;
if (_oculusRiftVirtualRealityProvider != null && _oculusRiftVirtualRealityProvider.LastSessionStatus.ShouldQuit)
{
_renderForm.Close();
this.Dispose();
return;
}
// Check the state of the controller and update the camera when needed
_xInputCameraController.CheckController(updateTargetCamera: true);
if (_renderForm.ClientSize.Width != _dxScene.Width || _renderForm.ClientSize.Height != _dxScene.Height)
{
// Resize buffers
_dxScene.Resize(_renderForm.ClientSize.Width, _renderForm.ClientSize.Height);
}
// Render the scene with DXEngine.
// We force rendering event if there are no known changes on the scene (no _dxScene.NotifyChange calls).
// To render only when there are any know changes, set forceRenderAll to false
_dxScene.RenderScene(forceRenderAll: true);
UpdatereplacedleFpsMeter();
}
19
View Source File : FormAbnLookup.cs
License : MIT License
Project Creator : ABN-SFLookupTechnicalSupport
License : MIT License
Project Creator : ABN-SFLookupTechnicalSupport
private void buttonExit_Click(object sender, EventArgs e) {
this.Close();
}
19
View Source File : FormMain.cs
License : MIT License
Project Creator : Abneed
License : MIT License
Project Creator : Abneed
private void salirToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
this.Dispose();
}
See More Examples