mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13: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
3 changed files with 25 additions and 14 deletions
|
@ -43,7 +43,7 @@ public partial class AutoCaptureForm : Form
|
|||
private bool waitUploads;
|
||||
private Stopwatch stopwatch = new Stopwatch();
|
||||
|
||||
public AutoCaptureForm()
|
||||
private AutoCaptureForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
Icon = ShareXResources.Icon;
|
||||
|
@ -62,11 +62,23 @@ public AutoCaptureForm()
|
|||
cbWaitUploads.Checked = Program.Settings.AutoCaptureWaitUpload;
|
||||
}
|
||||
|
||||
public static void AutoStart()
|
||||
public static void Open()
|
||||
{
|
||||
AutoCaptureForm form = new AutoCaptureForm();
|
||||
form.Show();
|
||||
form.Execute(true);
|
||||
if (!IsRunning)
|
||||
{
|
||||
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)
|
||||
|
@ -143,7 +155,7 @@ private void UpdateStatus()
|
|||
}
|
||||
}
|
||||
|
||||
public void Execute(bool silent = false)
|
||||
public void Execute()
|
||||
{
|
||||
if (IsRunning)
|
||||
{
|
||||
|
@ -160,7 +172,7 @@ public void Execute(bool silent = false)
|
|||
delay = (int)(Program.Settings.AutoCaptureRepeatTime * 1000);
|
||||
waitUploads = Program.Settings.AutoCaptureWaitUpload;
|
||||
|
||||
if (Program.Settings.AutoCaptureMinimizeToTray || silent)
|
||||
if (Program.Settings.AutoCaptureMinimizeToTray)
|
||||
{
|
||||
Visible = false;
|
||||
niTray.Visible = true;
|
||||
|
|
|
@ -464,6 +464,10 @@ public void UseCommandLineArgs(string[] args)
|
|||
{
|
||||
UploadManager.ClipboardUpload();
|
||||
}
|
||||
else if (args[i].Equals("-autocapture", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
AutoCaptureForm.Start();
|
||||
}
|
||||
else if (args[i][0] != '-')
|
||||
{
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
OpenAutoCapture();
|
||||
AutoCaptureForm.Open();
|
||||
}
|
||||
|
||||
private void tsbApplicationSettings_Click(object sender, EventArgs e)
|
||||
|
|
|
@ -123,7 +123,7 @@ private void HandleHotkeys(HotkeySettings hotkeySetting)
|
|||
DoScreenRecorder(taskSettings);
|
||||
break;
|
||||
case HotkeyType.AutoCapture:
|
||||
OpenAutoCapture();
|
||||
AutoCaptureForm.Open();
|
||||
break;
|
||||
case HotkeyType.ScreenColorPicker:
|
||||
OpenScreenColorPicker(taskSettings);
|
||||
|
|
Loading…
Reference in a new issue