本文整理匯總了C#中ShareX.TaskSettings類的典型用法代碼示例。如果您正苦於以下問題:C# TaskSettings類的具體用法?C# TaskSettings怎麽用?C# TaskSettings使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TaskSettings類屬於ShareX命名空間,在下文中一共展示了TaskSettings類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: HotkeySettings
public HotkeySettings(HotkeyType job, Keys hotkey = Keys.None)
: this()
{
TaskSettings = TaskSettings.GetDefaultTaskSettings();
TaskSettings.Job = job;
HotkeyInfo = new HotkeyInfo(hotkey);
}
示例2: CaptureScreenshot
public static void CaptureScreenshot(CaptureType captureType, TaskSettings taskSettings = null, bool autoHideForm = true)
{
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
switch (captureType)
{
case CaptureType.Fullscreen:
DoCapture(TaskHelpers.GetScreenshot(taskSettings).CaptureFullscreen, CaptureType.Fullscreen, taskSettings, autoHideForm);
break;
case CaptureType.ActiveWindow:
CaptureActiveWindow(taskSettings, autoHideForm);
break;
case CaptureType.ActiveMonitor:
DoCapture(TaskHelpers.GetScreenshot(taskSettings).CaptureActiveMonitor, CaptureType.ActiveMonitor, taskSettings, autoHideForm);
break;
case CaptureType.Region:
CaptureRegion(taskSettings, autoHideForm);
break;
case CaptureType.CustomRegion:
CaptureCustomRegion(taskSettings, autoHideForm);
break;
case CaptureType.LastRegion:
CaptureLastRegion(taskSettings, autoHideForm);
break;
}
}
示例3: ClipboardUpload
public static void ClipboardUpload(TaskSettings taskSettings = null)
{
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
if (Clipboard.ContainsImage())
{
Image img = Clipboard.GetImage();
if (!taskSettings.AdvancedSettings.ProcessImagesDuringClipboardUpload)
{
taskSettings.AfterCaptureJob = AfterCaptureTasks.UploadImageToHost;
}
RunImageTask(img, taskSettings);
}
else if (Clipboard.ContainsFileDropList())
{
string[] files = Clipboard.GetFileDropList().Cast<string>().ToArray();
UploadFile(files, taskSettings);
}
else if (Clipboard.ContainsText())
{
string text = Clipboard.GetText();
if (taskSettings.UploadSettings.ClipboardUploadAutoDetectURL && Helpers.IsValidURLRegex(text))
{
ShortenURL(text.Trim(), taskSettings);
}
else
{
UploadText(text, taskSettings);
}
}
}
示例4: ScreenColorPicker
public ScreenColorPicker(TaskSettings taskSettings)
{
if (taskSettings != null)
{
surfaceOptions = taskSettings.CaptureSettings.SurfaceOptions;
}
else
{
surfaceOptions = new SurfaceOptions();
}
InitializeComponent();
colorPicker.DrawCrosshair = true;
colorTimer.Tick += colorTimer_Tick;
UpdateControls(true);
foreach (Control control in Controls)
{
if (control is NumericUpDown || control is TextBox)
{
control.DoubleClick += CopyToClipboard;
}
}
}
示例5: PrepareImage
public static ImageData PrepareImage(Image img, TaskSettings taskSettings)
{
ImageData imageData = new ImageData();
imageData.ImageFormat = taskSettings.ImageSettings.ImageFormat;
if (taskSettings.ImageSettings.ImageFormat == EImageFormat.JPEG)
{
img = ImageHelpers.FillBackground(img, Color.White);
}
imageData.ImageStream = SaveImage(img, taskSettings.ImageSettings.ImageFormat, taskSettings);
int sizeLimit = taskSettings.ImageSettings.ImageSizeLimit * 1000;
if (taskSettings.ImageSettings.ImageFormat != taskSettings.ImageSettings.ImageFormat2 && sizeLimit > 0 && imageData.ImageStream.Length > sizeLimit)
{
if (taskSettings.ImageSettings.ImageFormat2 == EImageFormat.JPEG)
{
img = ImageHelpers.FillBackground(img, Color.White);
}
imageData.ImageStream = SaveImage(img, taskSettings.ImageSettings.ImageFormat2, taskSettings);
imageData.ImageFormat = taskSettings.ImageSettings.ImageFormat2;
}
return imageData;
}
示例6: Capture
public override void Capture(CaptureType captureType, TaskSettings taskSettings, bool autoHideForm = true)
{
DoCapture(() =>
{
Image img;
string activeWindowTitle = NativeMethods.GetForegroundWindowText();
string activeProcessName = null;
using (Process process = NativeMethods.GetForegroundWindowProcess())
{
if (process != null)
{
activeProcessName = process.ProcessName;
}
}
if (taskSettings.CaptureSettings.CaptureTransparent && !taskSettings.CaptureSettings.CaptureClientArea)
{
img = Screenshot.CaptureActiveWindowTransparent();
}
else
{
img = Screenshot.CaptureActiveWindow();
}
img.Tag = new ImageTag
{
ActiveWindowTitle = activeWindowTitle,
ActiveProcessName = activeProcessName
};
return img;
}, CaptureType.ActiveWindow, taskSettings, autoHideForm);
}
示例7: ResizeImage
private static Image ResizeImage(TaskSettings taskSettings, Image img, ImageScaleType scaleType)
{
float width = 0, height = 0;
switch (scaleType)
{
case ImageScaleType.Percentage:
width = img.Width * (taskSettings.ImageSettings.ImageScalePercentageWidth / 100f);
height = img.Height * (taskSettings.ImageSettings.ImageScalePercentageHeight / 100f);
break;
case ImageScaleType.Width:
width = taskSettings.ImageSettings.ImageScaleToWidth;
height = taskSettings.ImageSettings.ImageKeepAspectRatio ? img.Height * (width / img.Width) : img.Height;
break;
case ImageScaleType.Height:
height = taskSettings.ImageSettings.ImageScaleToHeight;
width = taskSettings.ImageSettings.ImageKeepAspectRatio ? img.Width * (height / img.Height) : img.Width;
break;
case ImageScaleType.Specific:
width = taskSettings.ImageSettings.ImageScaleSpecificWidth;
height = taskSettings.ImageSettings.ImageScaleSpecificHeight;
break;
}
if (width > 0 && height > 0)
{
return CaptureHelpers.ResizeImage(img, (int)width, (int)height, taskSettings.ImageSettings.ImageUseSmoothScaling);
}
return img;
}
示例8: CaptureScreenshot
public void CaptureScreenshot(CaptureType captureType, TaskSettings taskSettings = null, bool autoHideForm = true)
{
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
switch (captureType)
{
case CaptureType.Screen:
DoCapture(Screenshot.CaptureFullscreen, CaptureType.Screen, taskSettings, autoHideForm);
break;
case CaptureType.ActiveWindow:
CaptureActiveWindow(taskSettings, autoHideForm);
break;
case CaptureType.ActiveMonitor:
DoCapture(Screenshot.CaptureActiveMonitor, CaptureType.ActiveMonitor, taskSettings, autoHideForm);
break;
case CaptureType.Rectangle:
case CaptureType.RectangleWindow:
case CaptureType.RoundedRectangle:
case CaptureType.Ellipse:
case CaptureType.Triangle:
case CaptureType.Diamond:
case CaptureType.Polygon:
case CaptureType.Freehand:
CaptureRegion(captureType, taskSettings, autoHideForm);
break;
case CaptureType.LastRegion:
CaptureLastRegion(taskSettings, autoHideForm);
break;
}
}
示例9: SelectRegion
private void SelectRegion(TaskSettings taskSettings)
{
Rectangle rect;
if (TaskHelper.SelectRegion(taskSettings, out rect) && !rect.IsEmpty)
{
CaptureRectangle = Helpers.EvenRectangleSize(rect);
}
}
示例10: HotkeySettings
public HotkeySettings(HotkeyType job, Keys hotkey = Keys.None)
: this()
{
TaskSettings = TaskSettings.GetDefaultTaskSettings();
TaskSettings.Job = job;
TaskSettings.Description = job.GetDescription();
HotkeyInfo = new HotkeyInfo { Hotkey = hotkey };
}
示例11: CreateDataUploaderTask
public static UploadTask CreateDataUploaderTask(EDataType dataType, Stream stream, string fileName, TaskSettings taskSettings)
{
UploadTask task = new UploadTask(taskSettings);
task.Info.Job = TaskJob.DataUpload;
task.Info.DataType = dataType;
task.Info.FileName = fileName;
task.Data = stream;
return task;
}
示例12: ClipboardUpload
public static void ClipboardUpload(TaskSettings taskSettings = null)
{
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
if (Clipboard.ContainsImage())
{
Image img = Clipboard.GetImage();
if (img != null)
{
if (!taskSettings.AdvancedSettings.ProcessImagesDuringClipboardUpload)
{
taskSettings.AfterCaptureJob = AfterCaptureTasks.UploadImageToHost;
}
RunImageTask(img, taskSettings);
}
}
else if (Clipboard.ContainsFileDropList())
{
string[] files = Clipboard.GetFileDropList().Cast<string>().ToArray();
UploadFile(files, taskSettings);
}
else if (Clipboard.ContainsText())
{
string text = Clipboard.GetText();
if (!string.IsNullOrEmpty(text))
{
string url = text.Trim();
if (URLHelpers.IsValidURLRegex(url))
{
if (taskSettings.UploadSettings.ClipboardUploadURLContents)
{
DownloadAndUploadFile(url, taskSettings);
return;
}
if (taskSettings.UploadSettings.ClipboardUploadShortenURL)
{
ShortenURL(url, taskSettings);
return;
}
if (taskSettings.UploadSettings.ClipboardUploadShareURL)
{
ShareURL(url, taskSettings);
return;
}
}
UploadText(text, taskSettings, true);
}
}
}
示例13: Capture
public override void Capture(CaptureType captureType, TaskSettings taskSettings, bool autoHideForm = true)
{
DoCapture(() =>
{
Rectangle regionBounds = taskSettings.CaptureSettings.CaptureCustomRegion;
Image img = Screenshot.CaptureRectangle(regionBounds);
return img;
}, CaptureType.CustomRegion, taskSettings, autoHideForm);
}
示例14: AfterCaptureForm
public AfterCaptureForm(string filePath, TaskSettings taskSettings) : this(taskSettings)
{
if (Helpers.IsImageFile(filePath))
{
pbImage.LoadImageFromFileAsync(filePath);
}
FileName = Path.GetFileNameWithoutExtension(filePath);
txtFileName.Text = FileName;
}
示例15: TaskInfo
public TaskInfo(TaskSettings taskSettings)
{
if (taskSettings == null)
{
taskSettings = TaskSettings.GetDefaultTaskSettings();
}
TaskSettings = taskSettings;
Result = new UploadResult();
}