System.Diagnostics.Process.Start(string)

Here are the examples of the csharp api System.Diagnostics.Process.Start(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3339 Examples 7

19 Source : HyperlinkButtonBehavior.cs
with MIT License
from ABTSoftware

private void OnHyperlinkClick(object sender, RoutedEventArgs e)
        {
            if(!string.IsNullOrWhiteSpace(Uri))
            {
                Process.Start(Uri);
            }
        }

19 Source : CustomChangeThemeModifier.cs
with MIT License
from ABTSoftware

private void Export(string filter, bool useXaml, Size? size = null)
        {
            var saveFileDialog = new SaveFileDialog
            {
                Filter = filter,
                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
            };

            if (saveFileDialog.ShowDialog() == true)
            {
                if (!(ParentSurface is SciChartSurface surface)) return;

                var exportType = filter.ToUpper().Contains("XPS") ? ExportType.Xps : ExportType.Png;

                if (size.HasValue)
                {
                    surface.ExportToFile(saveFileDialog.FileName, exportType, useXaml, size.Value);
                }
                else
                {
                    surface.ExportToFile(saveFileDialog.FileName, exportType, useXaml);
                }

                try
                {
                    Process.Start(saveFileDialog.FileName);
                }
                catch (Win32Exception e)
                {
                    if (e.NativeErrorCode == 1155)
                    {
                        MessageBox.Show("Can't open because no application is replacedociated with the specified file for this operation.", "Exported successfully!");
                    }
                }
                
            }
        }

19 Source : ChartPrintingMultiPaneCharts.xaml.cs
with MIT License
from ABTSoftware

private void Export_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new SaveFileDialog();
            dialog.Filter = "Png Image (.png)|*.png";
            dialog.AddExtension = true;
            if (dialog.ShowDialog() == true)
            {
                var writeableBitmap = ChartGroup.RenderToBitmap((int)ChartGroup.ActualWidth, (int)ChartGroup.ActualHeight);
                using (FileStream stream5 = new FileStream(dialog.FileName, FileMode.Create))
                {
                    PngBitmapEncoder encoder5 = new PngBitmapEncoder();
                    encoder5.Frames.Add(BitmapFrame.Create(writeableBitmap));
                    encoder5.Save(stream5);
                }

                Process.Start(dialog.FileName);
            }
        }

19 Source : ExceptionView.xaml.cs
with MIT License
from ABTSoftware

private void EmailSupport_Click(object sender, RoutedEventArgs e)
        {
            string email = "mailto:[email protected]?subject=Unhandled%20Exception&body=" + Uri.EscapeDataString(FormatEmail());
            try
            {
                Process.Start(email);
            }
            catch (Exception)
            {
                MessageBox.Show(
                    "We have not detected an email client on your PC!\r\nPlease email [email protected] with the exception message.");
            }
        }

19 Source : AuthorCard.xaml.cs
with MIT License
from Accelerider

private RelayCommand GetCommand(Func<string> urlGetter)
        {
            return new RelayCommand(() =>
            {
                var url = urlGetter();
                if (!string.IsNullOrWhiteSpace(url)) Process.Start(url);
            });
        }

19 Source : MainMenu.xaml.cs
with GNU General Public License v3.0
from ACEmulator

private void Guide_Click(object sender, RoutedEventArgs e)
        {
            Process.Start(@"docs\index.html");
        }

19 Source : AppViewModel.cs
with Microsoft Public License
from achimismaili

public void OpenUrl()
        {
            // see also https://support.microsoft.com/en-us/help/305703/how-to-start-the-default-internet-browser-programmatically-by-using-vi

            string target = "https://www.featureadmin.com";
            
            try
            {
                System.Diagnostics.Process.Start(target);
            }
            catch
                (
                 System.ComponentModel.Win32Exception noBrowser)
            {
                if (noBrowser.ErrorCode == -2147467259)
                {
                    var dialog = new ConfirmationRequest(
                        "No Browser found",
                        noBrowser.Message
                        );
                    DialogViewModel dialogVm = new DialogViewModel(eventAggregator, dialog);
                    this.windowManager.ShowDialog(dialogVm, null, GetDialogSettings());
                }
            }
            catch (System.Exception other)
            {
                var dialog = new ConfirmationRequest(
                        "System Exception when opening browser",
                        other.Message
                        );
                DialogViewModel dialogVm = new DialogViewModel(eventAggregator, dialog);
                this.windowManager.ShowDialog(dialogVm, null, GetDialogSettings());
            }

        }

19 Source : UpgradeViewModel.cs
with GNU Lesser General Public License v3.0
from acnicholas

public void Download()
        {
            System.Diagnostics.Process.Start(downloadLink);
        }

19 Source : AboutForm.xaml.cs
with GNU General Public License v3.0
from AdhocAdam

private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
        {
            System.Diagnostics.Process.Start(e.Uri.AbsoluteUri);
        }

19 Source : MultipleMailboxes.xaml.cs
with GNU General Public License v3.0
from AdhocAdam

private void Hyperlink_RequestNavigate(object sender,System.Windows.Navigation.RequestNavigateEventArgs e)
        {
            System.Diagnostics.Process.Start(e.Uri.AbsoluteUri);
        }

