Esempio n. 1
0
        async Task <bool> Prepare()
        {
            bool enabled = WinServiceUtils.TrySetStartupType(WinUpdatesManager.WUA_SERVICE_NAME, true);

            if (!enabled)
            {
                return(false);
            }
            return(await WinServiceUtils.StartServiceAsync(WinUpdatesManager.WUA_SERVICE_NAME, 60000).ConfigureAwait(false));
        }
Esempio n. 2
0
        private async void startService_Click(object sender, RoutedEventArgs e)
        {
            LogUpdateInto("starting service...");

            bool result = await WinServiceUtils.StartServiceAsync("wuauserv", 5000);

            if (result)
            {
                LogUpdateInto("success!");
            }
            else
            {
                LogUpdateInto("fail!");
            }
        }