public void Test_GetStatus() { var source = "Wechat"; var result = WinStartup.GetStatus(source); Console.WriteLine(result); }
private bool GetRunAtStartup() { bool run = ExceptionMonster.EatTheException(() => { return(WinStartup.IsAdded("squiggle", GetStartupPath())); }, "reading startup info from registry"); return(run); }
private void SetRunAtStartup(bool run) { Exception ex; if (!ExceptionMonster.EatTheException(() => { var runKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true); if (run) { WinStartup.Add("squiggle", GetStartupPath()); } else { WinStartup.Remove("squiggle"); } }, "setting squiggle startup option in registry", out ex)) { MessageBox.Show("Could not set Squiggle to run at startup due to exception: " + ex.Message, "Squiggle", MessageBoxButton.OK, MessageBoxImage.Error); } }