private void OpenHyperlink(object parameter)
        {
            if (parameter is not string s)
            {
                return;
            }

            ProcessHelpers.ShellExecute(s);
        }
Exemple #2
0
        private void OpenHyperlink(object sender, RoutedEventArgs e)
        {
            var button = sender as Button;
            var tag    = button.Tag as string;

            string body = HttpUtility.UrlEncode($"** IMPORTANT: Drop the \"{Path.GetFileName(report.FilePath)}\" file in here **");

            var result = tag switch
            {
                "github" => GetGitHubLink(),
                "discord" => DiscordInviteLink,
                "email" => GetMailtoLink(),
                _ => throw new NotImplementedException()
            };

            OpenInExplorer(null, null);
            ProcessHelpers.ShellExecute(result);

            string GetGitHubLink()
            {
                StringBuilder builder = new();

                builder.Append("https://github.com/PixiEditor/PixiEditor/issues/new?title=");
                builder.Append(HttpUtility.UrlEncode($"Crash Report"));
                builder.Append("&body=");
                builder.Append(body);

                return(builder.ToString());
            }

            string GetMailtoLink()
            {
                StringBuilder builder = new();

                builder.Append("mailto:[email protected]?subject=");
                builder.Append(HttpUtility.UrlEncode($"Crash Report"));
                builder.Append("&body=");
                builder.Append(body);

                return(builder.ToString());
            }
        }
    }
Exemple #3
0
        private void OpenInExplorer(object sender, RoutedEventArgs e)
        {
            string tempPath = Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                "PixiEditor",
                "crash_logs",
                "to-copy");

            DirectoryInfo info = Directory.CreateDirectory(tempPath);

            foreach (var file in info.EnumerateFiles())
            {
                file.Delete();
            }

            File.Copy(report.FilePath, Path.Combine(tempPath, Path.GetFileName(report.FilePath)), true);

            ProcessHelpers.ShellExecute(tempPath);
        }