public void Init(Rect rect, BackendData backendData) { if (this.m_TreeView == null) { ITreeViewDataSource source; this.m_BackendData = backendData; TreeViewState treeViewState = new TreeViewState { columnWidths = new float[] { 250f, 90f, 93f, 98f, 74f, 78f } }; this.m_TreeView = new TreeView(this.m_EditorWindow, treeViewState); ITreeViewGUI gui = new TestGUI(this.m_TreeView); ITreeViewDragging dragging = new TestDragging(this.m_TreeView, this.m_BackendData); if (this.m_Lazy) { source = new LazyTestDataSource(this.m_TreeView, this.m_BackendData); } else { source = new TestDataSource(this.m_TreeView, this.m_BackendData); } this.m_TreeView.Init(rect, source, gui, dragging); this.m_ColumnHeader = new TreeViewColumnHeader(); this.m_ColumnHeader.columnWidths = treeViewState.columnWidths; this.m_ColumnHeader.minColumnWidth = 30f; this.m_ColumnHeader.columnRenderer = (Action<int, Rect>) Delegate.Combine(this.m_ColumnHeader.columnRenderer, new Action<int, Rect>(this.OnColumnRenderer)); } }
private void TestTreeWithCustomItemHeights() { Rect rect = new Rect(0f, 0f, base.position.width, base.position.height); if (this.m_TreeViewWithCustomHeight == null) { this.m_BackendData2 = new BackendData(); this.m_BackendData2.GenerateData(300); this.m_TreeViewWithCustomHeight = new TreeViewTestWithCustomHeight(this, this.m_BackendData2, rect); } this.m_TreeViewWithCustomHeight.OnGUI(rect); }
public TreeViewTestWithCustomHeight(EditorWindow editorWindow, BackendData backendData, Rect rect) { this.m_BackendData = backendData; TreeViewState treeViewState = new TreeViewState(); this.m_TreeView = new TreeViewController(editorWindow, treeViewState); TestGUICustomItemHeights gui = new TestGUICustomItemHeights(this.m_TreeView); TestDragging dragging = new TestDragging(this.m_TreeView, this.m_BackendData); TestDataSource data = new TestDataSource(this.m_TreeView, this.m_BackendData); data.onVisibleRowsChanged = (Action) Delegate.Combine(data.onVisibleRowsChanged, new Action(gui, (IntPtr) this.CalculateRowRects)); this.m_TreeView.Init(rect, data, gui, dragging); data.SetExpanded(data.root, true); }
static void Main(string[] args) { // The code provided will print ‘Hello World’ to the console. // Press Ctrl+F5 (or go to Debug > Start Without Debugging) to run your app. Console.WriteLine("Hello World!"); Console.WriteLine(BackendData.get_Current_Player().FirstName.ToString()); Console.ReadKey(); // Go to http://aka.ms/dotnet-get-started-console to continue learning how to build a console app! }
private void txtSearch_KeyDown(object sender, KeyEventArgs e) { string etr = e.Key.ToString(); if (etr == "Return") { if (txtSearch.Text != "") { //get the searched for player BackendData.get_player_search(txtSearch.Text); Update_Screen(); } } }
private void TestLargeTreesWithFixedItemHeightAndPingingAndFraming() { Rect rect = new Rect(0f, 0f, base.position.width / 2f, base.position.height); Rect rect4 = new Rect(base.position.width / 2f, 0f, base.position.width / 2f, base.position.height); if (this.m_TreeViewTest == null) { this.m_BackendData = new BackendData(); this.m_BackendData.GenerateData(0xf4240); bool lazy = false; this.m_TreeViewTest = new TreeViewTest(this, lazy); this.m_TreeViewTest.Init(rect, this.m_BackendData); lazy = true; this.m_TreeViewTest2 = new TreeViewTest(this, lazy); this.m_TreeViewTest2.Init(rect4, this.m_BackendData); } this.m_TreeViewTest.OnGUI(rect); this.m_TreeViewTest2.OnGUI(rect4); EditorGUI.DrawRect(new Rect(rect.xMax - 1f, 0f, 2f, base.position.height), new Color(0.4f, 0.4f, 0.4f, 0.8f)); }
public MainWindow() { InitializeComponent(); BackendData.Update_Data(); lblCurrentWeek.Content = "Game Week: " + BackendData.fantasyPlayer.Game_Week; lblPlayerCount.Content = BackendData.numberOfCurrentPlayer.ToString() + " Of " + BackendData.numberOfPlayers.ToString(); //Add items to listbox cmbSelectFilter.Items.Add("All"); cmbSelectFilter.Items.Add("DreamTeam"); cmbSelectFilter.Items.Add("GoalKeeper"); cmbSelectFilter.Items.Add("Defender"); cmbSelectFilter.Items.Add("Midfielder"); cmbSelectFilter.Items.Add("Forward"); foreach (string t in BackendData.Get_List_Of_Teams()) { cmbSelectFilter.Items.Add(t); } Update_Screen(); }
private void btnCreateDatabase_Click(object sender, RoutedEventArgs e) { BackendData.Create_Database(); }
private static void Main(string[] args) { #if DEBUG Console.WriteLine("Anwendung wird im Debug Modus gestartet!"); #else Console.WriteLine("Anwendung wird im Produktiv Modus gestartet!"); #endif #if !DEBUG Console.WriteLine(Dns.GetHostEntry("172.18.0.2").HostName); Console.WriteLine(Dns.GetHostAddresses(Dns.GetHostEntry("172.18.0.2").HostName)[0].ToString()); #endif Logging.ErrorAction = Error; Logging.LogAction = (time, s, arg3, arg4) => WriteLog(s, arg3, arg4, time); UI.HeadHtml = "<script src=\"https://code.jquery.com/jquery-3.3.1.min.js\" crossorigin=\"anonymous\"></script>"; UI.HeadHtml += "<script src=\"https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js\" integrity=\"sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49\" crossorigin=\"anonymous\"></script>"; UI.HeadHtml += "<script src=\"https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js\" integrity=\"sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T\" crossorigin=\"anonymous\"></script>"; UI.HeadHtml += "<link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css\" integrity=\"sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB\" crossorigin=\"anonymous\">"; UI.HeadHtml += "<link rel=\"stylesheet\" href=\"https://use.fontawesome.com/releases/v5.1.0/css/all.css\" integrity=\"sha384-lKuwvrZot6UHsBSfcMvOkWwlCMgc0TaWr+30HWe3a4ltaBwTZhyTEggF5tJv8tbt\" crossorigin=\"anonymous\">"; BackendData.Setup(new Dictionary <string, BackendProperty>() { { "Humidity", new BackendProperty("", false) }, { "Settings", new BackendProperty("", false) }, { "Manual", new BackendProperty("", false) }, { "Overview", new BackendProperty("", false) }, { "ManualActionExecution", new BackendProperty("", false) }, { "History", new BackendProperty("", false) }, { "Channels", new BackendProperty("", false) } }); #region WateringWeb new SettingsPagePublisher("/settings").Publish(); new ChannelsPagePublisher("/channels").Publish(); new OverviewPagePublisher("/overview").Publish(); new ManualPagePublisher("/manual").Publish(); new HistoryPagePublisher("/history").Publish(); UI.PublishJson("/settings/WeatherLocations.json", () => { Assembly assembly = Assembly.GetExecutingAssembly(); //Assembly.GetExecutingAssembly().GetManifestResourceNames(); string resourceName = "TabNoc.PiWeb.Storage.external_WeatherLocations.WeatherLocations.json"; using (Stream stream = assembly.GetManifestResourceStream(resourceName)) using (StreamReader reader = new StreamReader(stream, Encoding.Default)) { return(reader.ReadToEnd()); } }); UI.PublishJson("/lib/bootstrap3-typeahead.min.js", () => { Assembly assembly = Assembly.GetExecutingAssembly(); //Assembly.GetExecutingAssembly().GetManifestResourceNames(); string resourceName = "TabNoc.PiWeb.Storage.lib.bootstrap3-typeahead.min.js"; using (Stream stream = assembly.GetManifestResourceStream(resourceName)) using (StreamReader reader = new StreamReader(stream, Encoding.Default)) { return(reader.ReadToEnd()); } }); #endregion WateringWeb #region PiWeb new PiWebPublisher("/").Publish(); #endregion PiWeb Logging.WriteLog("System", "OK", "PiWebSite wurde gestartet!"); Console.ReadLine(); PageStorage <ChannelsData> .Instance.Dispose(); PageStorage <SettingsData> .Instance.Dispose(); }
public FooTreeViewItem(int id, int depth, TreeViewItem parent, string displayName, BackendData.Foo foo) : base(id, depth, parent, displayName) { this.foo = foo; }
private void btnPrevious_Click(object sender, RoutedEventArgs e) { BackendData.decrement_Player(); Update_Screen(); }
private void btnDestroy_Click(object sender, RoutedEventArgs e) { BackendData.Destroy_Database(); }
private void Update_Screen() { Element currentPlayer = BackendData.get_Current_Player(); //string playerImage = @"C:\Home\dropbox\fantasyfootball\Photos\" + BackendData.get_Current_Player_Code() + ".png"; try { Image screenImage = new Image(); BitmapImage playerImage = new BitmapImage(); string picfile = @"C:\Home\dropbox\fantasyfootball\Photos\" + BackendData.get_Current_Player_Code() + ".png"; lblPhotoFile.Content = picfile; playerImage.BeginInit(); playerImage.UriSource = new Uri(picfile, UriKind.Absolute); playerImage.EndInit(); imgPlayer.Source = playerImage; } catch (Exception imageException) { Image screenImage = new Image(); BitmapImage playerImage = new BitmapImage(); string picfile = noPicFile; lblPhotoFile.Content = picfile; playerImage.BeginInit(); playerImage.UriSource = new Uri(picfile, UriKind.Absolute); playerImage.EndInit(); imgPlayer.Source = playerImage;; }; lblPlayerCount.Content = BackendData.numberOfCurrentPlayer.ToString() + " Of " + BackendData.numberOfPlayers.ToString(); var temp = Encoding.UTF8.GetBytes(currentPlayer.FirstName.ToString()); lblFirstName.Content = (currentPlayer.FirstName); lblSecondName.Content = currentPlayer.SecondName; lblTeam.Content = BackendData.Get_Team_Name(); lblTotalPoints.Content = "Total Points: " + currentPlayer.TotalPoints; if (currentPlayer.TotalPoints > 0) { lblAverageMinutes.Content = "Avg. Minutes : " + (currentPlayer.Minutes / Convert.ToDecimal(BackendData.Get_Games_Played())).ToString("0"); } else { lblAverageMinutes.Content = "Avg. minutes : 0"; } lblPosition.Content = BackendData.Get_Player_Position(); lblValue.Content = "Value: " + (currentPlayer.NowCost); lblPPG.Content = "Points Per Game: " + currentPlayer.PointsPerGame.ToString(); DateTimeOffset?date1 = (currentPlayer.NewsAdded); lblChanceOfPlaying.Content = (String.Format("{0:dd/MMM/yyyy}", date1) + " - " + currentPlayer.News); lblPPPM.Content = "PPPM(PTP): " + ((BackendData.Calculate_PPPM()).ToString("0.##") + "(" + BackendData.Calculate_PTP().ToString("0")) + ")"; if (currentPlayer.TotalPoints > 0) { lblGamesPlayed.Content = "No Of Games: " + BackendData.Get_Games_Played().ToString("0"); } else { lblGamesPlayed.Content = "No Of Games: N/A"; } lblPPW.Content = "Points Per Week: " + ((currentPlayer.TotalPoints) / Convert.ToDecimal(BackendData.fantasyPlayer.Game_Week)).ToString("0.#"); }
private void mnuUpdatePhotos_Click(object sender, RoutedEventArgs e) { BackendData.Download_Photos(); }
private void cmbSelectFilter_SelectionChanged(object sender, SelectionChangedEventArgs e) { BackendData.filter_Players(cmbSelectFilter.SelectedItem.ToString()); Update_Screen(); }
public SettingsPage(PageStorage <SettingsData> settingsData) : base("div") { bool useSafeLoading = false; if (settingsData.TryLoad() == false) { settingsData.UseSafeLoading(); useSafeLoading = true; } if (PageStorage <HumiditySensorData> .Instance.TryLoad() == false) { PageStorage <HumiditySensorData> .Instance.UseSafeLoading(); useSafeLoading = true; } this.AddScriptDependency("/lib/bootstrap3-typeahead.min.js"); const int labelSize = 180; _settingsData = settingsData; #region Initialize Grid Container wrappingContainer = new Container(this); Grid grid = new Grid(wrappingContainer); grid.AddStyling(StylingOption.MarginRight, 2); grid.AddStyling(StylingOption.MarginLeft, 2); grid.AddStyling(StylingOption.MarginTop, 4); grid.AddStyling(StylingOption.MarginBottom, 2); #endregion Initialize Grid if (useSafeLoading) { grid.AddRow().AppendCollum(new Heading(3, "Wegen Verbindungsproblemem wurden keine Daten geladen!") { Style = { Color = Color.Red } }); } #region AutoEnabled MultiInputGroup autoEnabledMultiInputGroup = new MultiInputGroup(); autoEnabledMultiInputGroup.AppendLabel("Automatik", labelSize); autoEnabledMultiInputGroup .AppendCustomElement( new TwoStateButtonGroup("Aktiv", "Inaktiv", settingsData.StorageData.Enabled, !settingsData.StorageData.Enabled), false).FirstButtonStateChange += (sender, args) => settingsData.StorageData.Enabled = args.NewButtonState; autoEnabledMultiInputGroup.AddStyling(StylingOption.MarginBottom, 2); autoEnabledMultiInputGroup.AppendCustomElement(new Button(StylingColor.Danger, true, Button.ButtonSize.Normal, false, "Alle Kanäle ausschalten", fontAwesomeIcon: "stop"), false).Click += (sender, args) => { ServerConnection.DeleteAsync("settings", "stopall"); }; grid.AddRow().AppendCollum(autoEnabledMultiInputGroup, autoSize: true); #endregion AutoEnabled #region WeatherEnabled MultiInputGroup weatherEnabledMultiInputGroup = new MultiInputGroup(); weatherEnabledMultiInputGroup.AppendLabel("Wetterdaten verwenden", labelSize); weatherEnabledMultiInputGroup .AppendCustomElement( new TwoStateButtonGroup("Aktiv", "Inaktiv", settingsData.StorageData.WeatherEnabled, !settingsData.StorageData.WeatherEnabled), false).FirstButtonStateChange += (sender, args) => settingsData.StorageData.WeatherEnabled = args.NewButtonState; weatherEnabledMultiInputGroup.AddStyling(StylingOption.MarginBottom, 2); grid.AddRow().AppendCollum(weatherEnabledMultiInputGroup, autoSize: true); #endregion WeatherEnabled #region Location Row locationRow = grid.AddRow(); locationRow.AddStyling(StylingOption.MarginBottom, 2); MultiInputGroup weatherLocationMultiInputGroup = new MultiInputGroup(); weatherLocationMultiInputGroup.AppendLabel("Standort", labelSize); StylableTextInput weatherLocationTextInput = weatherLocationMultiInputGroup.AppendTextInput("Bitte Eintragen...", false); weatherLocationTextInput.Value = settingsData.StorageData.LocationFriendlyName; #region Hidden TextInputs TextInput weatherLocationChangeTextInput = new TextInput { IsHidden = true, Value = settingsData.StorageData.Location }; locationRow.AppendChild(weatherLocationChangeTextInput); TextInput weatherLocationNameChangeTextInput = new TextInput { IsHidden = true, Value = settingsData.StorageData.LocationFriendlyName }; locationRow.AppendChild(weatherLocationNameChangeTextInput); #endregion Hidden TextInputs #region Autocomplete weatherLocationTextInput.ActivateAutocomplete("/settings/WeatherLocations.json", new Dictionary <string, TextInput>() { { "location", weatherLocationChangeTextInput }, { "name", weatherLocationNameChangeTextInput } }); #endregion Autocomplete locationRow.AppendCollum(weatherLocationMultiInputGroup, autoSize: true); #region Save Button Button saveLocationButton = new Button(StylingColor.Success, true, text: "Übernehmen"); saveLocationButton.Click += (sender, args) => { if (weatherLocationChangeTextInput.Value == "") { weatherLocationTextInput.SetValidation(false, true); } else { weatherLocationTextInput.SetValidation(false, false); settingsData.StorageData.Location = weatherLocationChangeTextInput.Value; settingsData.StorageData.LocationFriendlyName = weatherLocationNameChangeTextInput.Value; weatherLocationTextInput.Value = settingsData.StorageData.LocationFriendlyName; } }; locationRow.AppendCollum(saveLocationButton, autoSize: true); #endregion Save Button #endregion Location #region Override _overrideInputGroup = new OverrideInputGroup(_settingsData.StorageData.OverrideValue, labelSizeInPx: labelSize); grid.AddRow().AppendCollum(_overrideInputGroup, autoSize: true); #endregion Override #region Rename HumiditySensors Row humidityRow = grid.AddRow(); humidityRow.AppendChild(new Heading(3, "Feuchigkeitssensoren Umbenennen")); humidityRow.AddNewLine(); #region Sync Server HumidityList with Storage foreach (string humiditySensor in PageStorage <HumiditySensorData> .Instance.StorageData.HumiditySensors) { if (settingsData.StorageData.HumiditySensors.ContainsKey(humiditySensor) == false) { settingsData.StorageData.HumiditySensors.Add(humiditySensor, humiditySensor); } } List <string> removeList = new List <string>(); foreach ((string realSensorName, string _) in settingsData.StorageData.HumiditySensors) { if (PageStorage <HumiditySensorData> .Instance.StorageData.HumiditySensors.Contains(realSensorName) == false) { removeList.Add(realSensorName); } } foreach (string s in removeList) { settingsData.StorageData.HumiditySensors.Remove(s); } #endregion Sync Server HumidityList with Storage _humidityDropdown = new Dropdown(new Button(StylingColor.Secondary, true, widthInPx: 150)); humidityRow.AppendCollum(_humidityDropdown, autoSize: true); foreach (string humiditySensor in PageStorage <HumiditySensorData> .Instance.StorageData.HumiditySensors) { StylableAnchor stylableAnchor = _humidityDropdown.AddEntry(humiditySensor); stylableAnchor.Click += (sender, args) => SelectHumiditySensor(humiditySensor); } _humiditySensorTextInputGroup = new TextInputGroup("Freundlicher Name", "Bitte Eingeben!"); humidityRow.AppendCollum(_humiditySensorTextInputGroup, autoSize: true); Button button = new Button(StylingColor.Success, true, text: "Übernehmen"); button.Click += (sender, args) => { if (_humidityDropdown.Button.Text != "") { _settingsData.StorageData.HumiditySensors[_humidityDropdown.Button.Text] = _humiditySensorTextInputGroup.TextInput.Value; } }; humidityRow.AppendCollum(button, autoSize: true); if (PageStorage <HumiditySensorData> .Instance.StorageData.HumiditySensors.Count > 0) { SelectHumiditySensor(PageStorage <HumiditySensorData> .Instance.StorageData.HumiditySensors.First()); } else { humidityRow.IsHidden = true; } humidityRow.AddStyling(StylingOption.MarginBottom, 2); #endregion Rename HumiditySensors #region Backend Server Path grid.AddRow().AppendCollum(new Heading(3, "Backend Server Schnittstelle einstellen") { ClassName = "text-center mb-4" }); Row backendServerRow = grid.AddRow(); Row backendServerConfigurationSingeApiRow = grid.AddRow(); Row backendServerConfigurationMultiApiRow = grid.AddRow(); backendServerRow.AddNewLine(); BackendData backendInstanceStorageData = PageStorage <BackendData> .Instance.StorageData; MultiInputGroup backendConfigurationSourceSwitchingMultiInputGroup = backendServerRow.AppendCollum(new MultiInputGroup()); backendConfigurationSourceSwitchingMultiInputGroup.AppendLabel("Quelle Auswählen", labelSize); TwoStateButtonGroup backendConfigurationSourceSwitchingTwoStateButton = backendConfigurationSourceSwitchingMultiInputGroup.AppendCustomElement(new TwoStateButtonGroup("Sammelkonfiguration", "einzele Konfiguration", !backendInstanceStorageData.SingleApiConfiguration, backendInstanceStorageData.SingleApiConfiguration), false); void OnBackendConfigurationSourceSwitchingTwoStateButtonOnFirstButtonStateChange(object sender, ButtonChangeEventHandlerArgs args) { if (args.NewButtonState == true) { backendServerConfigurationSingeApiRow.Style.Display = "none"; backendServerConfigurationMultiApiRow.Style.Display = null; } else { backendServerConfigurationSingeApiRow.Style.Display = null; backendServerConfigurationMultiApiRow.Style.Display = "none"; } backendInstanceStorageData.SingleApiConfiguration = !args.NewButtonState; } backendConfigurationSourceSwitchingTwoStateButton.FirstButtonStateChange += OnBackendConfigurationSourceSwitchingTwoStateButtonOnFirstButtonStateChange; OnBackendConfigurationSourceSwitchingTwoStateButtonOnFirstButtonStateChange(null, new ButtonChangeEventHandlerArgs(false, !backendInstanceStorageData.SingleApiConfiguration)); backendConfigurationSourceSwitchingMultiInputGroup.AddStyling(StylingOption.MarginBottom, 5); #region backendServerConfigurationSingeApiRow foreach ((string name, BackendProperty backedProperties) in backendInstanceStorageData.BackendProperties) { backendServerConfigurationSingeApiRow.AddNewLine(); backendServerConfigurationSingeApiRow.AppendCollum(CreateSingleBackendCollum(name, backedProperties), autoSize: true); } backendServerConfigurationSingeApiRow.AddNewLine(); backendServerConfigurationSingeApiRow.AddNewLine(); backendServerConfigurationSingeApiRow.AppendCollum(new Button(StylingColor.Light, false, Button.ButtonSize.Normal, false, "Standardkonfiguration eintragen")).Click += (sender, args) => { foreach ((string name, BackendProperty _) in backendInstanceStorageData.BackendProperties) { if (_backendPathTextInputDictionary[name].Value == "") { _backendPathTextInputDictionary[name].Value = $"http://{Dns.GetHostAddresses("WebPiServer.PiWeb")[0].ToString()}:5000/api/{name}"; } } }; #endregion backendServerConfigurationSingeApiRow #region backendServerConfigurationMultiApiRow backendServerConfigurationMultiApiRow.AppendCollum(CreateMultiBackendCollum(backendInstanceStorageData, out StylableTextInput backendServerConfigurationMultiApiTextInput), autoSize: true); backendServerConfigurationMultiApiRow.AddNewLine(); backendServerConfigurationMultiApiRow.AppendCollum(new Button(StylingColor.Light, false, Button.ButtonSize.Normal, false, "Standardkonfiguration eintragen")).Click += (sender, args) => { if (backendServerConfigurationMultiApiTextInput.Value == "") { backendServerConfigurationMultiApiTextInput.Value = $"http://{Dns.GetHostAddresses("WebPiServer.PiWeb")[0].ToString()}:5000/api"; } }; #endregion backendServerConfigurationMultiApiRow #endregion Backend Server Path }
private MultiInputGroup CreateMultiBackendCollum(BackendData backendData, out StylableTextInput backendPath) { MultiInputGroup backendMultiInputGroup = new MultiInputGroup(); backendMultiInputGroup.AppendLabel("Server Api Pfad", 115 + 80); TwoStateButtonGroup backendEnabled = backendMultiInputGroup.AppendCustomElement(new TwoStateButtonGroup("Vom Server", "Als Debug", backendData.MultiApiRequestDataFromBackend, !backendData.MultiApiRequestDataFromBackend), false); backendPath = backendMultiInputGroup.AppendTextInput("Pfad zur WebAPI", startText: backendData.MultiApiDataSourcePath); backendMultiInputGroup.AppendValidation("Einstellungen OK", "Einstellungen sind nicht OK", false); Button backendSaveSettings = backendMultiInputGroup.AppendCustomElement(new Button(StylingColor.Success, true, text: "Speichern", fontAwesomeIcon: "save"), false); StylableTextInput path = backendPath; backendSaveSettings.Click += (sender, args) => { path.SetValidation(false, false); if (backendEnabled.FirstButtonActive && Uri.IsWellFormedUriString(path.Value, UriKind.Absolute)) { foreach ((string name, BackendProperty _) in backendData.BackendProperties) { try { if (JsonConvert.DeserializeObject <bool>(new HttpClient().GetAsync(path.Value + "/" + name + "/enabled").EnsureResultSuccessStatusCode().Result.Content.ReadAsStringAsync().Result) == false) { //TODO: ich brauche eine Messagebox path.Value = "Der Server hat diese API verweigert! Pfad:" + path.Value; throw new Exception(path.Value); } } catch (Exception e) { path.Value = "Der Verbindungsversuch ist fehlgeschlagen! Pfad:" + path.Value; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Beim Versuch die neuen BackendEinstellungen zu Testen ist ein Fehler aufgetreten."); Console.ResetColor(); Logging.WriteLog("System", "Warn", $"Beim Versuch die Backendeinstellungen für {name} des Servers zu validieren ist es zu folgendem Fehler gekommen:\r\n{e.Message}"); path.SetValidation(false, true); //TODO: ich brauche eine Messagebox return; } } path.SetValidation(true, false); backendData.MultiApiRequestDataFromBackend = backendEnabled.FirstButtonActive; backendData.MultiApiDataSourcePath = path.Value; } else if (backendEnabled.SecondButtonActive) { path.SetValidation(true, false); backendData.MultiApiRequestDataFromBackend = backendEnabled.FirstButtonActive; } else { path.SetValidation(false, true); } }; backendMultiInputGroup.AddStyling(StylingOption.MarginBottom, 2); return(backendMultiInputGroup); }
private void btnNext_Click(object sender, RoutedEventArgs e) { BackendData.increment_Player(); Update_Screen(); }