主要更新了http相关的内容

This commit is contained in:
2025-11-18 19:54:13 +08:00
parent bf464b04a6
commit 5762b6daf4
13 changed files with 155 additions and 136 deletions

View File

@@ -1,13 +1,10 @@
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Media;
using static Ramitta.winDataGrid;
namespace Ramitta
{
@@ -20,7 +17,7 @@ namespace Ramitta
> Rows
{ get; private set; }
public Dictionary<string,object> ColumnsName=new();
public Dictionary<string, object> ColumnsName = new();
public winDataGrid()
{
@@ -59,7 +56,7 @@ namespace Ramitta
public void AddColumn(string columnName, ColumnType columnType)
{
DataGridTemplateColumn column = new DataGridTemplateColumn();
FrameworkElementFactory? elementFactory=null;
FrameworkElementFactory? elementFactory = null;
ColumnsName.Add(columnName, columnType);
switch (columnType)
@@ -90,21 +87,23 @@ namespace Ramitta
SetBindingToProperty(elementFactory, TextBox.BackgroundProperty, $"[{columnName}].Background");
break;
}
DataTemplate dataTemplate = new DataTemplate() { VisualTree=elementFactory};
DataTemplate dataTemplate = new DataTemplate() { VisualTree = elementFactory };
column.Header = columnName;
column.CellTemplate = dataTemplate;
column.CellEditingTemplate = dataTemplate;
xDataGrid.Columns.Add( column );
xDataGrid.Columns.Add(column);
}
public Dictionary<string, object> AddRow(){
public Dictionary<string, object> AddRow()
{
var keys = ColumnsName.Keys.ToList();
var row = new Dictionary<string, object> { };
foreach (var key in keys) {
foreach (var key in keys)
{
switch (ColumnsName[key])
{
@@ -118,7 +117,7 @@ namespace Ramitta
row.Add(key, new ComboBox());
break;
case ColumnType.TextBox:
row.Add(key, new TextBox());
row.Add(key, new TextBox());
break;
case ColumnType.Label:
row.Add(key, new Label());
@@ -130,7 +129,8 @@ namespace Ramitta
return row;
}
public void Clear() {
public void Clear()
{
Rows.Clear();
}