private void AddAfterCaptureItems(AfterCaptureTasks afterCaptureTasks) { AfterCaptureTasks[] ignore = new AfterCaptureTasks[] { AfterCaptureTasks.None, AfterCaptureTasks.ShowQuickTaskMenu, AfterCaptureTasks.ShowAfterCaptureWindow }; int itemHeight = 0; foreach (AfterCaptureTasks task in Helpers.GetEnums <AfterCaptureTasks>()) { if (ignore.Any(x => x == task)) { continue; } ListViewItem lvi = new ListViewItem(task.GetLocalizedDescription()); CheckItem(lvi, afterCaptureTasks.HasFlag(task)); lvi.Tag = task; lvAfterCaptureTasks.Items.Add(lvi); if (itemHeight == 0) { itemHeight = lvi.Bounds.Height; } } int newListViewHeight = lvAfterCaptureTasks.Items.Count * itemHeight; int listViewHeightDifference = newListViewHeight - lvAfterCaptureTasks.Height; if (listViewHeightDifference > 0) { Height += listViewHeightDifference; } }
private void SetDefaultSettings() { if (Program.DefaultTaskSettings != null) { TaskSettings defaultTaskSettings = Program.DefaultTaskSettings.Copy(); if (UseDefaultAfterCaptureJob) { AfterCaptureJob = defaultTaskSettings.AfterCaptureJob; } if (UseDefaultAfterUploadJob) { AfterUploadJob = defaultTaskSettings.AfterUploadJob; } if (UseDefaultDestinations) { ImageDestination = defaultTaskSettings.ImageDestination; TextDestination = defaultTaskSettings.TextDestination; FileDestination = defaultTaskSettings.FileDestination; URLShortenerDestination = defaultTaskSettings.URLShortenerDestination; SocialNetworkingServiceDestination = defaultTaskSettings.SocialNetworkingServiceDestination; } if (UseDefaultGeneralSettings) { GeneralSettings = defaultTaskSettings.GeneralSettings; } if (UseDefaultImageSettings) { ImageSettings = defaultTaskSettings.ImageSettings; } if (UseDefaultCaptureSettings) { CaptureSettings = defaultTaskSettings.CaptureSettings; } if (UseDefaultUploadSettings) { UploadSettings = defaultTaskSettings.UploadSettings; } if (UseDefaultActions) { ExternalPrograms = defaultTaskSettings.ExternalPrograms; } if (UseDefaultIndexerSettings) { IndexerSettings = defaultTaskSettings.IndexerSettings; } if (UseDefaultAdvancedSettings) { AdvancedSettings = defaultTaskSettings.AdvancedSettings; } } }
public AfterCaptureForm(Image img, AfterCaptureTasks afterCaptureTasks) { InitializeComponent(); Icon = ShareXResources.Icon; AfterCaptureTasks = afterCaptureTasks; AddAfterCaptureItems(AfterCaptureTasks); pbImage.LoadImage(img); }
public AfterCaptureForm(Image img, AfterCaptureTasks afterCaptureTasks) { InitializeComponent(); Icon = ShareXResources.Icon; AfterCaptureTasks = afterCaptureTasks; AddAfterCaptureItems(AfterCaptureTasks); Image = img; pbImage.LoadImage(Image); Result = AfterCaptureFormResult.Cancel; }
public AfterCaptureForm(Image img, AfterCaptureTasks afterCaptureTasks) { InitializeComponent(); Icon = Resources.ShareX_Icon; AfterCaptureTasks = afterCaptureTasks; AddAfterCaptureItems(AfterCaptureTasks); Image = img; pbImage.LoadImage(Image); Result = AfterCaptureFormResult.Cancel; }
public static void RunImageTask(Image img, AfterCaptureTasks imageJob = AfterCaptureTasks.UploadImageToHost) { if (imageJob != AfterCaptureTasks.None) { TaskSettings taskSettings = TaskSettings.GetDefaultTaskSettings(); taskSettings.UseDefaultAfterCaptureJob = false; taskSettings.AfterCaptureJob = imageJob; RunImageTask(img, taskSettings); } }
private void AddAfterCaptureItems(AfterCaptureTasks afterCaptureTasks) { AfterCaptureTasks[] enums = Helpers.GetEnums<AfterCaptureTasks>(); for (int i = 1; i < enums.Length; i++) { ListViewItem lvi = new ListViewItem(enums[i].GetDescription()); CheckItem(lvi, afterCaptureTasks.HasFlag(1 << (i - 1))); lvi.Tag = enums[i]; lvAfterCaptureTasks.Items.Add(lvi); } }
private void AddAfterCaptureItems(AfterCaptureTasks afterCaptureTasks) { AfterCaptureTasks[] enums = Helpers.GetEnums <AfterCaptureTasks>(); for (int i = 1; i < enums.Length; i++) { ListViewItem lvi = new ListViewItem(enums[i].GetLocalizedDescription()); CheckItem(lvi, afterCaptureTasks.HasFlag(1 << (i - 1))); lvi.Tag = enums[i]; lvAfterCaptureTasks.Items.Add(lvi); } }
private void AddAfterCaptureItems(AfterCaptureTasks afterCaptureTasks) { AfterCaptureTasks[] enums = (AfterCaptureTasks[])Enum.GetValues(typeof(AfterCaptureTasks)); for (int i = 1; i < enums.Length; i++) { ListViewItem lvi = new ListViewItem(enums[i].GetDescription()); lvi.Checked = afterCaptureTasks.HasFlag(1 << (i - 1)); lvi.Tag = enums[i]; lvAfterCaptureTasks.Items.Add(lvi); } }
private void AddAfterCaptureItems(AfterCaptureTasks afterCaptureTasks) { AfterCaptureTasks[] enums = (AfterCaptureTasks[])Enum.GetValues(typeof(AfterCaptureTasks)); for (int i = 1; i < enums.Length; i++) { ListViewItem lvi = new ListViewItem(enums[i].GetDescription()); CheckItem(lvi, afterCaptureTasks.HasFlag(1 << (i - 1))); lvi.Tag = enums[i]; lvAfterCaptureTasks.Items.Add(lvi); } }
private void SetDefaultSettings() { if (Program.DefaultTaskSettings != null) { TaskSettings defaultTaskSettings = Program.DefaultTaskSettings.Copy(); if (UseDefaultAfterCaptureJob) { AfterCaptureJob = defaultTaskSettings.AfterCaptureJob; } if (UseDefaultAfterUploadJob) { AfterUploadJob = defaultTaskSettings.AfterUploadJob; } if (UseDefaultDestinations) { } if (UseDefaultGeneralSettings) { GeneralSettings = defaultTaskSettings.GeneralSettings; } if (UseDefaultImageSettings) { ImageSettings = defaultTaskSettings.ImageSettings; } if (UseDefaultCaptureSettings) { CaptureSettings = defaultTaskSettings.CaptureSettings; } if (UseDefaultActions) { ExternalPrograms = defaultTaskSettings.ExternalPrograms; } if (UseDefaultToolsSettings) { ToolsSettings = defaultTaskSettings.ToolsSettings; } if (UseDefaultAdvancedSettings) { AdvancedSettings = defaultTaskSettings.AdvancedSettings; } } }
private void AddAfterCaptureItems(AfterCaptureTasks afterCaptureTasks) { AfterCaptureTasks[] ignore = new AfterCaptureTasks[] { AfterCaptureTasks.None, AfterCaptureTasks.ShowAfterCaptureWindow }; foreach (AfterCaptureTasks task in Helpers.GetEnums<AfterCaptureTasks>()) { if (ignore.Any(x => x == task)) continue; ListViewItem lvi = new ListViewItem(task.GetLocalizedDescription()); CheckItem(lvi, afterCaptureTasks.HasFlag(task)); lvi.Tag = task; lvAfterCaptureTasks.Items.Add(lvi); } }
private void AddAfterCaptureItems(AfterCaptureTasks afterCaptureTasks) { AfterCaptureTasks[] ignore = new AfterCaptureTasks[] { AfterCaptureTasks.None, AfterCaptureTasks.ShowQuickTaskMenu, AfterCaptureTasks.ShowAfterCaptureWindow }; foreach (AfterCaptureTasks task in Helpers.GetEnums<AfterCaptureTasks>()) { if (ignore.Any(x => x == task)) continue; ListViewItem lvi = new ListViewItem(task.GetLocalizedDescription()); CheckItem(lvi, afterCaptureTasks.HasFlag(task)); lvi.Tag = task; lvAfterCaptureTasks.Items.Add(lvi); } }
public AfterCaptureForm(Image img, AfterCaptureTasks afterCaptureTasks) { InitializeComponent(); Icon = ShareXResources.Icon; ImageList imageList = new ImageList { ColorDepth = ColorDepth.Depth32Bit }; imageList.Images.Add(Resources.checkbox_uncheck); imageList.Images.Add(Resources.checkbox_check); lvAfterCaptureTasks.SmallImageList = imageList; AfterCaptureTasks = afterCaptureTasks; AddAfterCaptureItems(AfterCaptureTasks); pbImage.LoadImage(img); }
private AfterCaptureTasks GetAfterCaptureTasks() { AfterCaptureTasks afterCaptureTasks = AfterCaptureTasks.None; for (int i = 0; i < lvAfterCaptureTasks.Items.Count; i++) { ListViewItem lvi = lvAfterCaptureTasks.Items[i]; if (IsChecked(lvi)) { afterCaptureTasks = afterCaptureTasks.Add((AfterCaptureTasks)(1 << i)); } } return(afterCaptureTasks); }
public override string ToString() { if (!string.IsNullOrEmpty(Name)) { return(Name); } string result = string.Join(", ", AfterCaptureTasks.GetFlags().Select(x => x.GetLocalizedDescription())); if (AfterCaptureTasks.HasFlag(AfterCaptureTasks.UploadImageToHost)) { string[] flags = AfterUploadTasks.GetFlags().Select(x => x.GetLocalizedDescription()).ToArray(); if (flags != null && flags.Length > 0) { result += ", " + string.Join(", ", flags); } } return(result); }
private void SetDefaultSettings() { if (Program.DefaultTaskSettings != null) { TaskSettings defaultTaskSettings = Program.DefaultTaskSettings.Copy(); if (UseDefaultAfterCaptureJob) { AfterCaptureJob = defaultTaskSettings.AfterCaptureJob; } if (UseDefaultAfterUploadJob) { AfterUploadJob = defaultTaskSettings.AfterUploadJob; } if (UseDefaultDestinations) { ImageDestination = defaultTaskSettings.ImageDestination; ImageFileDestination = defaultTaskSettings.ImageFileDestination; TextDestination = defaultTaskSettings.TextDestination; TextFileDestination = defaultTaskSettings.TextFileDestination; FileDestination = defaultTaskSettings.FileDestination; URLShortenerDestination = defaultTaskSettings.URLShortenerDestination; URLSharingServiceDestination = defaultTaskSettings.URLSharingServiceDestination; } if (UseDefaultGeneralSettings) { GeneralSettings = defaultTaskSettings.GeneralSettings; } if (UseDefaultImageSettings) { ImageSettings = defaultTaskSettings.ImageSettings; } if (UseDefaultCaptureSettings) { CaptureSettings = defaultTaskSettings.CaptureSettings; } if (UseDefaultUploadSettings) { UploadSettings = defaultTaskSettings.UploadSettings; } if (UseDefaultActions) { ExternalPrograms = defaultTaskSettings.ExternalPrograms; } if (UseDefaultToolsSettings) { ToolsSettings = defaultTaskSettings.ToolsSettings; } if (UseDefaultAdvancedSettings) { AdvancedSettings = defaultTaskSettings.AdvancedSettings; } } }
public QuickTaskInfo(string name, AfterCaptureTasks afterCaptureTasks, AfterUploadTasks afterUploadTasks = AfterUploadTasks.None) { Name = name; AfterCaptureTasks = afterCaptureTasks; AfterUploadTasks = afterUploadTasks; }
public QuickTaskInfo(AfterCaptureTasks afterCaptureTasks, AfterUploadTasks afterUploadTasks = AfterUploadTasks.None) : this(null, afterCaptureTasks, afterUploadTasks) { }