123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- using OpenCvSharp;
- using PaintDotNet.CustomControl;
- using System;
- using System.Collections.Generic;
- using System.Windows.Forms;
- namespace PaintDotNet.Instrument
- {
- /// <summary>
- /// 工具-正在执行的脚本
- /// </summary>
- internal class ScriptStartRecordingDialog : FloatingToolForm
- {
- private AppWorkspace appWorkspace;
- private Button button1;
- private Label label2;
- private Label label1;
- private string scriptName;
- private void InitializeComponent()
- {
- this.button1 = new System.Windows.Forms.Button();
- this.label1 = new System.Windows.Forms.Label();
- this.label2 = new System.Windows.Forms.Label();
- this.SuspendLayout();
- //
- // button1
- //
- this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.button1.Location = new System.Drawing.Point(238, 41);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(75, 23);
- this.button1.TabIndex = 7;
- this.button1.Text = "结束录制";
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.Location = new System.Drawing.Point(11, 9);
- this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.label1.MaximumSize = new System.Drawing.Size(320, 0);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(65, 12);
- this.label1.TabIndex = 9;
- this.label1.Text = "正在录制中";
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(80, 9);
- this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
- this.label2.MaximumSize = new System.Drawing.Size(240, 0);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(17, 12);
- this.label2.TabIndex = 10;
- this.label2.Text = " ";
- //
- // ScriptStartRecordingDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(325, 76);
- this.Controls.Add(this.label2);
- this.Controls.Add(this.label1);
- this.Controls.Add(this.button1);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.Margin = new System.Windows.Forms.Padding(6);
- this.Name = "ScriptStartRecordingDialog";
- this.Text = "录制脚本";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ScriptRunningDialog_FormClosing);
- this.VisibleChanged += new System.EventHandler(this.ScriptRunningDialog_VisibleChanged);
- this.Controls.SetChildIndex(this.button1, 0);
- this.Controls.SetChildIndex(this.label1, 0);
- this.Controls.SetChildIndex(this.label2, 0);
- this.ResumeLayout(false);
- this.PerformLayout();
- }
-
- public ScriptStartRecordingDialog(AppWorkspace appWorkspace, string scriptName)
- {
- this.appWorkspace = appWorkspace;
- InitializeComponent();
- this.scriptName = scriptName;
- //this.button1.Text = PdnResources.GetString("Menu.Nextstep.text");
- //this.label1.Text = PdnResources.GetString("Menu.Currentsteps.Text") + ":";
- //this.Text = PdnResources.GetString("Menu.Executecript.Text");
- //this.label2.Text = "" + (scriptName != null ? scriptName : "");
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void button1_Click(object sender, EventArgs e)
- {
- foreach (var item in appWorkspace.addMicScriptStepList) {
- appWorkspace.micScriptStepList.Add(item);
- if (appWorkspace.micScriptStepParamList.ContainsKey(item))
- {
- if (appWorkspace.addMicScriptStepParamList.ContainsKey(item)) {
- appWorkspace.micScriptStepParamList[item] = appWorkspace.addMicScriptStepParamList[item];
- }
- }
- else {
- if (appWorkspace.addMicScriptStepParamList.ContainsKey(item))
- {
- appWorkspace.micScriptStepParamList.Add(item, appWorkspace.addMicScriptStepParamList[item]);
- }
- }
- }
- appWorkspace.addMicScriptStepList.Clear();
- appWorkspace.addMicScriptStepParamList.Clear();
- closeMethod();
- }
- protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
- {
- DialogResult dr = MessageBox.Show("您确定要停止录制脚本吗" + "?", PdnResources.GetString("Menu.hint.text"), MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr == DialogResult.OK)
- {
- appWorkspace.addMicScriptStepList.Clear();
- appWorkspace.addMicScriptStepParamList.Clear();
- closeMethod();
- }
- }
- private void ScriptRunningDialog_FormClosing(object sender, FormClosingEventArgs e)
- {
- }
- private void ScriptRunningDialog_VisibleChanged(object sender, EventArgs e)
- {
- if (!appWorkspace.ScriptRunning && !appWorkspace.ScriptStopping)
- {
- }
- else
- {
- }
- }
- /// <summary>
- /// 关闭触发事件
- /// </summary>
- private void closeMethod()
- {
- this.Visible = false;
- appWorkspace.ScriptDialog.Enabled = true;
- appWorkspace.startScriptRecording = false;
- ScriptEditDialog scriptEditDialog = new ScriptEditDialog(appWorkspace, this.appWorkspace.editScriptRecording, this.appWorkspace.ScriptRecordingModel, scriptName);
- scriptEditDialog.StartPosition = FormStartPosition.CenterScreen;
- scriptEditDialog.ShowDialog();
- }
- }
- }
|