DesktopHelper.UI.CalendarForm.ExecEvent C# (CSharp) Метод

ExecEvent() приватный Метод

private ExecEvent ( TimedEvent te ) : void
te DesktopHelper.Entity.TimedEvent
Результат void
        private void ExecEvent(TimedEvent te)
        {
            try
            {
                switch (te.ExecEvents)
                {
                    case "关机":
                        Process p = new Process();
                        p.StartInfo.FileName = "cmd.exe";
                        p.StartInfo.UseShellExecute = false;
                        p.StartInfo.RedirectStandardInput = true;
                        p.StartInfo.RedirectStandardOutput = true;
                        p.StartInfo.RedirectStandardError = true;
                        p.StartInfo.CreateNoWindow = true;
                        p.Start();
                        p.StandardInput.WriteLine("shutdown -s -f");
                        p.Close();
                        break;
                    case "打开软件":
                        if (File.Exists(te.FilePath))
                            System.Diagnostics.Process.Start(te.FilePath);
                        if(list_TimedEvent.Contains(te)) list_TimedEvent.Remove(te);
                        break;
                }
            }
            catch (Exception ex)
            {
                log.WriteLog(ex.ToString());
            }
        }