Commit 6de5be6f by Neo Turing

优化

parent 88b558be
...@@ -456,6 +456,7 @@ ...@@ -456,6 +456,7 @@
this.Name = "CanonForm"; this.Name = "CanonForm";
this.Text = "Canon"; this.Text = "Canon";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CanonForm_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CanonForm_FormClosing);
this.Load += new System.EventHandler(this.CanonForm_Load);
this.SaveToGroupBox.ResumeLayout(false); this.SaveToGroupBox.ResumeLayout(false);
this.SaveToGroupBox.PerformLayout(); this.SaveToGroupBox.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.BulbUpDo)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.BulbUpDo)).EndInit();
......
...@@ -7,6 +7,7 @@ using System.Drawing; ...@@ -7,6 +7,7 @@ using System.Drawing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
...@@ -59,6 +60,7 @@ namespace Kivii.Canon ...@@ -59,6 +60,7 @@ namespace Kivii.Canon
try try
{ {
IsInit = false; IsInit = false;
MainCamera.CloseSession();
MainCamera?.Dispose(); MainCamera?.Dispose();
APIHandler?.Dispose(); APIHandler?.Dispose();
} }
...@@ -116,8 +118,11 @@ namespace Kivii.Canon ...@@ -116,8 +118,11 @@ namespace Kivii.Canon
var task = Task.Run(async delegate var task = Task.Run(async delegate
{ {
var filePath = $"{dir}\\{Info.FileName}"; var filePath = $"{dir}\\{Info.FileName}";
await Task.Delay(1500); await Task.Delay(500);
if (!File.Exists(filePath)) return; if (!File.Exists(filePath))
{
return;
}
if (DownloadCompletely != null) if (DownloadCompletely != null)
{ {
DownloadCompletely(filePath, EventArgs.Empty); DownloadCompletely(filePath, EventArgs.Empty);
...@@ -164,7 +169,7 @@ namespace Kivii.Canon ...@@ -164,7 +169,7 @@ namespace Kivii.Canon
try try
{ {
if ((string)TvCoBox.SelectedItem == "Bulb") MainCamera.TakePhotoBulb((int)BulbUpDo.Value); if ((string)TvCoBox.SelectedItem == "Bulb") MainCamera.TakePhotoBulb((int)BulbUpDo.Value);
else MainCamera.TakePhotoShutter(); else MainCamera.TakePhotoShutterAsync();
//if ((string)TvCoBox.SelectedItem == "Bulb") MainCamera.TakePhotoBulbAsync((int)BulbUpDo.Value); //if ((string)TvCoBox.SelectedItem == "Bulb") MainCamera.TakePhotoBulbAsync((int)BulbUpDo.Value);
//else MainCamera.TakePhotoShutterAsync(); //else MainCamera.TakePhotoShutterAsync();
} }
...@@ -349,6 +354,20 @@ namespace Kivii.Canon ...@@ -349,6 +354,20 @@ namespace Kivii.Canon
LiveViewButton.Text = "Start LV"; LiveViewButton.Text = "Start LV";
} }
private void CanonForm_Load(object sender, EventArgs e)
{
if (CameraListBox.SelectedIndex >= 0)
{
SessionButton_Click(null, null);
Thread.Sleep(1000);
if (MainCamera?.SessionOpen == true&& MainCamera?.IsLiveViewOn==false)
{
LiveViewButton_Click(null, null);
}
}
}
private void RefreshCamera() private void RefreshCamera()
{ {
CameraListBox.Items.Clear(); CameraListBox.Items.Clear();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment