-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRunningStatusForm.cs
128 lines (111 loc) · 3.51 KB
/
RunningStatusForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace qaacGUI
{
public partial class RunningStatusForm : Form
{
delegate void SetTextCallback(string commandLine);
public Process process = null;
public RunningStatusForm()
{
InitializeComponent();
}
public void setCommandLine(string commandLine)
{
// InvokeRequired required compares the thread ID of the
// calling thread to the thread ID of the creating thread.
// If these threads are different, it returns true.
if (this.fpsDataTB.InvokeRequired)
{
SetTextCallback d = new SetTextCallback(setCommandLine);
this.Invoke(d, new object[] { commandLine });
}
else
{
this.textBox1.Text = commandLine;
this.textBox1.SelectionStart = this.textBox1.Text.Length;
this.textBox1.ScrollToCaret();
}
}
public void setPercent(string percent)
{
this.progressLabel.Text = percent + "%";
this.progress.Value = (int)Convert.ToDouble(percent);
}
public void setTime(string time)
{
this.currentPostionDataTB.Text = time;
this.currentPostionDataTB.Select(this.currentPostionDataTB.TextLength, 0);
}
public void setFps(string fps)
{
this.fpsDataTB.Text = fps;
}
public void setEta(string eta)
{
this.estETADataTB.Text = eta;
}
public string getTB1()
{
return this.textBox1.Text;
}
private void RunningStatusForm_FormClosed(object sender, FormClosedEventArgs e)
{
if (process != null)
{
process.Close();
}
}
public void setStopBtnState(bool enabled)
{
this.stopBtn.Enabled = enabled;
}
// 点击中止按钮后
private void button1_Click(object sender, EventArgs e)
{
DialogResult dr= MessageBox.Show("确定要中止转换吗?","确认中止", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
if (dr == DialogResult.OK)
{
//点确定的代码
Process[] p = Process.GetProcessesByName("qaac");
int count = p.Length;
for (int i = 0; i < count; i++)
{
p[i].Kill();
}
this.stopBtn.Enabled = false;
string stopWindowTitle = "被用户中止操作";
this.setWindowTitle(stopWindowTitle);
}
else
{
//点取消的代码
}
}
public string getCurrentTimeText()
{
return this.currentPostionDataTB.Text;
}
public string getCommandLine()
{
return this.textBox1.Text;
}
public void setWindowTitle(string title)
{
this.Text = title;
}
public void setStatusBarFilesCountLabel(int finished, int all)
{
string s = finished.ToString() + "/" + all.ToString();
this.filesCountLabel.Text = s;
}
}
}