19 Source : ClonesManager.cs
with MIT License
from adrenak

public static void OpenProjectInFileExplorer(string path)
        {
            System.Diagnostics.Process.Start(@path);
        }

19 Source : AboutWindow.xaml.cs
with MIT License
from adrianmteo

private void OpenLink(string url)
        {
            try
            {
                Process.Start(url);
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message);
            }
        }

19 Source : MainWindow.xaml.cs
with GNU General Public License v2.0
from adrifcastr

private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Process.Start("https://www.paypal.me/adrifcastr");
        }

19 Source : Form_SteamID64_Editor.cs
with MIT License
from Aemony

private void linkLabelSteamID64_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Process.Start(e.Link.LinkData as string);
        }

19 Source : Form_SteamID64_Editor.cs
with MIT License
from Aemony

private void linkLabelSteamID64_New_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Process.Start(e.Link.LinkData as string);
        }

19 Source : MainForm.cs
with GNU General Public License v3.0
from AgentRev

private void lblLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Process.Start("https://github.com/AgentRev/CoD-FoV-Changers");
        }

19 Source : MainForm.cs
with GNU General Public License v3.0
from AgentRev

private void lblLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Process.Start("http://www.mapmodnews.com/");
        }

19 Source : MainForm.cs
with GNU General Public License v3.0
from AgentRev

