/** * (Attempts to) uninstall sentinel. */ public void Uninstall(object sender, EventArgs args) { MessageBoxResult result = MessageBox.Show("Are you sure you want to uninstall Mimic Conduit? All files will be deleted.", "Mimic Conduit", MessageBoxButton.YesNo); if (result == MessageBoxResult.No) { return; } // Step 1: Delete AppData. try { Directory.Delete(Persistence.DATA_DIRECTORY, true); } catch { /* ignored */ } // Step 2: Unlink launch-on-start if enabled. if (Persistence.LaunchesAtStartup()) { Persistence.ToggleLaunchAtStartup(); } // Step 3: Delete Executable. Process.Start(new ProcessStartInfo { Arguments = "/C choice /C Y /N /D Y /T 3 & Del " + System.Reflection.Assembly.GetExecutingAssembly().Location, WindowStyle = ProcessWindowStyle.Hidden, CreateNoWindow = true, FileName = "cmd.exe" }); // Step 4: Stop Program. Application.Current.Shutdown(); }
private void HandleStartupChange(object sender, EventArgs e) { Persistence.ToggleLaunchAtStartup(); }