fix:Http接口案例

master
handefeng 7 months ago
parent 8268662a75
commit 6502673b8b
  1. 80
      .vs/DyuClient/v17/DocumentLayout.backup.json
  2. 129
      .vs/DyuClient/v17/DocumentLayout.json
  3. 57
      DyuClient/ViewPages/TabPages/Demo3.xaml
  4. 53
      DyuClient/ViewPages/TabPages/Demo3.xaml.cs

@ -18,14 +18,6 @@
"AbsoluteMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|d:\\workspace\\dayuai\\diamonddetectionclientdemo\\dyuclient\\app.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
"RelativeMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|solutionrelative:dyuclient\\app.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
},
{
"AbsoluteMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|d:\\workspace\\dayuai\\diamonddetectionclientdemo\\dyuclient\\language\\zh_cn.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
"RelativeMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|solutionrelative:dyuclient\\language\\zh_cn.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
},
{
"AbsoluteMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|d:\\workspace\\dayuai\\diamonddetectionclientdemo\\dyuclient\\language\\en_us.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
"RelativeMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|solutionrelative:dyuclient\\language\\en_us.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
},
{
"AbsoluteMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|d:\\workspace\\dayuai\\diamonddetectionclientdemo\\dyuclient\\viewmodel\\tabpages\\demo1model.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|solutionrelative:dyuclient\\viewmodel\\tabpages\\demo1model.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
@ -57,6 +49,14 @@
{
"AbsoluteMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|d:\\workspace\\dayuai\\diamonddetectionclientdemo\\dyuclient\\viewpages\\tabpages\\demo2.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
"RelativeMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|solutionrelative:dyuclient\\viewpages\\tabpages\\demo2.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\language\\en_US.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:DyuClient\\language\\en_US.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\language\\zh_CN.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:DyuClient\\language\\zh_CN.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
}
],
"DocumentGroupContainers": [
@ -66,8 +66,12 @@
"DocumentGroups": [
{
"DockedHeight": 200,
"SelectedChildIndex": 1,
"SelectedChildIndex": 2,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
},
{
"$type": "Document",
"DocumentIndex": 1,
@ -78,8 +82,7 @@
"RelativeToolTip": "DyuClient\\MainWindow.xaml.cs",
"ViewState": "AgIAABMAAAAAAAAAAAAAwAMAAAAbAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-12T09:14:24.209Z",
"EditorCaption": ""
"WhenOpened": "2024-11-12T09:14:24.209Z"
},
{
"$type": "Document",
@ -95,15 +98,14 @@
},
{
"$type": "Document",
"DocumentIndex": 5,
"DocumentIndex": 12,
"Title": "en_US.xaml",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\language\\en_US.xaml",
"RelativeDocumentMoniker": "DyuClient\\language\\en_US.xaml",
"ToolTip": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\language\\en_US.xaml",
"RelativeToolTip": "DyuClient\\language\\en_US.xaml",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
"WhenOpened": "2024-11-13T07:25:56.292Z",
"EditorCaption": ""
"WhenOpened": "2024-11-13T07:25:56.292Z"
},
{
"$type": "Document",
@ -115,12 +117,11 @@
"RelativeToolTip": "DyuClient\\ViewPages\\TabPages\\Demo1.xaml.cs",
"ViewState": "AgIAANwAAAAAAAAAAAAqwO0AAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-11T09:03:40.771Z",
"EditorCaption": ""
"WhenOpened": "2024-11-11T09:03:40.771Z"
},
{
"$type": "Document",
"DocumentIndex": 7,
"DocumentIndex": 5,
"Title": "ViewModelLocator.cs",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\ViewModel\\Main\\ViewModelLocator.cs",
"RelativeDocumentMoniker": "DyuClient\\ViewModel\\Main\\ViewModelLocator.cs",
@ -128,8 +129,7 @@
"RelativeToolTip": "DyuClient\\ViewModel\\Main\\ViewModelLocator.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-13T07:07:41.818Z",
"EditorCaption": ""
"WhenOpened": "2024-11-13T07:07:41.818Z"
},
{
"$type": "Document",
@ -145,19 +145,18 @@
},
{
"$type": "Document",
"DocumentIndex": 4,
"DocumentIndex": 13,
"Title": "zh_CN.xaml",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\language\\zh_CN.xaml",
"RelativeDocumentMoniker": "DyuClient\\language\\zh_CN.xaml",
"ToolTip": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\language\\zh_CN.xaml",
"RelativeToolTip": "DyuClient\\language\\zh_CN.xaml",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
"WhenOpened": "2024-11-13T07:26:00.362Z",
"EditorCaption": ""
"WhenOpened": "2024-11-13T07:26:00.362Z"
},
{
"$type": "Document",
"DocumentIndex": 12,
"DocumentIndex": 10,
"Title": "Demo2.xaml.cs",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\ViewPages\\TabPages\\Demo2.xaml.cs",
"RelativeDocumentMoniker": "DyuClient\\ViewPages\\TabPages\\Demo2.xaml.cs",
@ -165,12 +164,11 @@
"RelativeToolTip": "DyuClient\\ViewPages\\TabPages\\Demo2.xaml.cs",
"ViewState": "AgIAABEAAAAAAAAAAAD4vx0AAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-12T08:03:36.797Z",
"EditorCaption": ""
"WhenOpened": "2024-11-12T08:03:36.797Z"
},
{
"$type": "Document",
"DocumentIndex": 6,
"DocumentIndex": 4,
"Title": "Demo1Model.cs",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\ViewModel\\TabPages\\Demo1Model.cs",
"RelativeDocumentMoniker": "DyuClient\\ViewModel\\TabPages\\Demo1Model.cs",
@ -178,24 +176,22 @@
"RelativeToolTip": "DyuClient\\ViewModel\\TabPages\\Demo1Model.cs",
"ViewState": "AgIAADEAAAAAAAAAAAAiwAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-13T06:22:43.149Z",
"EditorCaption": ""
"WhenOpened": "2024-11-13T06:22:43.149Z"
},
{
"$type": "Document",
"DocumentIndex": 10,
"DocumentIndex": 8,
"Title": "MainWindow.xaml",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\MainWindow.xaml",
"RelativeDocumentMoniker": "DyuClient\\MainWindow.xaml",
"ToolTip": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\MainWindow.xaml",
"RelativeToolTip": "DyuClient\\MainWindow.xaml",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
"WhenOpened": "2024-11-12T08:52:42.184Z",
"EditorCaption": ""
"WhenOpened": "2024-11-12T08:52:42.184Z"
},
{
"$type": "Document",
"DocumentIndex": 8,
"DocumentIndex": 6,
"Title": "Demo2Model.cs",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\ViewModel\\TabPages\\Demo2Model.cs",
"RelativeDocumentMoniker": "DyuClient\\ViewModel\\TabPages\\Demo2Model.cs",
@ -203,37 +199,34 @@
"RelativeToolTip": "DyuClient\\ViewModel\\TabPages\\Demo2Model.cs",
"ViewState": "AgIAABEAAAAAAAAAAAAUwA0AAAARAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-12T08:02:31.471Z",
"EditorCaption": ""
"WhenOpened": "2024-11-12T08:02:31.471Z"
},
{
"$type": "Document",
"DocumentIndex": 9,
"Title": "DyuClient",
"DocumentIndex": 7,
"Title": "DyuClient.csproj",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\DyuClient.csproj",
"RelativeDocumentMoniker": "DyuClient\\DyuClient.csproj",
"ToolTip": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\DyuClient.csproj",
"RelativeToolTip": "DyuClient\\DyuClient.csproj",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000758|",
"WhenOpened": "2024-11-13T06:32:33.315Z",
"EditorCaption": ""
"WhenOpened": "2024-11-13T06:32:33.315Z"
},
{
"$type": "Document",
"DocumentIndex": 13,
"DocumentIndex": 11,
"Title": "Demo2.xaml",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\ViewPages\\TabPages\\Demo2.xaml",
"RelativeDocumentMoniker": "DyuClient\\ViewPages\\TabPages\\Demo2.xaml",
"ToolTip": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\ViewPages\\TabPages\\Demo2.xaml",
"RelativeToolTip": "DyuClient\\ViewPages\\TabPages\\Demo2.xaml",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
"WhenOpened": "2024-11-12T08:02:08.634Z",
"EditorCaption": ""
"WhenOpened": "2024-11-12T08:02:08.634Z"
},
{
"$type": "Document",
"DocumentIndex": 11,
"DocumentIndex": 9,
"Title": "AssemblyInfo.cs",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\AssemblyInfo.cs",
"RelativeDocumentMoniker": "DyuClient\\AssemblyInfo.cs",
@ -241,8 +234,7 @@
"RelativeToolTip": "DyuClient\\AssemblyInfo.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAoAAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-13T05:11:31.188Z",
"EditorCaption": ""
"WhenOpened": "2024-11-13T05:11:31.188Z"
}
]
}