private void btnStartGame_Click(object sender, EventArgs e)
        {
            if (gameFound)
            {
                try { Process.Start("steam://rungameid/" + (string)gameMode.GetValue("c_gameID")); }
                catch
                {
                    MessageBox.Show(this, (string)gameMode.GetValue("c_errorMessage"), "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                MessageBox.Show(this, (string)gameMode.GetValue("c_notFoundMessage"), "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }

19 Source : AboutDialog.cs
with GNU General Public License v3.0
from aglab2

private void pictureBox2_Click(object sender, EventArgs e)
        {
            string url = "";

            string business = "[email protected]";
            string description = "Star%20Display";
            string country = "US";
            string currency = "USD";

            url += "https://www.paypal.com/cgi-bin/webscr" +
                "?cmd=" + "_donations" +
                "&business=" + business +
                "&lc=" + country +
                "&item_name=" + description +
                "¤cy_code=" + currency +
                "&bn=" + "PP%2dDonationsBF";

            System.Diagnostics.Process.Start(url);
        }

19 Source : AboutDialog.cs
with GNU General Public License v3.0
from aglab2

private void pictureBox1_Click(object sender, EventArgs e)
        {
            string url = "http://www.github.com/aglab2/SM64StarDisplay";

            System.Diagnostics.Process.Start(url);
        }

19 Source : Form1.cs
with GNU General Public License v3.0
from aglab2

private void buttonDownload_Click(object sender, EventArgs e)
        {
            client = new GitHubClient(new ProductHeaderValue("star-display"));
            versionTask = client.Repository.Release.GetAll("aglab2", "SM64StarManager", new ApiOptions() { PageSize = 5, PageCount = 1 });
            while(true)
            {
                Thread.Sleep(100);
                if (IsCompleted())
                    break;
            }

            Process.Start(DownloadPath());
        }

19 Source : IOManager.cs
with GNU General Public License v3.0
from AHeroicLlama

public static void OpenImage(Image image)
		{
			string tempImageFilePath = GetNewTempImageFilePath();

			try
			{
				Directory.CreateDirectory(tempImageFolder);
				image.Save(tempImageFilePath);
			}
			catch (Exception e)
			{
				Notify.Error(
					"Mappalachia was unable to store a temporary copy of the map image in its temporary folder at " + tempImageFilePath + ".\n\n" +
					genericExceptionHelpText +
					e);

				return;
			}

			try
			{
				Process.Start(tempImageFilePath);
			}
			catch (Exception e)
			{
				Notify.Error(
					"Mappalachia was unable to launch your default photo viewer to view the temporary map image at " + tempImageFilePath + ".\n\n" +
					genericExceptionHelpText +
					e);

				return;
			}
		}

19 Source : UpdateChecker.cs
with GNU General Public License v3.0
from AHeroicLlama

static void CheckForUpdatesManual(string errorReason)
		{
			DialogResult question = MessageBox.Show(
				"Automatic update checking failed: \n" + errorReason + "\n\nWould you like to visit the releases page to check for updates manually?\n" +
					"Your current version is " + currentVersion,
				"Check manually?", MessageBoxButtons.YesNo, MessageBoxIcon.Error);
			if (question == DialogResult.Yes)
			{
				Process.Start("https://github.com/AHeroicLlama/Mappalachia/releases/latest");
			}
		}

19 Source : UpdateChecker.cs
with GNU General Public License v3.0
from AHeroicLlama

static void PromptForUpdate(string latestVersion)
		{
			DialogResult question = MessageBox.Show(
				"A new version of Mappalachia, " + latestVersion + " is now available! \nVisit the releases page to download it?",
				"Update available", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
			if (question == DialogResult.Yes)
			{
				Process.Start("https://github.com/AHeroicLlama/Mappalachia/releases/latest");
			}
		}

19 Source : MainForm.cs
with GNU General Public License v3.0
from ahmed605

private void lnkWebsite_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Process.Start("http://www.quackler.com");
        }

19 Source : Updater.cs
with GNU General Public License v3.0
from ahmed605

public static void CheckForUpdate()
        {
            string version = GetWebString(VersionUrl);

            if ( string.IsNullOrEmpty(version))
            {
                DialogResult result =
                    MessageBox.Show(
                        "An error has occurred. Please manually check the Github releases page for updates.",
                        "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error);

                if (result == DialogResult.Yes)
                {
                    Process.Start(DownloadListUrl);
                }
            }
            else
            {
                var versionSplit = version.Split(new[] {'.'}, 3);
                int versionCode = 0;
                foreach (var s in versionSplit)
                {
                    versionCode *= 0x100;
                    versionCode += int.Parse(s);
                }

                Version vrs = replacedembly.GetExecutingreplacedembly().GetName().Version;
                int replacedemblyVersionCode = (vrs.Major * 0x100 + vrs.Minor) * 0x100 + vrs.Build;
                
                if (versionCode > replacedemblyVersionCode)
                {
                    string message =
                        "There is a new version of SparkIV available! Would you like to download the newest version?" +
                        "\n" + "\n" + "This version is:  " + vrs.Major + "." + vrs.Minor + "." + vrs.Build + "\n"
                        + "New Version is: " + version;

                    DialogResult result = MessageBox.Show(message, "New Update!", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                    if (result == DialogResult.Yes)
                    {
                        var url = GetWebString(UpdateUrl);

                        if ( string.IsNullOrEmpty(url) )
                        {
                            result =
                                MessageBox.Show(
                                    "An error has occurred. Please manually check the Github releases page for updates?",
                                    "Error", MessageBoxButtons.YesNo, MessageBoxIcon.Error);

                            if (result == DialogResult.Yes)
                            {
                                Process.Start(DownloadListUrl);
                            }
                        }
                        else
                        {
                            Process.Start( url );
                            Application.Exit();                            
                        }
                    }
                }
                else
                {
                    MessageBox.Show(String.Format("There is no update available at this time."),
                                    "No update available", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                }
            }
        }

19 Source : Information.cs
with GNU General Public License v3.0
from AHosseinRnj

private void TelegramPicBox_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start("https://telegram.me/AmirHossein_Rnj_01");
        }

19 Source : Information.cs
with GNU General Public License v3.0
from AHosseinRnj

private void InstagramPicBox_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start("https://www.instagram.com/ahossein_rnj");
        }

19 Source : ErrorWindow.xaml.cs
with GNU Affero General Public License v3.0
from aianlinb

private void OnGitHubClick(object sender, RoutedEventArgs e)
        {
            Process.Start("https://github.com/aianlinb/LibBundle");
        }

19 Source : Program.cs
with The Unlicense
from AigioL

static void Main(string[] args)
        {
            TryMain();
            void TryMain()
            {
                try
                {
                    Main();
                }
                catch (Exception ex)
                {
                    var index = byte.MinValue;
                    while (ex != null)
                    {
                        if (index++ > sbyte.MaxValue) break;
                        Console.WriteLine(ex.Message);
                        Console.WriteLine(ex.StackTrace);
                        ex = ex.InnerException;
                    }
                }
                Console.ReadLine();
            }
            void Main()
            {
                // ReSharper disable PossibleNullReferenceException
                var entryreplacedembly = replacedembly.GetEntryreplacedembly();
                var replacedle = entryreplacedembly.FullName.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).FirstOrDefault();
                // ReSharper disable once replacedignNullToNotNullAttribute
                if (!replacedle.IsNullOrWhiteSpace()) Console.replacedle = replacedle;
                var rootPath = Path.GetDirectoryName(entryreplacedembly.Location);
                if (rootPath == null) throw new ArgumentNullException(nameof(rootPath));
                var sofilepath = args?.FirstOrDefault(x => x != null && File.Exists(x) && Path.GetExtension(x).Equals(GetSoFileExtension(), StringComparison.OrdinalIgnoreCase));
                if (sofilepath == null)
                {
                    var sofilepaths = Directory.GetFiles(rootPath).Where(x => Path.GetExtension(x).Equals(GetSoFileExtension(), StringComparison.OrdinalIgnoreCase)).ToArray();
                    sofilepath =
                       sofilepaths.FirstOrDefault(x => Path.GetFileName(x).Equals(GetSoDefaultFileName(), StringComparison.OrdinalIgnoreCase)) ??
                       sofilepaths.FirstOrDefault();
                }
                if (sofilepath == null) ReadLineAndExit("Can not find the .so file.");
                // ReSharper disable once replacedignNullToNotNullAttribute
                var bytes = File.ReadAllBytes(sofilepath);
                var elf = Elf.FromFile(sofilepath);
                var rodata = elf.Header.SectionHeaders.FirstOrDefault(x => x.Name.Equals(".rodata"));
                if (rodata == null) ReadLineAndExit(".rodata not found.");
                var packedFiles = new List<string>();
                var addr = (uint)rodata.Addr;
                while (true)
                {
                    //up to 16 bytes of alignment
                    uint i;
                    for (i = 0; i < 16; i++)
                        if (bytes[addr + i] != 0)
                            break;

                    if (i == 16)
                        break; //We found all the files
                    addr += i;

                    var name = GetString(bytes, addr);
                    if (name.IsNullOrWhiteSpace())
                        break;

                    //We only care about dlls
                    if (!name.EndsWith(".dll"))
                        break;

                    packedFiles.Add(name);
                    addr += (uint)name.Length + 1u;
                }
                var data = elf.Header.SectionHeaders.FirstOrDefault(x => x.Name.Equals(".data"));
                if (data == null) ReadLineAndExit(".data not found.");
                int ixGzip = 0;
                addr = (uint)data.Offset;
                var output = Path.Combine(rootPath, "replacedemblies");
                if (!Directory.Exists(output)) Directory.CreateDirectory(output);
                Console.WriteLine($"output:{output}");
                foreach (var item in packedFiles)
                {
                    ixGzip = findNextGZIPIndex(bytes, ixGzip);
                    if (ixGzip > 0)
                    {
                        var ptr = ixGzip;
                        var length = GetBigEndianUInt32(bytes, addr + 8);
                        var compressedbytes = new byte[length];
                        if (ptr + length <= bytes.LongLength)
                        {
                            Array.Copy(bytes, ptr, compressedbytes, 0, length);
                            try
                            {
                                var decompbytes = Decompress(compressedbytes);
                                var path = Path.Combine(output, item);
                                File.WriteAllBytes(path, decompbytes);
                                Console.WriteLine($"file:{item}");
                                addr += 0x10;
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine($"Failed to decompress file: {item} {e.Message}.");
                            }
                        }
                    }
                }
                TryOpenDir(output);
                // ReSharper restore PossibleNullReferenceException
            }
            void ReadLineAndExit(string writeLine = null)
            {
                if (writeLine != null) Console.WriteLine(writeLine);
                Console.ReadLine();
                Environment.Exit(0);
            }
            string GetSoFileExtension() => ".so";
            string GetSoDefaultFileName() => "libmonodroid_bundle_app" + GetSoFileExtension();
            string GetString(byte[] bytes, uint address)
            {
                int maxLength = 255;
                for (int i = (int)address; i < address + maxLength; i++)
                {
                    if (bytes[i] == 0)
                    {
                        maxLength = i - (int)address;
                        break;
                    }
                }
                var buffer = new byte[maxLength];
                Array.Copy(bytes, address, buffer, 0, maxLength);
                return Encoding.ASCII.GetString(buffer);
            }
            int findNextGZIPIndex(byte[] bytes, int ixGzip)
            {
                for (var j = ixGzip + 2; j < bytes.Length; j++)
                {
                    if (bytes[j - 1] == 0x1f && bytes[j] == 0x8b)
                    {
                        ixGzip = j - 1;
                        return ixGzip;
                    }
                }
                return 0;
            }
            byte[] Decompress(byte[] data)
            {
                using (var compressedStream = new MemoryStream(data))
                using (var zipStream = new GZipStream(compressedStream, CompressionMode.Decompress))
                using (var resultStream = new MemoryStream())
                {
                    zipStream.CopyTo(resultStream);
                    return resultStream.ToArray();
                }
            }
            uint GetBigEndianUInt32(byte[] bytes, uint address)
            {
                var byte1 = (uint)bytes[(int)address + 3] << 24;
                var byte2 = (uint)bytes[(int)address + 2] << 16;
                var byte3 = (uint)bytes[(int)address + 1] << 8;
                var byte4 = bytes[(int)address];
                return byte1 + byte2 + byte3 + byte4;
            }
            void TryOpenDir(string dirpath)
            {
                try
                {
                    Process.Start(dirpath);
                }
                catch
                {
                    // ignored
                }
            }
        }

19 Source : ErrorWindow.xaml.cs
with GNU Affero General Public License v3.0
from aianlinb

protected virtual void OnGitHubClick(object sender, RoutedEventArgs e)
        {
            Process.Start("https://github.com/aianlinb/LibGGPK2");
        }

19 Source : Form1.cs
with MIT License
from akalankauk

private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start("https://github.com/akalankauk/Keep-It-Secure-File-Encryption");
        }

19 Source : BuildBundles.cs
with MIT License
from akof1314

[MenuItem("Tool/Build Reporter")]
    public static void Reporter()
    {
        //WuHuan.replacedetBundleFilesreplacedyze.replacedyzeExport = true;
        //WuHuan.replacedetBundleFilesreplacedyze.replacedyzeOnlyScene = true;
        string directoryPath = Path.GetDirectoryName(Application.dataPath);
        string bundlePath = Path.Combine(directoryPath, GetBuildTarget().ToString());
        string outputPath = Path.Combine(directoryPath, GetBuildTarget().ToString() + DateTime.Now.ToString("yyyyMMdd_HHmmss") + ".xlsx");
        WuHuan.replacedetBundleReporter.replacedyzePrint(bundlePath, outputPath, () => System.Diagnostics.Process.Start(outputPath));
    }

19 Source : AssetDanshariUtility.cs
with MIT License
from akof1314

public static void SaveFileText(string path, string text)
        {
            try
            {
                File.WriteAllText(path, text, Encoding.UTF8);
                System.Diagnostics.Process.Start(path);
            }
            catch (Exception e)
            {
                EditorUtility.DisplayDialog(replacedetDanshariStyle.Get().errorreplacedle, e.Message, replacedetDanshariStyle.Get().sureStr);
                throw;
            }
        }

19 Source : ContentsBrowser.cs
with MIT License
from alaabenfatma

private ContextMenu contentsMenu()
        {
            var cm = new ContextMenu();
            var import_tb = new TextBlock();
            import_tb.Inlines.Add(new Run("⇓")
            {
                Foreground = Brushes.White,
                FontSize = 14,
                FontFamily = new FontFamily("Yu Gothic UI Semibold")
            });
            import_tb.Inlines.Add(new Run(" Import") {Foreground = Brushes.White});
            var new_tb = new TextBlock();
            new_tb.Inlines.Add(new Run("🗋")
            {
                Foreground = Brushes.White,
                FontSize = 14,
                FontFamily = new FontFamily("Verdana")
            });
            new_tb.Inlines.Add(new Run(" New") {Foreground = Brushes.White});
            var openexplorer_tb = new TextBlock();
            openexplorer_tb.Inlines.Add(new Run("🗀")
            {
                Foreground = Brushes.Yellow,
                FontSize = 16,
                FontFamily = new FontFamily("Yu Gothic UI Semibold")
            });
            openexplorer_tb.Inlines.Add(new Run(" Open in Folder in File Explorer") {Foreground = Brushes.White});
            var refresh_tb = new TextBlock();
            refresh_tb.Inlines.Add(new Run("↻")
            {
                Foreground = Brushes.Cyan,
                FontSize = 14,
                FontFamily = new FontFamily("Yu Gothic UI Semibold")
            });
            refresh_tb.Inlines.Add(new Run(" Refresh") {Foreground = Brushes.White});
            var import = new MenuItem
            {
                Header = import_tb
            };
            import.Click += (s, e) => { ImportFile(); };
            var newitem = new MenuItem
            {
                Header = new_tb
            };
            NewItemMenu(newitem);
            var openexplorer = new MenuItem
            {
                Header = openexplorer_tb
            };
            openexplorer.Click += (s, e) => { Process.Start(Item.Path); };
            var refresh = new MenuItem
            {
                Header = refresh_tb
            };
            refresh.Click += (s, e) => { Item.Load(Item.Path); };
            cm.Items.Add(openexplorer);
            cm.Items.Add(new Separator {Foreground = Brushes.White});
            cm.Items.Add(import);
            cm.Items.Add(newitem);
            var paste = new MenuItem
            {
                Header = new TextBlock
                {
                    Foreground = Brushes.WhiteSmoke,
                    Text = "Paste"
                }
            };
            paste.Click += (s, e) =>
            {
                try
                {
                    var p = Item.Path;
                    if (p.Substring(0, Math.Max(0, p.Length - 1)) == @"\")
                        File.Copy(PathToCopy, Item.Path + Path.GetFileName(PathToCopy));
                    else
                        File.Copy(PathToCopy, Item.Path + @"\" + Path.GetFileName(PathToCopy));
                    Item.Load(Item.Path);
                }
                catch
                {
                    //Ignored
                }
            };
            cm.Items.Add(paste);
            cm.Items.Add(new Separator {Foreground = Brushes.White});
            cm.Items.Add(refresh);
            return cm;
        }

19 Source : ContentsBrowser.cs
with MIT License
from alaabenfatma

private ContextMenu BuildContextMenu()
        {
            var sp = new Separator {Foreground = Brushes.Gray};
            var sp1 = new Separator {Foreground = Brushes.Gray};
            var cMenu = new ContextMenu();
            var open = new MenuItem
            {
                Header = new TextBlock {Foreground = Brushes.WhiteSmoke, Text = "Open"}
            };
            open.Click += (s, e) => { Process.Start(Path); };
            cMenu.Items.Add(open);

            cMenu.Items.Add(sp);
            var addToVirtualControl = new MenuItem();
            var addNodeStack = new StackPanel {Orientation = Orientation.Horizontal};
            addNodeStack.Children.Add(new TextBlock {Text = "◰", FontSize = 18, Foreground = Brushes.DarkCyan});
            addNodeStack.Children.Add(new TextBlock
            {
                Text = "Create node.",
                Foreground = Brushes.WhiteSmoke,
                VerticalAlignment = VerticalAlignment.Center
            });
            addToVirtualControl.Header = addNodeStack;
            addToVirtualControl.Click += (s, e) =>
            {
                var node = new ReadFile(Hub.CurrentHost, false);
                node.OutputPorts[0].Data.Value = Path;
                Hub.CurrentHost.AddNode(node, Hub.CurrentHost.ActualWidth / 2 - node.ActualWidth / 2,
                    Hub.CurrentHost.ActualHeight / 2);
            };
            cMenu.Items.Add(addToVirtualControl);
            cMenu.Items.Add(sp1);
            var cut = new MenuItem
            {
                Header = new TextBlock
                {
                    Foreground = Brushes.WhiteSmoke,
                    Text = "Cut"
                }
            };
            var copy = new MenuItem
            {
                Header = new TextBlock
                {
                    Foreground = Brushes.WhiteSmoke,
                    Text = "Copy"
                }
            };


            var rename = new MenuItem
            {
                Header = new TextBlock
                {
                    Foreground = Brushes.WhiteSmoke,
                    Text = "Rename"
                }
            };
            var deleteTextBlock = new TextBlock();
            deleteTextBlock.Inlines.Add(new TextBlock {Text = "X", Foreground = Brushes.Red});
            deleteTextBlock.Inlines.Add(new TextBlock
            {
                Text = $" Delete {ItemCategory}",
                Foreground = Brushes.WhiteSmoke
            });
            var delete = new MenuItem
            {
                Header = deleteTextBlock
            };
            delete.Click += (s, e) =>
            {
                var res = MessageBox.Show($"Do you really want to delete this {ItemCategory}?", "Delete",
                    MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
                if (res == MessageBoxResult.No) return;
                try
                {
                    if (Folder)
                    {
                        Directory.Delete(Path);
                        Task.Factory.StartNew(() =>
                        {
                            Dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(() =>
                            {
                                Parent.Container.GetNode(Parent.Path, Parent.Container.FoldersTree.Items).Items
                                    .Remove(Parent.Container.GetNode(Path, Parent.Container.FoldersTree.Items));
                            }));
                        });
                    }
                    else
                    {
                        File.Delete(Path);
                    }
                    Parent.Items.Remove(this);
                }
                catch (Exception exception)
                {
                    if (!exception.Message.Contains("The directory is not empty."))
                    {
                        MessageBox.Show(exception.Message, $"Could not delete the {ItemCategory}",
                            MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    else
                    {
                        var answer = MessageBox.Show(exception.Message + "\n" + "Delete everything in this directory?",
                            $"Could not delete the {ItemCategory}",
                            MessageBoxButton.YesNo, MessageBoxImage.Error);
                        if (answer == MessageBoxResult.Yes)
                        {
                            Directory.Delete(Path, true);
                            Parent.Container.GetNode(Parent.Path, Parent.Container.FoldersTree.Items).Items
                                .Remove(Parent.Container.GetNode(Path, Parent.Container.FoldersTree.Items));
                            Parent.Items.Remove(this);
                        }
                    }
                }
            };
            cut.Click += (s, e) => { Parent.Container.PathToCut = Path; };
            copy.Click += (s, e) =>
            {
                Parent.Container.PathToCut = "";
                Parent.Container.PathToCopy = Path;
            };

            rename.Click += (ss, e) => { Rename(); };
            cMenu.Items.Add(cut);
            cMenu.Items.Add(copy);
            cMenu.Items.Add(rename);
            var sp2 = new Separator();
            cMenu.Items.Add(sp2);
            cMenu.Items.Add(delete);
            return cMenu;
        }

19 Source : NewVersion.cs
with MIT License
from AlbertMN

private void BrowserNavigating(object sender, WebBrowserNavigatingEventArgs e) {
            if (!(e.Url.ToString().Equals("about:blank", StringComparison.InvariantCultureIgnoreCase))) {
                Process.Start(e.Url.ToString());
                e.Cancel = true;
                return;
            }

            e.Cancel = true;
            Process.Start(e.Url.ToString());
        }

19 Source : NewVersion.cs
with MIT License
from AlbertMN

void link_MouseUp(object sender, HtmlElementEventArgs e) {
            Regex pattern = new Regex("href=\\\"(.+?)\\\"");
            Match match = pattern.Match((sender as HtmlElement).OuterHtml);
            if (match.Groups.Count >= 1) {
                string link = match.Groups[1].Value;

                if (link.Length > 0) {
                    if (link[0] != '#')
                        Process.Start(link);
                }
            }
        }

19 Source : AdvancedSettings.cs
with MIT License
from AlbertMN

private void shouldIEditLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
            Process.Start("https://acc.readme.io/docs/application-advanced-settings-expert-setup");
        }

19 Source : SoftwareUpdater.cs
with MIT License
from AlbertMN

private static void FileDownloadedCallback(object sender, AsyncCompletedEventArgs e) {
            if (MainProgram.updateProgressWindow != null) {
                MainProgram.updateProgressWindow.Close();
                MainProgram.updateProgressWindow = null;
            }

            MainProgram.DoDebug("Finished downloading");

            if (!e.Cancelled) {
                //Download success
                try {
                    if (File.Exists(targetLocation)) {
                        Process.Start(targetLocation);
                        MainProgram.DoDebug("New installer successfully downloaded and opened.");
                        Application.Exit();
                    } else {
                        MainProgram.DoDebug("Downloaded file doesn't exist (new version)");
                        MessageBox.Show("Failed to download new version of ACC. File doesn't exist", Translator.__("error", "general") + " | " + MainProgram.messageBoxreplacedle);
                    }
                } catch (Exception ee) {
                    MainProgram.DoDebug("Error occurred on open of new version; " + ee.Message);
                    MessageBox.Show("Failed to open new version! Error is logged, please contact the developer on Discord!", Translator.__("error", "general") + " | " + MainProgram.messageBoxreplacedle);
                }
            } else {
                MainProgram.DoDebug("Failed to download new version of ACC. Error; " + e.Error);
                MessageBox.Show("Failed to download new version. Try again later!", Translator.__("error", "general") + " | " + MainProgram.messageBoxreplacedle);
            }

            Thread.Sleep(500);
            Thread.CurrentThread.Abort();
        }

19 Source : DependencyChecker.cs
with GNU General Public License v3.0
from Albo1125

private static void NextDependencyErrorCallback(Popup p)
        {
            if (p.IndexOfGivenAnswer == 0)
            {
                Game.LogTrivial("Continue pressed");
                Index++;
                if (Plugins_URL_Errors.Count > Index)
                {
                    Popup pop = new Popup("Error " + (Index + 1) + ": " + Plugins_URL_Errors[Index].Item1, Plugins_URL_Errors[Index].Item3, new List<string>() { "Continue", "Open installation video tutorial for this plugin" },
                        false, false, NextDependencyErrorCallback);
                    pop.Display();
                }
                else
                {
                    Popup pop = new Popup("Albo1125.Common detected errors", "To fix these installation errors, you should read the appropriate ReadMe or doreplacedentation files, watch the installation video tutorial or use my Troubleshooter (link in video description).",
                        new List<string>() { "Continue", "Open installation/troubleshooting video tutorial", "Exit" }, false, false, NextDependencyErrorCallback);
                    pop.Display();
                }
            }
            else if (p.IndexOfGivenAnswer == 1)
            {
                Game.LogTrivial("GoToVideo pressed.");
                if (Plugins_URL_Errors.Count > Index)
                {
                    Process.Start(Plugins_URL_Errors[Index].Item2);
                }
                else
                {
                    Process.Start("https://youtu.be/af434m72rIo?list=PLEKypmos74W8PMP4k6xmVxpTKdebvJpFb"); 
                }
                p.Display();
            }
            else if (p.IndexOfGivenAnswer == 2)
            {
                Game.LogTrivial("ExitButton pressed.");
            }
            
        }

19 Source : UpdateChecker.cs
with GNU General Public License v3.0
from Albo1125

private static void NextUpdateCallback(Popup p)
        {
            if (p.IndexOfGivenAnswer == 0)
            {
                Game.LogTrivial("Continue pressed");
                Index++;
                if (PluginsDownloadLink.Count > Index)
                {
                    Popup pop = new Popup("Albo1125.Common Update Check", "Update " + (Index + 1) + ": " + PluginsDownloadLink[Index].Item1, new List<string>() { "Continue", "Go to download page" },
                        false, false, NextUpdateCallback);
                    pop.Display();
                }
                else
                {
                    Popup pop = new Popup("Albo1125.Common Update Check", "Please install updates to maintain stability and don't request support for old versions.",
                        new List<string>() { "-", "Open installation/troubleshooting video tutorial", "Continue to game.", "Delay next update check by a week.", "Delay next update check by a month.",
                            "Fully disable update checks (not recommended)." }, false, false, NextUpdateCallback);
                    pop.Display();
                }
            }
            else if (p.IndexOfGivenAnswer == 1)
            {
                Game.LogTrivial("GoToDownload pressed.");
                if (PluginsDownloadLink.Count > Index && Index >= 0)
                {
                    System.Diagnostics.Process.Start(PluginsDownloadLink[Index].Item2);
                }
                else
                {
                    System.Diagnostics.Process.Start("https://youtu.be/af434m72rIo?list=PLEKypmos74W8PMP4k6xmVxpTKdebvJpFb");
                }
                p.Display();
            }
            else if (p.IndexOfGivenAnswer == 2)
            {
                Game.LogTrivial("ExitButton pressed.");
            }
            else if (p.IndexOfGivenAnswer == 3)
            {
                Game.LogTrivial("Delay by week pressed");
                DateTime NextUpdateCheckDT = DateTime.Now.AddDays(6);
                XDoreplacedent CommonVariablesDoc = XDoreplacedent.Load("Albo1125.Common/CommonVariables.xml");
                if (CommonVariablesDoc.Root.Element("NextUpdateCheckDT") == null) { CommonVariablesDoc.Root.Add(new XElement("NextUpdateCheckDT")); }
                CommonVariablesDoc.Root.Element("NextUpdateCheckDT").Value = NextUpdateCheckDT.ToBinary().ToString();
                CommonVariablesDoc.Save("Albo1125.Common/CommonVariables.xml");
                CommonVariablesDoc = null;
            }
            else if (p.IndexOfGivenAnswer == 4)
            {
                Game.LogTrivial("Delay by month pressed");
                DateTime NextUpdateCheckDT = DateTime.Now.AddMonths(1);
                XDoreplacedent CommonVariablesDoc = XDoreplacedent.Load("Albo1125.Common/CommonVariables.xml");
                if (CommonVariablesDoc.Root.Element("NextUpdateCheckDT") == null) { CommonVariablesDoc.Root.Add(new XElement("NextUpdateCheckDT")); }
                CommonVariablesDoc.Root.Element("NextUpdateCheckDT").Value = NextUpdateCheckDT.ToBinary().ToString();
                CommonVariablesDoc.Save("Albo1125.Common/CommonVariables.xml");
                CommonVariablesDoc = null;
            }
            else if (p.IndexOfGivenAnswer == 5)
            {
                Game.LogTrivial("Disable Update Checks pressed.");
                XDoreplacedent CommonVariablesDoc = XDoreplacedent.Load("Albo1125.Common/CommonVariables.xml");
                if (CommonVariablesDoc.Root.Element("NextUpdateCheckDT") == null) { CommonVariablesDoc.Root.Add(new XElement("NextUpdateCheckDT")); }
                CommonVariablesDoc.Root.Element("NextUpdateCheckDT").Value = replacedembly.GetExecutingreplacedembly().GetName().Version.ToString();
                CommonVariablesDoc.Save("Albo1125.Common/CommonVariables.xml");
                CommonVariablesDoc = null;
                Popup pop = new Popup("Albo1125.Common Update Check", "Update checking has been disabled for this version of Albo1125.Common." +
                    "To re-enable it, delete the Albo1125.Common folder from your Grand Theft Auto V folder. Please do not request support for old versions.", false, true);
                pop.Display();
            }
        }

19 Source : GettingStarted.cs
with MIT License
from AlbertMN

void SetupDoreplacedentLinks(HtmlElementCollection elements) {
            string tagUpper = "";

            foreach (HtmlElement tag in elements) {
                tagUpper = tag.TagName.ToUpper();

                if ((tagUpper == "AREA") || (tagUpper == "A")) {
                    tag.MouseUp += new HtmlElementEventHandler(link_MouseUp);
                }
            }

            void link_MouseUp(object sender, HtmlElementEventArgs e) {
                Regex pattern = new Regex("href=\\\"(.+?)\\\"");
                Match match = pattern.Match((sender as HtmlElement).OuterHtml);
                if (match.Groups.Count >= 1) {
                    string link = match.Groups[1].Value;

                    if (link.Length > 0) {
                        if (link[0] != '#') {
                            Process.Start(link);
                        }
                    }
                }
            }
        }

19 Source : GettingStarted.cs
with MIT License
from AlbertMN

private void iftttActions_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
            Process.Start("https://replacedistantcomputercontrol.com/#what-can-it-do");
        }

19 Source : SettingsForm.cs
with MIT License
from AlbertMN

private void multiPcSupportReadMore_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {
            Process.Start("https://acc.readme.io/docs/controlling-multiple-computers");
        }

19 Source : SysTrayIcon.cs
with MIT License
from AlbertMN

private void TrayOpenHelp(object sender, EventArgs e) {
            Process.Start("https://replacedistantcomputercontrol.com/#get-in-touch");
        }

19 Source : EntryPoint.cs
with GNU General Public License v3.0
from Albo1125

public static void Main()
        {
            Game.DisplayNotification("You have installed replacedorted Callouts incorrectly. You must install it in the GTAV/Plugins/LSPDFR folder. It will then be automatically loaded when going on duty - you must NOT load it yourself via RAGEPluginHook. This is also explained in the Readme and Doreplacedentation. You will now be redirected to the installation tutorial.");
            GameFiber.Wait(5000);
            System.Diagnostics.Process.Start("https://youtu.be/af434m72rIo");
            return;
        }

19 Source : LSPDFRPlusHandler.cs
with GNU General Public License v3.0
from Albo1125

public static void Main()
        {
            Game.DisplayNotification("You have installed LSPDFR+ incorrectly. You must install it in GTAV/Plugins/LSPDFR. It will then be automatically loaded when going on duty - you must NOT load it yourself via RAGEPluginHook. This is also explained in the Readme and Doreplacedentation. You will now be redirected to the installation tutorial.");
            GameFiber.Wait(5000);
            System.Diagnostics.Process.Start("https://www.youtube.com/watch?v=af434m72rIo&list=PLEKypmos74W8PMP4k6xmVxpTKdebvJpFb");
            return;
        }

19 Source : DisplayHandler.cs
with GNU General Public License v3.0
from Albo1125

private static void firstLaunchPopupCb(Popup p)
        {
            if (p.IndexOfGivenAnswer == 0)
            {
                System.Diagnostics.Process.Start("https://www.youtube.com/watch?v=aJPA_nIEZxo");
            }
            
        }

19 Source : TrafficPolicerHandler.cs
with GNU General Public License v3.0
from Albo1125

public static void Main()
        {
            Game.DisplayNotification("You have installed Traffic Policer incorrectly and in the wrong folder: you must install it in Plugins/LSPDFR. It will then be automatically loaded when going on duty - you must NOT load it yourself via RAGEPluginHook. This is also explained in the Readme and Doreplacedentation. You will now be redirected to the installation tutorial.");
            GameFiber.Wait(5000);
            Process.Start("https://youtu.be/af434m72rIo");
            return;
        }

See More Examples