private void SaveServiceSettings(ServiceSettings serviceSettings) { _serviceSettings = serviceSettings; string settingFile = Utils.GetPath(PathType.Settings) + Constants.Settings.ServiceSettingsFileName; Utilities.FileWrite(settingFile, ServerBaseControl.ConvertToJson <ServiceSettings>(_serviceSettings)); _serviceDataThread.MonitorDisks = _serviceSettings.Find(Constants.Settings.MonitorDisks).GetValue <bool>(); _serviceDataThread.MonitorNetwork = _serviceSettings.Find(Constants.Settings.MonitorNetworks).GetValue <bool>(); }
public PrimaryService() { MessageServerLogin = true; InitializeComponent(); LoadServiceSettings(); LoadEmailSettings(); _serviceDataThread = new LocalServiceDataThread(); _serviceDataThread.OnNewServerDetails += ServerDataThread_OnNewServerDetails; _serviceDataThread.MonitorDisks = _serviceSettings.Find(Constants.Settings.MonitorDisks).GetValue <bool>(); _serviceDataThread.MonitorNetwork = _serviceSettings.Find(Constants.Settings.MonitorNetworks).GetValue <bool>(); ThreadManager.ThreadStart(_serviceDataThread, Constants.Service.ThreadLocalDataMonitoring, System.Threading.ThreadPriority.Lowest); _notifyRunAsApp.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location); _pluginManager = new PluginManager(this, this, this, this); _pluginManager.LoadServices(); ProcessParams.PostProcessAllParams(_pluginManager); }
public void SendMessage(string senderEmail, string recipientEmail, string title, string message, bool urgent) { try { Email email = new Email(_SmtpServer.Find(Constants.Settings.SmtpSenderEmail).GetValue <string>(), _SmtpServer.Find(Constants.Settings.SmtpHost).GetValue <string>(), _SmtpServer.Find(Constants.Settings.SmtpUsername).GetValue <string>(), _SmtpServer.Find(Constants.Settings.SmtpPassword).GetValue <string>(), _SmtpServer.Find(Constants.Settings.SmtpPort).GetValue <int>(), _SmtpServer.Find(Constants.Settings.SmtpSSL).GetValue <bool>()); email.SendEmail(senderEmail, recipientEmail, recipientEmail, message, title, message.Contains("<html>")); } catch (Exception error) { AddToLog(error, "Send Email"); } }