Exemple #1
0
        public void Test_GetStatus()
        {
            var source = "Wechat";
            var result = WinStartup.GetStatus(source);

            Console.WriteLine(result);
        }
Exemple #2
0
        private bool GetRunAtStartup()
        {
            bool run = ExceptionMonster.EatTheException(() =>
            {
                return(WinStartup.IsAdded("squiggle", GetStartupPath()));
            }, "reading startup info from registry");

            return(run);
        }
Exemple #3
0
        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);
            }
        }