/// <summary> /// Loads the state of all stored sections. /// </summary> public static void Load() { if (!SettingHandler.Exists("SectionLibrary.xml")) { return; } GetAllSections().ForEach(s => { if (s.Window != null) { Object.Destroy(s.Window); } }); SettingHandler handler = SettingHandler.Load("SectionLibrary.xml", new[] { typeof(List <SectionModule>), typeof(SectionModuleTS) }); StockSections = handler.Get("StockSections", StockSections); TrackingStationSection = handler.Get("TrackingStation", TrackingStationSection); CustomSections = handler.Get("CustomSections", CustomSections); foreach (SectionModule section in GetAllSections()) { section.ClearNullReadouts(); } }
public IActionResult Contact([FromForm] ContactModel model) { var system = new SystemModel(_settingHandler.Get(new[] { SettingName.Title, SettingName.ContactEmail })); if (model != null) { var contactEmail = system.Settings[SettingName.ContactEmail]; EmailSender.Send(_azureSettings.SendgridApiKey, $"{system.Settings[SettingName.Title]} - {model.Type} - {model.Email}", MakeMessage(model), contactEmail, model.Email, model.Attachment == null || model.Attachment.Length == 0 ? null : new[] { model.Attachment }); } return(Ok()); }
/// <summary> /// Loads the settings when this object is created. /// </summary> private void Load() { try { SettingHandler handler = SettingHandler.Load("BuildAdvanced.xml"); handler.Get("visible", ref visible); position.x = handler.Get("windowPositionX", position.x); position.y = handler.Get("windowPositionY", position.y); handler.Get("compactMode", ref compactMode); handler.Get("compactCollapseRight", ref compactCollapseRight); handler.Get("showAllStages", ref showAllStages); handler.Get("showAtmosphericDetails", ref showAtmosphericDetails); handler.Get("showSettings", ref showSettings); CelestialBodies.SetSelectedBody(handler.Get("selectedBodyName", CelestialBodies.SelectedBody.Name)); } catch (Exception ex) { MyLogger.Exception(ex, "BuildAdvanced.Load()"); } }
public SystemController(FoodTruckContext context, AzureSettings azureSettings) : base(context) { _azureSettings = azureSettings; _handler = new SubscriptionHandler(_context); _settingHandler = new SettingHandler(_context); _settings = new SystemModel(_settingHandler.Get(new[] { SettingName.Title, SettingName.ContactEmail, SettingName.TwilioAuthToken, SettingName.TwilioPhoneNumber, SettingName.TwilioSid, SettingName.OrderNotificationEmails, SettingName.Location })); }
/// <summary> /// Loads config /// </summary> private static void LoadReadoutConfig() { try { SettingHandler handler = SettingHandler.Load("ReadoutsConfig.xml", new Type[] { typeof(ReadoutModuleConfigNode) }); foreach (ReadoutModule readout in readouts) { ReadoutModuleConfigNode r = handler.Get <ReadoutModuleConfigNode>(readout.Name, null); if (r != null) { readout.ValueStyle.normal.textColor = r.Color; } } handler.Save("ReadoutsConfig.xml"); } catch (Exception ex) { MyLogger.Exception(ex); } }
public static void RemoveReadoutConfig(ReadoutModule readout) { try { SettingHandler handler = SettingHandler.Load("ReadoutsConfig.xml", new Type[] { typeof(ReadoutModuleConfigNode) }); var r = handler.Get <ReadoutModuleConfigNode>(readout.Name, null); if (r == null) { return; } handler.Items.Remove(handler.Items.Find(i => i.Name == readout.Name)); handler.Save("ReadoutsConfig.xml"); } catch (Exception ex) { MyLogger.Exception(ex); } }
public static void SaveReadoutConfig(ReadoutModule readout) { try { SettingHandler handler = SettingHandler.Load("ReadoutsConfig.xml", new Type[] { typeof(ReadoutModuleConfigNode) }); var r = handler.Get <ReadoutModuleConfigNode>(readout.Name, null); if (r == null) { r = new ReadoutModuleConfigNode(); } r.Name = readout.Name; r.Color = readout.ValueStyle.normal.textColor; handler.Set(r.Name, r); handler.Save("ReadoutsConfig.xml"); } catch (Exception ex) { MyLogger.Exception(ex); } }