private void BtInstall_Click(object sender, RoutedEventArgs e)
        {
            BtInstall.IsEnabled  = false;
            BtSchedule.IsEnabled = false;
            TpPicker.IsEnabled   = false;

            SqlCe.UpdateSupData("STD", string.Empty);

            if (_isReschedule)
            {
                SqlCe.SetEnforcedFlag(_scheduleId);
            }

            SqlCe.SetUpdatesInstallStatusFlag(true);
            CcmUtils.ExecuteInstallUpdates(true);
            SetStatus(ScheduleStatus.Green);
            StatusText.Text = "Installation has been initiated.";
        }
Exemplo n.º 2
0
        protected override void OnStart(string[] args)
        {
            Globals.Log.Information("Service is starting");
            WaitForCcmExec();
            WaitForCmClientOperational();
            SqlCe.MaintainDatabase();
            _pipeServer = new PipeServer();
            _pipeServer.Listen("3A2CD127-D069-4CD5-994D-C481F4760748");
            _pipeServer.PipeMessage += PipeServer_PipeMessage;

            _settings = SettingsUtils.Settings;

            if (_settings.IsDefault)
            {
                SettingsUtils.WriteSettingsToFile();
                Globals.Log.Warning("Failed to load settings from file, created new 'Settings.xml'. If this is the first start after installation, it's expected.");
            }

            _serviceSettings = _settings.ServiceConfig;

            if (SqlCe.GetAutoEnforceFlag())
            {
                Globals.Log.Information("Auto Enforce Flag is true, enforcing all.");

                _iEnforcementInterval = 1;
                CcmUtils.InstallAllAppsAndUpdates();

                if (_settings.LegalNotice.UseLegalNotice)
                {
                    Reg.SetLegalNotice(_settings.LegalNotice);
                }
            }

            SqlCe.SetUpdatesInstallStatusFlag(false);
            SaveAssignmentsToDB();

            _enforcementTimer.AutoReset = false;
            _enforcementTimer.Elapsed  += EnforcementTimer_Elapsed;
            _enforcementTimer.Interval  = AutoInterval();
            _enforcementTimer.Start();

            _ccmWmiEventListener = new CcmWmiEventListener();
            _ccmWmiEventListener.OnNewApplication += CcmWmiEventListener_OnNewApplication;
            _ccmWmiEventListener.OnNewUpdate      += CcmWmiEventListener_OnNewUpdate;

            FeedEnforcementsPump();
            EnforcePump();
            ConfirmPump();

            if (_serviceSettings.HardSuppressSCNotifications)
            {
                RenameSCNotification();
            }

            if (UnsafeNativeMethods.IsUserLoggedOn())
            {
                UnsafeNativeMethods.Run(_trayApp, null, false);
            }

            Globals.Log.Information("Service sucessfully started.");
        }