Commit 6de5be6f by Neo Turing

优化

parent 88b558be
......@@ -456,6 +456,7 @@
this.Name = "CanonForm";
this.Text = "Canon";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CanonForm_FormClosing);
this.Load += new System.EventHandler(this.CanonForm_Load);
this.SaveToGroupBox.ResumeLayout(false);
this.SaveToGroupBox.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.BulbUpDo)).EndInit();
......
......@@ -7,6 +7,7 @@ using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
......@@ -59,6 +60,7 @@ namespace Kivii.Canon
try
{
IsInit = false;
MainCamera.CloseSession();
MainCamera?.Dispose();
APIHandler?.Dispose();
}
......@@ -116,8 +118,11 @@ namespace Kivii.Canon
var task = Task.Run(async delegate
{
var filePath = $"{dir}\\{Info.FileName}";
await Task.Delay(1500);
if (!File.Exists(filePath)) return;
await Task.Delay(500);
if (!File.Exists(filePath))
{
return;
}
if (DownloadCompletely != null)
{
DownloadCompletely(filePath, EventArgs.Empty);
......@@ -164,7 +169,7 @@ namespace Kivii.Canon
try
{
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);
//else MainCamera.TakePhotoShutterAsync();
}
......@@ -349,6 +354,20 @@ namespace Kivii.Canon
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()
{
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