@ -2,10 +2,26 @@
"Version": 1,
"WorkspaceRootPath": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\",
"Documents": [
{
"AbsoluteMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|d:\\workspace\\dayuai\\diamonddetectionclientdemo\\dyuclient\\viewpages\\tabpages\\demo3.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|solutionrelative:dyuclient\\viewpages\\tabpages\\demo3.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|d:\\workspace\\dayuai\\diamonddetectionclientdemo\\dyuclient\\viewpages\\tabpages\\demo3.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
"RelativeMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|solutionrelative:dyuclient\\viewpages\\tabpages\\demo3.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
},
{
"AbsoluteMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|d:\\workspace\\dayuai\\diamonddetectionclientdemo\\dyuclient\\viewpages\\tabpages\\demo2.xaml.cs||{8B382828-6202-11D1-8870-0000F87579D2}|",
"RelativeMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|solutionrelative:dyuclient\\viewpages\\tabpages\\demo2.xaml.cs||{8B382828-6202-11D1-8870-0000F87579D2}|"
},
{
"AbsoluteMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|d:\\workspace\\dayuai\\diamonddetectionclientdemo\\dyuclient\\viewpages\\tabpages\\demo1.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
"RelativeMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|solutionrelative:dyuclient\\viewpages\\tabpages\\demo1.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
},
{
"AbsoluteMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|d:\\workspace\\dayuai\\diamonddetectionclientdemo\\dyuclient\\viewpages\\tabpages\\demo2.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
"RelativeMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|solutionrelative:dyuclient\\viewpages\\tabpages\\demo2.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
},
{
"AbsoluteMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|d:\\workspace\\dayuai\\diamonddetectionclientdemo\\dyuclient\\mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|solutionrelative:dyuclient\\mainwindow.xaml.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
@ -41,22 +57,6 @@
{
"AbsoluteMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|d:\\workspace\\dayuai\\diamonddetectionclientdemo\\dyuclient\\assemblyinfo.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|solutionrelative:dyuclient\\assemblyinfo.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|d:\\workspace\\dayuai\\diamonddetectionclientdemo\\dyuclient\\viewpages\\tabpages\\demo2.xaml.cs||{8B382828-6202-11D1-8870-0000F87579D2}|",
"RelativeMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|solutionrelative:dyuclient\\viewpages\\tabpages\\demo2.xaml.cs||{8B382828-6202-11D1-8870-0000F87579D2}|"
},
{
"AbsoluteMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|d:\\workspace\\dayuai\\diamonddetectionclientdemo\\dyuclient\\viewpages\\tabpages\\demo2.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
"RelativeMoniker": "D:0:0:{8F7FCFA0-42FF-4420-BE47-E04CB4F4B4B9}|DyuClient\\DyuClient.csproj|solutionrelative:dyuclient\\viewpages\\tabpages\\demo2.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\language\\en_US.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:DyuClient\\language\\en_US.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
},
{
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\language\\zh_CN.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}",
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:DyuClient\\language\\zh_CN.xaml||{F11ACC28-31D1-4C80-A34B-F4E09D3D753C}"
}
],
"DocumentGroupContainers": [
@ -66,15 +66,40 @@
"DocumentGroups": [
{
"DockedHeight": 200,
"SelectedChildIndex": 2,
"SelectedChildIndex": 1,
"Children": [
{
"$type": "Bookmark",
"Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}"
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "Demo3.xaml.cs",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\ViewPages\\TabPages\\Demo3.xaml.cs",
"RelativeDocumentMoniker": "DyuClient\\ViewPages\\TabPages\\Demo3.xaml.cs",
"ToolTip": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\ViewPages\\TabPages\\Demo3.xaml.cs",
"RelativeToolTip": "DyuClient\\ViewPages\\TabPages\\Demo3.xaml.cs",
"ViewState": "AgIAABsAAAAAAAAAAAAIwCUAAAANAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-15T02:30:54.533Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "Demo3.xaml",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\ViewPages\\TabPages\\Demo3.xaml",
"RelativeDocumentMoniker": "DyuClient\\ViewPages\\TabPages\\Demo3.xaml",
"ToolTip": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\ViewPages\\TabPages\\Demo3.xaml",
"RelativeToolTip": "DyuClient\\ViewPages\\TabPages\\Demo3.xaml",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
"WhenOpened": "2024-11-15T02:30:19.284Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 5,
"Title": "MainWindow.xaml.cs",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\MainWindow.xaml.cs",
"RelativeDocumentMoniker": "DyuClient\\MainWindow.xaml.cs",
@ -86,7 +111,7 @@
},
{
"$type": "Document",
"DocumentIndex": 0,
"DocumentIndex": 3,
"Title": "Demo1.xaml",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\ViewPages\\TabPages\\Demo1.xaml",
"RelativeDocumentMoniker": "DyuClient\\ViewPages\\TabPages\\Demo1.xaml",
@ -98,18 +123,7 @@
},
{
"$type": "Document",
"DocumentIndex": 12,
"Title": "en_US.xaml",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\language\\en_US.xaml",
"RelativeDocumentMoniker": "DyuClient\\language\\en_US.xaml",
"ToolTip": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\language\\en_US.xaml",
"RelativeToolTip": "DyuClient\\language\\en_US.xaml",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
"WhenOpened": "2024-11-13T07:25:56.292Z"
},
{
"$type": "Document",
"DocumentIndex": 2,
"DocumentIndex": 6,
"Title": "Demo1.xaml.cs",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\ViewPages\\TabPages\\Demo1.xaml.cs",
"RelativeDocumentMoniker": "DyuClient\\ViewPages\\TabPages\\Demo1.xaml.cs",
@ -121,7 +135,7 @@
},
{
"$type": "Document",
"DocumentIndex": 5,
"DocumentIndex": 9,
"Title": "ViewModelLocator.cs",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\ViewModel\\Main\\ViewModelLocator.cs",
"RelativeDocumentMoniker": "DyuClient\\ViewModel\\Main\\ViewModelLocator.cs",
@ -133,7 +147,7 @@
},
{
"$type": "Document",
"DocumentIndex": 3,
"DocumentIndex": 7,
"Title": "App.xaml",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\App.xaml",
"RelativeDocumentMoniker": "DyuClient\\App.xaml",
@ -145,30 +159,20 @@
},
{
"$type": "Document",
"DocumentIndex": 13,
"Title": "zh_CN.xaml",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\language\\zh_CN.xaml",
"RelativeDocumentMoniker": "DyuClient\\language\\zh_CN.xaml",
"ToolTip": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\language\\zh_CN.xaml",
"RelativeToolTip": "DyuClient\\language\\zh_CN.xaml",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
"WhenOpened": "2024-11-13T07:26:00.362Z"
},
{
"$type": "Document",
"DocumentIndex": 10,
"DocumentIndex": 2,
"Title": "Demo2.xaml.cs",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\ViewPages\\TabPages\\Demo2.xaml.cs",
"RelativeDocumentMoniker": "DyuClient\\ViewPages\\TabPages\\Demo2.xaml.cs",
"ToolTip": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\ViewPages\\TabPages\\Demo2.xaml.cs",
"RelativeToolTip": "DyuClient\\ViewPages\\TabPages\\Demo2.xaml.cs",
"ViewState": "AgIAABEAAAAAAAAAAAD4vx0AAAAAAAAAAAAAAA==",
"ViewState": "AgIAABwAAAAAAAAAAAAqwC8AAAAAAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2024-11-12T08:03:36.797Z"
"WhenOpened": "2024-11-12T08:03:36.797Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 4,
"DocumentIndex": 8,
"Title": "Demo1Model.cs",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\ViewModel\\TabPages\\Demo1Model.cs",
"RelativeDocumentMoniker": "DyuClient\\ViewModel\\TabPages\\Demo1Model.cs",
@ -180,7 +184,7 @@
},
{
"$type": "Document",
"DocumentIndex": 8,
"DocumentIndex": 12,
"Title": "MainWindow.xaml",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\MainWindow.xaml",
"RelativeDocumentMoniker": "DyuClient\\MainWindow.xaml",
@ -191,7 +195,19 @@
},
{
"$type": "Document",
"DocumentIndex": 6,
"DocumentIndex": 4,
"Title": "Demo2.xaml",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\ViewPages\\TabPages\\Demo2.xaml",
"RelativeDocumentMoniker": "DyuClient\\ViewPages\\TabPages\\Demo2.xaml",
"ToolTip": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\ViewPages\\TabPages\\Demo2.xaml",
"RelativeToolTip": "DyuClient\\ViewPages\\TabPages\\Demo2.xaml",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
"WhenOpened": "2024-11-12T08:02:08.634Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 10,
"Title": "Demo2Model.cs",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\ViewModel\\TabPages\\Demo2Model.cs",
"RelativeDocumentMoniker": "DyuClient\\ViewModel\\TabPages\\Demo2Model.cs",
@ -203,7 +219,7 @@
},
{
"$type": "Document",
"DocumentIndex": 7,
"DocumentIndex": 11,
"Title": "DyuClient.csproj",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\DyuClient.csproj",
"RelativeDocumentMoniker": "DyuClient\\DyuClient.csproj",
@ -215,18 +231,7 @@
},
{
"$type": "Document",
"DocumentIndex": 11,
"Title": "Demo2.xaml",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\ViewPages\\TabPages\\Demo2.xaml",
"RelativeDocumentMoniker": "DyuClient\\ViewPages\\TabPages\\Demo2.xaml",
"ToolTip": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\ViewPages\\TabPages\\Demo2.xaml",
"RelativeToolTip": "DyuClient\\ViewPages\\TabPages\\Demo2.xaml",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003549|",
"WhenOpened": "2024-11-12T08:02:08.634Z"
},
{
"$type": "Document",
"DocumentIndex": 9,
"DocumentIndex": 13,
"Title": "AssemblyInfo.cs",
"DocumentMoniker": "D:\\workspace\\dayuAI\\DiamondDetectionClientDemo\\DyuClient\\AssemblyInfo.cs",
"RelativeDocumentMoniker": "DyuClient\\AssemblyInfo.cs",

@ -1,19 +1,50 @@
<UserControl x:Class="DyuClient.ViewPages.TabPages.Demo3"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:DyuClient.ViewPages.TabPages"
Height="350" Width="525">
<Grid>
<Border x:Class="DyuClient.ViewPages.TabPages.Demo3"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:DyuClient.ViewPages.TabPages"
xmlns:data="clr-namespace:System.Windows.Controls;assembly=PresentationFramework"
Height="970" Width="1357">
<Grid HorizontalAlignment="Left" Width="1100" Margin="139,0,0,-520">
<!-- 按钮控件 -->
<Button Name="GetDataButton" Content="获取数据" HorizontalAlignment="Center" VerticalAlignment="Top" Width="100" Height="40" Margin="0,20,0,0" Click="GetDataButton_Click"/>
<Button Name="GetDataButton" Content="获取数据" HorizontalAlignment="Left" VerticalAlignment="Top" Width="100" Height="40" Margin="-126,19,0,0" Click="GetDataButton_Click"/>
<!-- 文本框控件 -->
<TextBox Name="ResultTextBox"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Margin="20,80,20,20"
Margin="0,757,56,574"
IsReadOnly="True"
TextWrapping="Wrap"
VerticalScrollBarVisibility="Auto"/>
VerticalScrollBarVisibility="Auto" RenderTransformOrigin="0.501,2.782">
<TextBox.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleY="-1"/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform Y="-940.184"/>
</TransformGroup>
</TextBox.RenderTransform>
</TextBox>
<!-- 添加DataGrid表格控件 -->
<data:DataGrid Name="DataGridTable"
AutoGenerateColumns="False" Margin="2,10,55,985"
AlternatingRowBackground="RoyalBlue"
RowBackground="LightSkyBlue"><!--设置交替行背景--> <!-- 设置默认行背景 -->
<!-- 定义表格列 -->
<data:DataGrid.Columns>
<data:DataGridTextColumn Header="Args" Binding="{Binding Args}" Width="100"/>
<data:DataGridTextColumn Header="Url" Binding="{Binding Url}" Width="100"/>
<data:DataGridTextColumn Header="Origin" Binding="{Binding Origin}" Width="100"/>
<data:DataGridTextColumn Header="XAmznTraceId" Binding="{Binding Headers.XAmznTraceId}" Width="100"/>
<data:DataGridTextColumn Header="Priority" Binding="{Binding Headers.Priority}" Width="100"/>
<data:DataGridTextColumn Header="SecChUa" Binding="{Binding Headers.SecChUa}" Width="100"/>
<data:DataGridTextColumn Header="SecFetchDest" Binding="{Binding Headers.SecFetchDest}" Width="100"/>
<data:DataGridTextColumn Header="SecFetchMode" Binding="{Binding Headers.SecFetchMode}" Width="100"/>
<data:DataGridTextColumn Header="UserAgent" Binding="{Binding Headers.UserAgent}" Width="100"/>
<data:DataGridTextColumn Header="XAmznTraceId" Binding="{Binding Headers.XAmznTraceId}" Width="110"/>
</data:DataGrid.Columns>
</data:DataGrid>
</Grid>
</UserControl>
</Border>

@ -1,35 +1,48 @@
using System;
using System.Collections.ObjectModel;
using System.Net.Http;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using DyuClient.Server.Entity;
namespace DyuClient.ViewPages.TabPages
{
public partial class Demo3
public partial class Demo3
{
// 优化:将 HttpClient 提取为类级别的成员,避免重复创建实例
// 优化:将HttpClient提取为类级别的成员,避免重复创建实例
private static readonly HttpClient client = new HttpClient();
private ObservableCollection<HttpPost> dataList;
public Demo3()
{
InitializeComponent();
dataList = new ObservableCollection<HttpPost>();
}
// 按钮点击事件,触发Http请求和数据解析
// 按钮点击事件,触发Http请求、数据解析以及绑定到表格
private async void GetDataButton_Click(object sender, RoutedEventArgs e)
{
// 调用异步方法获取JSON数据
// 调用异步方法获取JSON数据并解析
var result = await GetJsonDataAsync("https://httpbin.org/get");
// 显示结果
ResultTextBox.Text = result;
// 清空之前的数据(如果有)
dataList.Clear();
// 根据解析结果填充数据到dataList
if (result != null)
{
dataList.Add(result);
}
// 将获取到的数据绑定到DataGridTable
DataGridTable.ItemsSource = dataList;
}
// 异步方法:发送Http请求并解析JSON
private async Task<string> GetJsonDataAsync(string url)
private async Task<HttpPost> GetJsonDataAsync(string url)
{
using (HttpClient client = new HttpClient())
{
@ -40,27 +53,23 @@ namespace DyuClient.ViewPages.TabPages
string jsonResponse = await response.Content.ReadAsStringAsync();
// 反序列化为Post对象
// 输出获取到的原始JSON数据,方便调试查看是否获取正确
Console.WriteLine("获取到的JSON数据: " + jsonResponse);
// 反序列化为HttpPost对象
var post = JsonSerializer.Deserialize<HttpPost>(jsonResponse);
// 显示结果
return $"Accept: {post.Headers.Accept}\n" +
$"AcceptEncoding: {post.Url}\n" +
$"AcceptLanguage: {post.Origin}\n" +
$"Host: {post.Headers.Host}\n" +
$"Priority: {post.Headers.Priority}\n" +
$"SecChUa: {post.Headers.SecChUa}\n" +
$"SecFetchDest: {post.Headers.SecFetchDest}\n" +
$"SecFetchMode: {post.Headers.SecFetchMode}\n" +
$"UserAgent: {post.Headers.UserAgent}\n" +
$"XAmznTraceId: {post.Headers.XAmznTraceId}\n";
// 输出反序列化后的对象信息,查看是否反序列化成功
Console.WriteLine("反序列化后的HttpPost对象: " + post);
return post;
}
catch (Exception ex)
{
return $"请求失败: {ex.Message}";
MessageBox.Show($"请求失败: {ex.Message}");
return null;
}
}
}
}
}
Loading…
Cancel
Save