public static void Main() { if (Environment.OSVersion.Version.Major >= 6) { SetProcessDPIAware(); } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); directDeviceInitialized = false; mainWindow = new MainWindow(); directDevice = new BaseNode(); radioDevices = new List <RadioNode>(); radioDevices.Add(new RadioNode(1)); SettingHandler.Load(); logger = new Logger("log_", "txt"); connectionDialog = new ConnectionDialog(); mainWindow.FlowLayout.Controls.Add(directDevice.GroupBox); mainWindow.FlowLayout.Controls.Add(radioDevices[0].GroupBox); directDevice.GroupBox.Enabled = false; mainWindow.AddControl(logger.Interface); SetBigChartData(radioDevices[0].GroupBox.PowerChart); connectionDialog.Show(); Application.Run(mainWindow); }
public PaymentController(FoodTruckContext context, AzureSettings azureSettings) : base(context) { _handler = new OrderHandler(context, "system"); _azureSettings = azureSettings; _settingHandler = new SettingHandler(context); _squareLocations = new SquareLocationHandler(context, "system").GetAll(); }
private async void Submit_Click(object sender, RoutedEventArgs e) { Localclient = new Client(); SettingHandler.SetIpPort(TbIpPort.Text); if (TextBoxEmail.Text.Length == 0) { Errormessage.Text = "Bitte Email-Addresse eingeben"; TextBoxEmail.Focus(); } else if (!Regex.IsMatch(TextBoxEmail.Text, @"^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$")) { Errormessage.Text = "Bitte eine gültige EMail-Addresse eingeben"; TextBoxEmail.Select(0, TextBoxEmail.Text.Length); TextBoxEmail.Focus(); } else { var sc = ServerConnection.CurrentInstance ?? new ServerConnection(); Localclient.UserName = TextBoxUserName.Text; Localclient.EMail = TextBoxEmail.Text; Localclient.EncPassword = new Encryption(PasswordBox1.Password).EncryptStringToBytes(PasswordBox1.Password); if (await sc.TryReg(Localclient)) { Errormessage.Text = "Erfolgreich Registriert"; } //TODOLOW: Needs a Close for the Reg Connection } }
protected void Application_Start(object sender, EventArgs e) { GlobalHandlers.DatabaseHandler = DatabaseHandler.create(config.handlers.instances.Type.MySQL); GlobalHandlers.SessionHandler = SessionHandler.create(); GlobalHandlers.SettingHandler = SettingHandler.create(); GlobalHandlers.ProtectionHandler = ProtectionHandler.create(); GlobalHandlers.Debugger = GlobalDebugger.create(); GlobalHandlers.TimerHandlers = TimerHandlers.create(); GlobalHandlers.ViewerHandler = ViewerHandler.create(); if (GlobalHandlers.DatabaseHandler.connect()) { Debug.WriteLine("[DatabaseHandler]: Database connected successfully"); } else { Debug.WriteLine("[DatabaseHandler]: Database failed to connect"); GlobalHandlers.Debugger.write("Database failed to connect"); } GlobalHandlers.DatabaseHandler.fillGlobalInformation(); GlobalHandlers.ViewerHandler.populateList(GlobalHandlers.DatabaseHandler.getViewers()); GlobalHandlers.TimerHandlers.startAllTimers(); GlobalHandlers.SettingHandler.setup(); GlobalHandlers.TileManager = TileManager.create(); GlobalHandlers.GCMHandler = GCMHandler.create(); GlobalHandlers.PowerschoolHandler = new config.handlers.features.powerschool.PowerschoolLoginHandler(); }
/// <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(); } }
/// <summary> /// Saves the settings when this object is destroyed. /// </summary> protected void OnDestroy() { MyLogger.Log("BuildAdvanced->OnDestroy"); try { SettingHandler handler = new SettingHandler(); handler.Set("visible", visible); handler.Set("windowPositionX", position.x); handler.Set("windowPositionY", position.y); handler.Set("compactMode", compactMode); handler.Set("compactCollapseRight", compactCollapseRight); handler.Set("showAllStages", showAllStages); handler.Set("showAtmosphericDetails", showAtmosphericDetails); handler.Set("showSettings", showSettings); handler.Set("selectedBodyName", CelestialBodies.SelectedBody.Name); handler.Save("BuildAdvanced.xml"); GuiDisplaySize.OnSizeChanged -= OnSizeChanged; } catch (Exception ex) { MyLogger.Exception(ex, "BuildAdvanced.OnDestroy()"); } EditorLock(false); }
private void LoadSettings() { _cfgfile = SettingHandler.GrabSettingFile(); TbFileDirectory.Text = XmlHandler.GrabXmlValue(_cfgfile, "DataFilePath"); TbImgDirectory.Text = XmlHandler.GrabXmlValue(_cfgfile, "PicFilePath"); CbStartMusic.IsChecked = !bool.Parse(XmlHandler.GrabXmlValue(_cfgfile, "TurnOffMusic")); }
/// <summary> /// Saves the state of all the stored sections. /// </summary> public static void SaveTS() { SettingHandler handler = new SettingHandler(); handler.Set("TrackingStation", TrackingStationSection); handler.Save("SectionLibraryTS.xml"); }
public IActionResult SwitchOrdering(string turn, string returnUrl) { var setting = new SettingHandler(_context).Get(new[] { SettingName.IsOrderingOn }).FirstOrDefault(); setting.Value = turn.ToUpper() == "ON" ? true.ToString() : false.ToString(); new Command.Settings.Update(_context, User.Identity.Name, setting.ToModel()).Execute(); return(Redirect($"https://{returnUrl}")); }
/// <summary> /// Saves the state of all the stored sections. /// </summary> public static void Save() { SettingHandler handler = new SettingHandler(); handler.Set("StockSections", StockSections); handler.Set("CustomSections", CustomSections); handler.Save("SectionLibrary.xml"); }
private void WindowClosing(object sender, EventArgs e) { DelayHandler.Stop(); SettingsWindow.Close(); timer.Stop(); Translate.Stop(); CefSharp.Cef.Shutdown(); SettingHandler.Close(); }
public static void SetEscapeCookie(string key, string keyValue, int expires) { HttpCookie httpCookie = new HttpCookie(key, EscapeHelper.escape(keyValue)); if (expires != 0) { httpCookie.Expires = DateTime.Now.AddDays((double)expires); } httpCookie.Domain = SettingHandler.GetNode("CookieDomain").InnerText; HttpContext.Current.Response.Cookies.Add(httpCookie); }
static FlightEngineerCore() { try { var handler = SettingHandler.Load("FlightEngineerCore.xml"); handler.Get("isCareerMode", ref isCareerMode); handler.Get("isKerbalLimited", ref isKerbalLimited); handler.Get("isTrackingStationLimited", ref isTrackingStationLimited); } catch (Exception ex) { MyLogger.Exception(ex); } }
/// <summary> /// Load the stack's state. /// </summary> private void Load() { try { var handler = SettingHandler.Load("DisplayStackTS.xml"); this.Hidden = handler.Get("hidden", this.Hidden); this.ShowControlBar = handler.Get("showControlBar", this.ShowControlBar); this.windowPosition.x = handler.Get("windowPositionX", this.windowPosition.x); this.windowPosition.y = handler.Get("windowPositionY", this.windowPosition.y); } catch (Exception ex) { MyLogger.Exception(ex, "DisplayStackTS->Load"); } }
public static void Save() { var handler = SettingHandler.Load("BuildOverlay.xml"); handler.Set("visible", Visible); handler.Set("namesOnly", BuildOverlayPartInfo.NamesOnly); handler.Set("clickToOpen", BuildOverlayPartInfo.ClickToOpen); handler.Set("vesselOpen", buildOverlayVessel.Open); handler.Set("resourcesOpen", buildOverlayResources.Open); handler.Set("vesselWindowX", buildOverlayVessel.WindowX); handler.Save("BuildOverlay.xml"); }
public static void Load() { if (!Directory.Exists(rootPath)) { Directory.CreateDirectory(rootPath); } foreach (var file in Directory.GetFiles(rootPath)) { var handler = SettingHandler.Load(file, new[] { typeof(Preset) }); presets.Add(handler.Get <Preset>("preset", null)); } }
public static void SetSOSCookie(string key, string value, int expires) { string keyValue = DESHelper.Encode(value, CookieHelper.EncryptKey); HttpCookie httpCookie = new HttpCookie(key, keyValue); httpCookie.Domain = SettingHandler.GetNode("CookieDomain").InnerText; if (expires != 0) { httpCookie.Expires = DateTime.Now.AddDays((double)expires); } HttpContext.Current.Response.Cookies.Add(httpCookie); }
/// <summary> /// Loads the help strings from file. /// </summary> private static void LoadHelpStrings() { try { SettingHandler handler = SettingHandler.Load("HelpStrings.xml"); foreach (ReadoutModule readout in readouts) { readout.HelpString = handler.GetSet(readout.Category + "." + readout.GetType().Name, readout.HelpString); } handler.Save("HelpStrings.xml"); } catch (Exception ex) { MyLogger.Exception(ex); } }
/// <summary> /// Saves the stack's state. /// </summary> private void Save() { try { var handler = new SettingHandler(); handler.Set("hidden", this.Hidden); handler.Set("showControlBar", this.ShowControlBar); handler.Set("windowPositionX", this.windowPosition.x); handler.Set("windowPositionY", this.windowPosition.y); handler.Save("DisplayStackTS.xml"); } catch (Exception ex) { MyLogger.Exception(ex, "DisplayStackTS->Save"); } }
void Start() { if (PlayerPrefs.GetInt("curScene", -1) != 0) { setting = transform.Find("/Canvas/Setting").GetComponent <SettingHandler>(); setting.gameObject.SetActive(true); Time.timeScale = 0; } else { Time.timeScale = 1; } InvokeRepeating("DropApple", 2f, appleDropInterval); }
static GuiDisplaySize() { try { var handler = SettingHandler.Load("GuiDisplaySize.xml"); handler.Set("multiplier", 1.1); increment = handler.GetSet("increment", increment); handler.Save("GuiDisplaySize.xml"); } catch (Exception ex) { MyLogger.Exception(ex, "GuiDisplaySize->GuiDisplaySize"); } offset = 1 + (increment * multiplier) - increment; }
public static void DoNotification(FoodTruckContext context, AdminAppSettings settings, AzureSettings azureSettings, OrderModel order, OrderHandler orderHandler) { orderHandler = orderHandler ?? new OrderHandler(context, "system"); var isTextOn = new SettingHandler(context).Get(new[] { SettingName.IsTextOn }).FirstOrDefault().Value.ToString().ToUpper().Equals("true", StringComparison.OrdinalIgnoreCase); Parallel.Invoke( () => NotificationEmail(settings, azureSettings, order), () => { if (isTextOn) { NotificationText(settings, order); } } ); orderHandler.Notify(order.Id); }
public void SendFile(FileMessage fileMsg) { MainWindow.CurrentInstance.UpdateFileReceive(); try { var fileStrm = new FileStream(XmlHandler.GrabXmlValue(SettingHandler.GrabSettingFile(), "DataFilePath") + fileMsg.FileName, FileMode.Create, FileAccess.ReadWrite); fileStrm.Write(fileMsg.Data, 0, fileMsg.Data.Length); fileStrm.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } MainWindow.CurrentInstance.UpdateFileReceive(true); }
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 })); }
public override void OnActionExecuting(ActionExecutingContext context) { base.OnActionExecuting(context); _handler = new SubscriptionHandler(_context); _eventHandler = new FoodTruck.Data.Distribution.Handlers.Events.EventHandler(_context, "system"); var settings = new SettingHandler(_context).Get(new[] { SettingName.TwilioAuthToken, SettingName.TwilioSid, SettingName.TwilioPhoneNumber }); _twilioAuthToken = settings.First(x => x.Name == SettingName.TwilioAuthToken).Value; _twilioSid = settings.First(x => x.Name == SettingName.TwilioSid).Value; _twilioPhone = settings.First(x => x.Name == SettingName.TwilioPhoneNumber).Value; }
private void DoCallback(int id, object value) { SettingHandler handler = null; handler = GetSettingHandler(id); if (handler != null) { handler.OnApplySetting(id, value.ToString()); } if (callbackDic.ContainsKey(id)) { if (callbackDic[id] != null) { callbackDic[id](); } } }
public static XDocument SetXmlValue(XDocument document, string element, string value) { var xElements = document?.Element("body")?.Elements().Where(xEle => xEle.Name == element); if (xElements == null) { return(document); } { foreach (var xEle in xElements) { xEle.Value = value; document.Save(SettingHandler.SettingPath()); } } return(document); }
/// <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 Save(Preset preset) { if (!Directory.Exists(rootPath)) { Directory.CreateDirectory(rootPath); } if (!Presets.Contains(preset)) { Presets.Add(preset); } var handler = new SettingHandler(); handler.Set("preset", preset); handler.Save(Path.Combine("../Presets", preset.FileName)); ScreenMessages.PostScreenMessage("Saved Preset: " + preset.Name, 2.0f, ScreenMessageStyle.UPPER_CENTER); }
/// <summary> /// Saves the stack's state. /// </summary> private void Save() { try { var handler = new SettingHandler(); handler.Set("hidden", this.Hidden); handler.Set("showControlBar", this.ShowControlBar); handler.Set("windowPositionX", this.windowPosition.x); handler.Set("windowPositionY", this.windowPosition.y); handler.Save("DisplayStack.xml"); } catch (Exception ex) { Logger.Exception(ex, "DisplayStack->Save"); } }
/// <summary> /// Saves the settings when this object is destroyed. /// </summary> protected void OnDestroy() { Logger.Log("BuildAdvanced->OnDestroy"); try { SettingHandler handler = new SettingHandler(); handler.Set("visible", visible); handler.Set("windowPositionX", position.x); handler.Set("windowPositionY", position.y); handler.Set("compactMode", compactMode); handler.Set("compactCollapseRight", compactCollapseRight); handler.Set("showAllStages", showAllStages); handler.Set("showAtmosphericDetails", showAtmosphericDetails); handler.Set("showSettings", showSettings); handler.Set("selectedBodyName", CelestialBodies.SelectedBody.Name); handler.Save("BuildAdvanced.xml"); GuiDisplaySize.OnSizeChanged -= OnSizeChanged; } catch (Exception ex) { Logger.Exception(ex, "BuildAdvanced.OnDestroy()"); } EditorLock(false); }