Exemple #1
0
        private static void StartProcessWithResult(Process process)
        {
            var result = string.Empty;

            process.Start();
            result += process.StandardOutput.ReadToEnd();
            result += process.StandardError.ReadToEnd();
            process.WaitForExit();
            NotificationsHelper.DisplayMessage(Messages.DisplayProcessExecutionResult(result));
        }
 private static double CheckInternetSpeed()
 {
     try
     {
         var timeBeforeDownloadingFile = DateTime.Now;
         var data = WebClient.DownloadData("http://google.com");
         var timeAfterDownloadingFile = DateTime.Now;
         return(Math.Round(
                    data.Length / 1024.0 / (timeAfterDownloadingFile - timeBeforeDownloadingFile).TotalSeconds, 2));
     }
     catch
     {
         NotificationsHelper.DisplayMessage(Messages.NoInternet);
         return(0d);
     }
 }
Exemple #3
0
 public static void ExecuteCommand(string command)
 {
     if (IsLinux())
     {
         ExecuteCommandForLinux(command);
     }
     else if (IsWindows())
     {
         ExecuteCommandForWindows("");
     }
     else if (IsMac())
     {
         ExecuteCommandForMac("");
     }
     else
     {
         NotificationsHelper.DisplayMessage(Messages.OsNotDetected);
     }
 }
Exemple #4
0
 public static void Sleep()
 {
     if (!CommandsHelper.ShouldSleep())
     {
         return;
     }
     if (IsLinux())
     {
         ExecuteCommandForLinux("systemctl suspend");
     }
     else if (IsWindows())
     {
         ExecuteCommandForWindows("");
     }
     else if (IsMac())
     {
         ExecuteCommandForMac("");
     }
     else
     {
         NotificationsHelper.DisplayMessage(Messages.OsNotDetected);
     }
 }