예제 #1
0
        public void Start(bool skipInitializing = false)
        {
            // disable notifications for new added auto starts on first start to avoid too many notifications at once
            bool isFirstRun = !AutoStartService.GetValidAutoStartFileExists();

            if (!isFirstRun)
            {
                AutoStartService.Add     += AddHandler;
                AutoStartService.Remove  += RemoveHandler;
                AutoStartService.Enable  += EnableHandler;
                AutoStartService.Disable += DisableHandler;
            }

            try {
                AutoStartService.LoadCurrentAutoStarts();
                AppStatus.HasOwnAutoStart = AutoStartService.HasOwnAutoStart;
            } catch (Exception) {
            }

            if (isFirstRun)
            {
                AutoStartService.Add     += AddHandler;
                AutoStartService.Remove  += RemoveHandler;
                AutoStartService.Enable  += EnableHandler;
                AutoStartService.Disable += DisableHandler;
            }
            AutoStartService.StartWatcher();

            if (!skipInitializing)
            {
                InitializeComponent();
            }
        }