// Set PcOptions after movie public void SetPcOption(PCOption pCOption) { // Control PC(Shutdown, Restart...) after playing the movie. If No Option - Replay movie if (PCOptionsService.SetOption(pCOption)) { mediaElementMovie.Stop(); } mediaElementMovie.Play(); }
/// <summary> /// Set an option after movie is played - Return True if No Option /// </summary> /// <param name="pcOption"></param> /// <returns></returns> public static bool SetOption(PCOption pcOption) { bool isNoOption = false; // Set PCOption switch (pcOption) { case PCOption.Shutdown: Process.Start("shutdown.exe", "/s /t 0"); break; case PCOption.Restart: Process.Start("shutdown.exe", "/r /t 0"); break; case PCOption.Sleep: SetSuspendState(false, true, true); break; case PCOption.Hibernate: SetSuspendState(true, true, true); break; case PCOption.LogOff: ExitWindowsEx(0, 0); break; case PCOption.Lock: LockWorkStation(); break; default: isNoOption = true; break; } return(isNoOption); }
// Options after playing the movie private void comboBoxPcFunctions_SelectionChanged(object sender, SelectionChangedEventArgs e) { selectedPcOption = (PCOption)e.AddedItems[0]; }