public void SendWeatherDaily(Object threadContext) { downloadweather(); //Main._Main.Timer.Enabled = false; //Variables.MailMan.WaitOne(); foreach (string email in GetWeatherEmailList()) { int Who = NM.FromWho(email); if (Who == -1) { NM.sendEmailHTML(email, "Nobody", "", "", true, true, ""); } else { string petorfirstname; if (Variables.Contacts[Who].Closeness >= 75) { petorfirstname = Variables.Contacts[Who].PetName; } else { petorfirstname = Variables.Contacts[Who].FirstName; } NM.sendEmailHTML(Variables.Contacts[Who].Email, Variables.Contacts[Who].FirstName + " " + Variables.Contacts[Who].LastName, "", "", true, true, petorfirstname); } } _doneEvent.Set(); }
public void CheckDriveforSystemSpace(Object threadContext) { DriveInfo[] allDrives = DriveInfo.GetDrives(); foreach (DriveInfo d in allDrives) { //Console.WriteLine(d.Name.ToUpper().Trim()); //Console.WriteLine("BINGO"); if (d.IsReady == true) { //Console.WriteLine(d.TotalFreeSpace); //Console.WriteLine(d.TotalSize); double ratio = Convert.ToDouble(d.TotalFreeSpace) / Convert.ToDouble(d.TotalSize); //Console.WriteLine(ratio); if (ratio < Variables.DriveSpaceFreePercent - 0.02) //0.01 is a gap { //give us a warning... foreach (string email in GetEmailList()) { int Who = NM.FromWho(email); if (Who == -1) { string MSG; MSG = string.Format("{0}, the drive {1} is now {2} availabe space. You need at least {3}MB free space. Please remove some or transfer to another drive. {0}. I'll check it again tomorrow.", "Nobody!", "I dont Know", ratio.ToString("P", (CultureInfo.InvariantCulture)), (d.TotalSize * Variables.DriveSpaceFreePercent / 1000000000).ToString("F", CultureInfo.InvariantCulture)); NM.sendEmailHTML(email, "Nobody", "HD Free Space limit", MSG, true); } else { string MSG; if (Variables.Contacts[Who].Closeness >= 75) { MSG = string.Format("{0}, the drive {1} is now {2} availabe space. You need at least {3}MB free space. Please remove some or transfer to another drive. {0}. I'll check it again tomorrow.", Variables.Contacts[Who].PetName, d.Name.ToUpper().Trim(), ratio.ToString("P", (CultureInfo.InvariantCulture)), (d.TotalSize * Variables.DriveSpaceFreePercent / 1000000000).ToString("F", CultureInfo.InvariantCulture)); } else { MSG = string.Format("{0}, the drive {1} is now {2} availabe space. You need at least {3}MB free space. Please remove some or transfer to another drive. {0}. I'll check it again tomorrow.", Variables.Contacts[Who].FirstName, d.Name.ToUpper().Trim(), ratio.ToString("P", (CultureInfo.InvariantCulture)), (d.TotalSize * Variables.DriveSpaceFreePercent / 1000000000).ToString("F", CultureInfo.InvariantCulture)); } NM.sendEmailHTML(Variables.Contacts[Who].Email, Variables.Contacts[Who].FirstName + " " + Variables.Contacts[Who].LastName, "HD Free Space limit", MSG, true); } } } } _doneEvent.Set(); } }