當前位置: 首頁>>代碼示例>>C#>>正文


C# ShareX.TaskSettings類代碼示例

本文整理匯總了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);
 }
開發者ID:barsv,項目名稱:ShareX,代碼行數:7,代碼來源:HotkeySettings.cs

示例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;
            }
        }
開發者ID:L1Q,項目名稱:ShareX,代碼行數:26,代碼來源:CaptureTaskHelpers.cs

示例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);
                }
            }
        }
開發者ID:Z1ni,項目名稱:ShareX,代碼行數:34,代碼來源:UploadManager.cs

示例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;
                }
            }
        }
開發者ID:TreeSeed,項目名稱:ShareX,代碼行數:25,代碼來源:ScreenColorPicker.cs

示例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;
        }
開發者ID:jasonlamb,項目名稱:ShareX,代碼行數:27,代碼來源:TaskHelpers.cs

示例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);
        }
開發者ID:harley1011,項目名稱:ShareX,代碼行數:34,代碼來源:CaptureActiveWindow.cs

示例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;
        }
開發者ID:dmitriydel,項目名稱:sharexmod,代碼行數:31,代碼來源:TaskHelper.cs

示例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;
            }
        }
開發者ID:jakesyl,項目名稱:ShareX,代碼行數:30,代碼來源:MainForm_Capture.cs

示例9: SelectRegion

 private void SelectRegion(TaskSettings taskSettings)
 {
     Rectangle rect;
     if (TaskHelper.SelectRegion(taskSettings, out rect) && !rect.IsEmpty)
     {
         CaptureRectangle = Helpers.EvenRectangleSize(rect);
     }
 }
開發者ID:dmitriydel,項目名稱:sharexmod,代碼行數:8,代碼來源:ScreenRecordForm.cs

示例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 };
 }
開發者ID:dmitriydel,項目名稱:sharexmod,代碼行數:8,代碼來源:HotkeySettings.cs

示例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;
 }
開發者ID:dmitriydel,項目名稱:sharexmod,代碼行數:9,代碼來源:UploadTask.cs

示例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);
                }
            }
        }
開發者ID:sides,項目名稱:sharexl,代碼行數:56,代碼來源:UploadManager.cs

示例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);
        }
開發者ID:harley1011,項目名稱:ShareX,代碼行數:10,代碼來源:CaptureCustomRegion.cs

示例14: AfterCaptureForm

        public AfterCaptureForm(string filePath, TaskSettings taskSettings) : this(taskSettings)
        {
            if (Helpers.IsImageFile(filePath))
            {
                pbImage.LoadImageFromFileAsync(filePath);
            }

            FileName = Path.GetFileNameWithoutExtension(filePath);
            txtFileName.Text = FileName;
        }
開發者ID:L1Q,項目名稱:ShareX,代碼行數:10,代碼來源:AfterCaptureForm.cs

示例15: TaskInfo

        public TaskInfo(TaskSettings taskSettings)
        {
            if (taskSettings == null)
            {
                taskSettings = TaskSettings.GetDefaultTaskSettings();
            }

            TaskSettings = taskSettings;
            Result = new UploadResult();
        }
開發者ID:noscripter,項目名稱:ShareX,代碼行數:10,代碼來源:TaskInfo.cs


注:本文中的ShareX.TaskSettings類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。