예제 #1
0
        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;
                }
            }
        }
예제 #3
0
 public AfterCaptureForm(Image img, AfterCaptureTasks afterCaptureTasks)
 {
     InitializeComponent();
     Icon = ShareXResources.Icon;
     AfterCaptureTasks = afterCaptureTasks;
     AddAfterCaptureItems(AfterCaptureTasks);
     pbImage.LoadImage(img);
 }
예제 #4
0
 public AfterCaptureForm(Image img, AfterCaptureTasks afterCaptureTasks)
 {
     InitializeComponent();
     Icon = ShareXResources.Icon;
     AfterCaptureTasks = afterCaptureTasks;
     AddAfterCaptureItems(AfterCaptureTasks);
     pbImage.LoadImage(img);
 }
예제 #5
0
 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;
 }
예제 #7
0
        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);
            }
        }
예제 #8
0
        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);
            }
        }
예제 #9
0
        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);
            }
        }
예제 #10
0
        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);
            }
        }
예제 #11
0
        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);
            }
        }
예제 #12
0
        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;
                }
            }
        }
예제 #13
0
        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);
            }
        }
예제 #14
0
        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);
            }
        }
예제 #15
0
        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);
        }
예제 #16
0
        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);
        }
예제 #17
0
        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);
        }
예제 #18
0
        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);
        }
예제 #19
0
        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);
            }
        }
예제 #20
0
        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;
                }
            }
        }
예제 #21
0
 public QuickTaskInfo(string name, AfterCaptureTasks afterCaptureTasks, AfterUploadTasks afterUploadTasks = AfterUploadTasks.None)
 {
     Name = name;
     AfterCaptureTasks = afterCaptureTasks;
     AfterUploadTasks = afterUploadTasks;
 }
예제 #22
0
 public QuickTaskInfo(AfterCaptureTasks afterCaptureTasks, AfterUploadTasks afterUploadTasks = AfterUploadTasks.None) : this(null, afterCaptureTasks, afterUploadTasks)
 {
 }
예제 #23
0
 public QuickTaskInfo(string name, AfterCaptureTasks afterCaptureTasks, AfterUploadTasks afterUploadTasks = AfterUploadTasks.None)
 {
     Name = name;
     AfterCaptureTasks = afterCaptureTasks;
     AfterUploadTasks  = afterUploadTasks;
 }
예제 #24
0
 public QuickTaskInfo(AfterCaptureTasks afterCaptureTasks, AfterUploadTasks afterUploadTasks = AfterUploadTasks.None)
     : this(null, afterCaptureTasks, afterUploadTasks)
 {
 }