Skip to content

Commit 647f4fd

Browse files
committed
- converts gui app to net5
Signed-off-by: Vincent Biret <[email protected]>
1 parent 7d4a532 commit 647f4fd

File tree

3 files changed

+15
-98
lines changed

3 files changed

+15
-98
lines changed

src/OoasGui/App.config

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/OoasGui/MainForm.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
using System.Net;
2020
using System.Xml;
2121
using System.Threading.Tasks;
22+
using System.Net.Http;
2223

2324
namespace OoasGui
2425
{
@@ -120,6 +121,8 @@ private async void btnBrowse_Click(object sender, EventArgs e)
120121
}
121122
}
122123

124+
private static HttpClient client = new();
125+
123126
private async void loadBtn_Click(object sender, EventArgs e)
124127
{
125128
string url = urlTextBox.Text;
@@ -136,15 +139,10 @@ private async void loadBtn_Click(object sender, EventArgs e)
136139
requestUri = new Uri(url + "/$metadata");
137140
}
138141

139-
WebRequest request = WebRequest.Create(requestUri);
140-
141-
WebResponse response = request.GetResponse();
142-
143-
Stream receivedStream = response.GetResponseStream();
142+
HttpResponseMessage response = await client.GetAsync(requestUri);
144143

145-
StreamReader reader = new StreamReader(receivedStream, Encoding.UTF8);
144+
string csdl = await response.Content.ReadAsStringAsync();
146145

147-
string csdl = reader.ReadToEnd();
148146
LoadEdm(url, csdl);
149147
csdlRichTextBox.Text = FormatXml(csdl);
150148
Settings.ServiceRoot = requestUri;

src/OoasGui/OoasGui.csproj

Lines changed: 10 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,23 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
1+
<Project Sdk="Microsoft.NET.Sdk">
42
<PropertyGroup>
5-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7-
<ProjectGuid>{79B190E8-EDB0-4C03-8FD8-EB48E4807CFB}</ProjectGuid>
3+
<TargetFramework>net5.0-windows</TargetFramework>
84
<OutputType>WinExe</OutputType>
9-
<RootNamespace>OoasGui</RootNamespace>
10-
<AssemblyName>OoasGui</AssemblyName>
11-
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
12-
<FileAlignment>512</FileAlignment>
13-
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
14-
</PropertyGroup>
15-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16-
<PlatformTarget>AnyCPU</PlatformTarget>
17-
<DebugSymbols>true</DebugSymbols>
18-
<DebugType>full</DebugType>
19-
<Optimize>false</Optimize>
20-
<OutputPath>bin\Debug\</OutputPath>
21-
<DefineConstants>DEBUG;TRACE</DefineConstants>
22-
<ErrorReport>prompt</ErrorReport>
23-
<WarningLevel>4</WarningLevel>
24-
</PropertyGroup>
25-
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26-
<PlatformTarget>AnyCPU</PlatformTarget>
27-
<DebugType>pdbonly</DebugType>
28-
<Optimize>true</Optimize>
29-
<OutputPath>bin\Release\</OutputPath>
30-
<DefineConstants>TRACE</DefineConstants>
31-
<ErrorReport>prompt</ErrorReport>
32-
<WarningLevel>4</WarningLevel>
5+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
6+
<UseWindowsForms>true</UseWindowsForms>
7+
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
338
</PropertyGroup>
349
<ItemGroup>
35-
<Reference Include="Microsoft.OData.Edm, Version=7.6.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
36-
<HintPath>..\..\packages\Microsoft.OData.Edm.7.6.1\lib\portable-net45+win8+wpa81\Microsoft.OData.Edm.dll</HintPath>
37-
</Reference>
38-
<Reference Include="Microsoft.OpenApi, Version=1.2.2.0, Culture=neutral, PublicKeyToken=3f5743946376f042, processorArchitecture=MSIL">
39-
<HintPath>..\..\packages\Microsoft.OpenApi.1.2.2\lib\net46\Microsoft.OpenApi.dll</HintPath>
40-
</Reference>
41-
<Reference Include="System" />
42-
<Reference Include="System.Core" />
43-
<Reference Include="System.Xml.Linq" />
44-
<Reference Include="System.Data.DataSetExtensions" />
45-
<Reference Include="Microsoft.CSharp" />
46-
<Reference Include="System.Data" />
47-
<Reference Include="System.Deployment" />
48-
<Reference Include="System.Drawing" />
49-
<Reference Include="System.Net.Http" />
50-
<Reference Include="System.Windows.Forms" />
51-
<Reference Include="System.Xml" />
52-
</ItemGroup>
53-
<ItemGroup>
54-
<Compile Include="MainForm.cs">
55-
<SubType>Form</SubType>
56-
</Compile>
57-
<Compile Include="MainForm.Designer.cs">
58-
<DependentUpon>MainForm.cs</DependentUpon>
59-
</Compile>
60-
<Compile Include="Program.cs" />
61-
<Compile Include="Properties\AssemblyInfo.cs" />
62-
<EmbeddedResource Include="MainForm.resx">
63-
<DependentUpon>MainForm.cs</DependentUpon>
64-
</EmbeddedResource>
65-
<EmbeddedResource Include="Properties\Resources.resx">
66-
<Generator>ResXFileCodeGenerator</Generator>
67-
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
68-
<SubType>Designer</SubType>
69-
</EmbeddedResource>
70-
<Compile Include="Properties\Resources.Designer.cs">
71-
<AutoGen>True</AutoGen>
72-
<DependentUpon>Resources.resx</DependentUpon>
73-
</Compile>
7410
<None Include="..\..\.editorconfig">
7511
<Link>.editorconfig</Link>
7612
</None>
77-
<None Include="packages.config" />
78-
<None Include="Properties\Settings.settings">
79-
<Generator>SettingsSingleFileGenerator</Generator>
80-
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
81-
</None>
82-
<Compile Include="Properties\Settings.Designer.cs">
83-
<AutoGen>True</AutoGen>
84-
<DependentUpon>Settings.settings</DependentUpon>
85-
<DesignTimeSharedInput>True</DesignTimeSharedInput>
86-
</Compile>
8713
</ItemGroup>
8814
<ItemGroup>
89-
<None Include="App.config" />
15+
<ProjectReference Include="..\Microsoft.OpenApi.OData.Reader\Microsoft.OpenApi.OData.Reader.csproj" />
9016
</ItemGroup>
9117
<ItemGroup>
92-
<ProjectReference Include="..\Microsoft.OpenApi.OData.Reader\Microsoft.OpenApi.OData.Reader.csproj">
93-
<Project>{ff3acd93-19e0-486c-9c0f-fa1c2e7fc8c2}</Project>
94-
<Name>Microsoft.OpenApi.OData.Reader</Name>
95-
</ProjectReference>
18+
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
19+
<PackageReference Include="Microsoft.OData.Edm" Version="7.6.1" />
20+
<PackageReference Include="Microsoft.OpenApi" Version="1.2.3" />
21+
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
9622
</ItemGroup>
97-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
9823
</Project>

0 commit comments

Comments
 (0)