mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-04 22:21:23 +12:00
fixed #14: Added -autocapture command for be able to start auto capture when ShareX starts
This commit is contained in:
parent
87022f0e1b
commit
a3b333f30b
|
@ -43,7 +43,7 @@ public partial class AutoCaptureForm : Form
|
||||||
private bool waitUploads;
|
private bool waitUploads;
|
||||||
private Stopwatch stopwatch = new Stopwatch();
|
private Stopwatch stopwatch = new Stopwatch();
|
||||||
|
|
||||||
public AutoCaptureForm()
|
private AutoCaptureForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Icon = ShareXResources.Icon;
|
Icon = ShareXResources.Icon;
|
||||||
|
@ -62,11 +62,23 @@ public AutoCaptureForm()
|
||||||
cbWaitUploads.Checked = Program.Settings.AutoCaptureWaitUpload;
|
cbWaitUploads.Checked = Program.Settings.AutoCaptureWaitUpload;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AutoStart()
|
public static void Open()
|
||||||
{
|
{
|
||||||
AutoCaptureForm form = new AutoCaptureForm();
|
if (!IsRunning)
|
||||||
form.Show();
|
{
|
||||||
form.Execute(true);
|
AutoCaptureForm form = new AutoCaptureForm();
|
||||||
|
form.Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Start()
|
||||||
|
{
|
||||||
|
if (!IsRunning)
|
||||||
|
{
|
||||||
|
AutoCaptureForm form = new AutoCaptureForm();
|
||||||
|
form.Show();
|
||||||
|
form.Execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void screenshotTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
private void screenshotTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
||||||
|
@ -143,7 +155,7 @@ private void UpdateStatus()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Execute(bool silent = false)
|
public void Execute()
|
||||||
{
|
{
|
||||||
if (IsRunning)
|
if (IsRunning)
|
||||||
{
|
{
|
||||||
|
@ -160,7 +172,7 @@ public void Execute(bool silent = false)
|
||||||
delay = (int)(Program.Settings.AutoCaptureRepeatTime * 1000);
|
delay = (int)(Program.Settings.AutoCaptureRepeatTime * 1000);
|
||||||
waitUploads = Program.Settings.AutoCaptureWaitUpload;
|
waitUploads = Program.Settings.AutoCaptureWaitUpload;
|
||||||
|
|
||||||
if (Program.Settings.AutoCaptureMinimizeToTray || silent)
|
if (Program.Settings.AutoCaptureMinimizeToTray)
|
||||||
{
|
{
|
||||||
Visible = false;
|
Visible = false;
|
||||||
niTray.Visible = true;
|
niTray.Visible = true;
|
||||||
|
|
|
@ -464,6 +464,10 @@ public void UseCommandLineArgs(string[] args)
|
||||||
{
|
{
|
||||||
UploadManager.ClipboardUpload();
|
UploadManager.ClipboardUpload();
|
||||||
}
|
}
|
||||||
|
else if (args[i].Equals("-autocapture", StringComparison.InvariantCultureIgnoreCase))
|
||||||
|
{
|
||||||
|
AutoCaptureForm.Start();
|
||||||
|
}
|
||||||
else if (args[i][0] != '-')
|
else if (args[i][0] != '-')
|
||||||
{
|
{
|
||||||
UploadManager.UploadFile(args[i]);
|
UploadManager.UploadFile(args[i]);
|
||||||
|
@ -551,11 +555,6 @@ private void DoScreenRecorder(TaskSettings taskSettings = null)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OpenAutoCapture()
|
|
||||||
{
|
|
||||||
new AutoCaptureForm().Show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OpenScreenColorPicker(TaskSettings taskSettings = null)
|
private void OpenScreenColorPicker(TaskSettings taskSettings = null)
|
||||||
{
|
{
|
||||||
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
|
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
|
||||||
|
@ -713,7 +712,7 @@ private void tsmiScreenRecorderGIF_Click(object sender, EventArgs e)
|
||||||
|
|
||||||
private void tsmiAutoCapture_Click(object sender, EventArgs e)
|
private void tsmiAutoCapture_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
OpenAutoCapture();
|
AutoCaptureForm.Open();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tsbApplicationSettings_Click(object sender, EventArgs e)
|
private void tsbApplicationSettings_Click(object sender, EventArgs e)
|
||||||
|
|
|
@ -123,7 +123,7 @@ private void HandleHotkeys(HotkeySettings hotkeySetting)
|
||||||
DoScreenRecorder(taskSettings);
|
DoScreenRecorder(taskSettings);
|
||||||
break;
|
break;
|
||||||
case HotkeyType.AutoCapture:
|
case HotkeyType.AutoCapture:
|
||||||
OpenAutoCapture();
|
AutoCaptureForm.Open();
|
||||||
break;
|
break;
|
||||||
case HotkeyType.ScreenColorPicker:
|
case HotkeyType.ScreenColorPicker:
|
||||||
OpenScreenColorPicker(taskSettings);
|
OpenScreenColorPicker(taskSettings);
|
||||||
|
|
Loading…
Reference in a new issue