Exemple #1
0
 public void EditImage()
 {
     if (IsItemSelected && SelectedItem.IsImageFile)
     {
         TaskHelpers.AnnotateImageFromFile(SelectedItem.Info.FilePath);
     }
 }
Exemple #2
0
        private void ExecuteAction(ToastClickAction action)
        {
            switch (action)
            {
            case ToastClickAction.AnnotateImage:
                if (!string.IsNullOrEmpty(Config.FilePath) && Helpers.IsImageFile(Config.FilePath))
                {
                    TaskHelpers.AnnotateImageFromFile(Config.FilePath);
                }
                break;

            case ToastClickAction.CopyImageToClipboard:
                if (!string.IsNullOrEmpty(Config.FilePath))
                {
                    ClipboardHelpers.CopyImageFromFile(Config.FilePath);
                }
                break;

            case ToastClickAction.CopyUrl:
                if (!string.IsNullOrEmpty(Config.URL))
                {
                    ClipboardHelpers.CopyText(Config.URL);
                }
                break;

            case ToastClickAction.OpenFile:
                if (!string.IsNullOrEmpty(Config.FilePath))
                {
                    Helpers.OpenFile(Config.FilePath);
                }
                break;

            case ToastClickAction.OpenFolder:
                if (!string.IsNullOrEmpty(Config.FilePath))
                {
                    Helpers.OpenFolderWithFile(Config.FilePath);
                }
                break;

            case ToastClickAction.OpenUrl:
                if (!string.IsNullOrEmpty(Config.URL))
                {
                    URLHelpers.OpenURL(Config.URL);
                }
                break;

            case ToastClickAction.Upload:
                if (!string.IsNullOrEmpty(Config.FilePath))
                {
                    UploadManager.UploadFile(Config.FilePath);
                }
                break;
            }
        }
        private void ExecuteClickAction(ThumbnailViewClickAction clickAction, TaskInfo info)
        {
            if (info != null)
            {
                string filePath = info.FilePath;

                switch (clickAction)
                {
                case ThumbnailViewClickAction.Default:
                    if (!string.IsNullOrEmpty(filePath) && File.Exists(filePath))
                    {
                        if (Helpers.IsImageFile(filePath))
                        {
                            pbThumbnail.Enabled = false;

                            try
                            {
                                OnImagePreviewRequested();
                            }
                            finally
                            {
                                pbThumbnail.Enabled = true;
                            }
                        }
                        else if (Helpers.IsTextFile(filePath) || Helpers.IsVideoFile(filePath) || MessageBox.Show("Would you like to open this file?" + "\r\n\r\n" + filePath,
                                                                                                                  Resources.ShareXConfirmation, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            Helpers.OpenFile(filePath);
                        }
                    }
                    break;

                case ThumbnailViewClickAction.OpenImageViewer:
                    if (!string.IsNullOrEmpty(filePath) && File.Exists(filePath) && Helpers.IsImageFile(filePath))
                    {
                        pbThumbnail.Enabled = false;

                        try
                        {
                            OnImagePreviewRequested();
                        }
                        finally
                        {
                            pbThumbnail.Enabled = true;
                        }
                    }
                    break;

                case ThumbnailViewClickAction.OpenFile:
                    if (!string.IsNullOrEmpty(filePath))
                    {
                        Helpers.OpenFile(filePath);
                    }
                    break;

                case ThumbnailViewClickAction.OpenFolder:
                    if (!string.IsNullOrEmpty(filePath))
                    {
                        Helpers.OpenFolderWithFile(filePath);
                    }
                    break;

                case ThumbnailViewClickAction.OpenURL:
                    if (info.Result != null)
                    {
                        URLHelpers.OpenURL(info.Result.ToString());
                    }
                    break;

                case ThumbnailViewClickAction.EditImage:
                    if (!string.IsNullOrEmpty(filePath) && File.Exists(filePath) && Helpers.IsImageFile(filePath))
                    {
                        TaskHelpers.AnnotateImageFromFile(filePath);
                    }
                    break;
                }
            }
        }
Exemple #4
0
        private void NotificationForm_MouseClick(object sender, MouseEventArgs e)
        {
            tDuration.Stop();

            Close();

            if (e.Button == MouseButtons.Left)
            {
                switch (ToastConfig.Action)
                {
                case ToastClickAction.AnnotateImage:
                    if (!string.IsNullOrEmpty(ToastConfig.FilePath) && Helpers.IsImageFile(ToastConfig.FilePath))
                    {
                        TaskHelpers.AnnotateImageFromFile(ToastConfig.FilePath);
                    }
                    break;

                case ToastClickAction.CopyImageToClipboard:
                    if (!string.IsNullOrEmpty(ToastConfig.FilePath))
                    {
                        ClipboardHelpers.CopyImageFromFile(ToastConfig.FilePath);
                    }
                    break;

                case ToastClickAction.CopyUrl:
                    if (!string.IsNullOrEmpty(ToastConfig.URL))
                    {
                        ClipboardHelpers.CopyText(ToastConfig.URL);
                    }
                    break;

                case ToastClickAction.OpenFile:
                    if (!string.IsNullOrEmpty(ToastConfig.FilePath))
                    {
                        URLHelpers.OpenURL(ToastConfig.FilePath);
                    }
                    break;

                case ToastClickAction.OpenFolder:
                    if (!string.IsNullOrEmpty(ToastConfig.FilePath))
                    {
                        Helpers.OpenFolderWithFile(ToastConfig.FilePath);
                    }
                    break;

                case ToastClickAction.OpenUrl:
                    if (!string.IsNullOrEmpty(ToastConfig.URL))
                    {
                        URLHelpers.OpenURL(ToastConfig.URL);
                    }
                    break;

                case ToastClickAction.Upload:
                    if (!string.IsNullOrEmpty(ToastConfig.FilePath))
                    {
                        UploadManager.UploadFile(ToastConfig.FilePath);
                    }
                    break;
                }
            }
        }