Skip to content

Commit b8cd385

Browse files
authored
Net Core 3.0 (StefH#11)
* . * . * . * .
1 parent 76f4cf8 commit b8cd385

File tree

14 files changed

+170
-48
lines changed

14 files changed

+170
-48
lines changed

src/RandomDataGenerator Solution.sln

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.28010.2050
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.29021.104
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RandomDataGenerator", "RandomDataGenerator\RandomDataGenerator.csproj", "{D23EB0AA-1EB0-45D6-8985-14CF01CEDD10}"
77
EndProject
@@ -36,6 +36,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Example Project Files", "Ex
3636
EndProject
3737
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleAppNetCoreApp2", "ConsoleAppNetCoreApp2\ConsoleAppNetCoreApp2.csproj", "{6AB9BD42-8B23-425C-9B5D-B97A52F008BE}"
3838
EndProject
39+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RandomDataGenerator.Gui3", "RandomDataGenerator.Gui3\RandomDataGenerator.Gui3.csproj", "{090EDB20-CA63-473A-BA68-591BCCCB9D11}"
40+
EndProject
41+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApp", "WindowsFormsApp\WindowsFormsApp.csproj", "{E41735B3-EA20-40E0-A1F9-E7280FA0FB96}"
42+
EndProject
3943
Global
4044
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4145
Debug|Any CPU = Debug|Any CPU
@@ -62,6 +66,14 @@ Global
6266
{6AB9BD42-8B23-425C-9B5D-B97A52F008BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
6367
{6AB9BD42-8B23-425C-9B5D-B97A52F008BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
6468
{6AB9BD42-8B23-425C-9B5D-B97A52F008BE}.Release|Any CPU.Build.0 = Release|Any CPU
69+
{090EDB20-CA63-473A-BA68-591BCCCB9D11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
70+
{090EDB20-CA63-473A-BA68-591BCCCB9D11}.Debug|Any CPU.Build.0 = Debug|Any CPU
71+
{090EDB20-CA63-473A-BA68-591BCCCB9D11}.Release|Any CPU.ActiveCfg = Release|Any CPU
72+
{090EDB20-CA63-473A-BA68-591BCCCB9D11}.Release|Any CPU.Build.0 = Release|Any CPU
73+
{E41735B3-EA20-40E0-A1F9-E7280FA0FB96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
74+
{E41735B3-EA20-40E0-A1F9-E7280FA0FB96}.Debug|Any CPU.Build.0 = Debug|Any CPU
75+
{E41735B3-EA20-40E0-A1F9-E7280FA0FB96}.Release|Any CPU.ActiveCfg = Release|Any CPU
76+
{E41735B3-EA20-40E0-A1F9-E7280FA0FB96}.Release|Any CPU.Build.0 = Release|Any CPU
6577
EndGlobalSection
6678
GlobalSection(SolutionProperties) = preSolution
6779
HideSolutionNode = FALSE
@@ -72,6 +84,8 @@ Global
7284
{983EAE55-828B-4135-A1C6-BF7A1BA193EE} = {F8306255-6F4A-4E70-9932-06B2A3C9DF78}
7385
{36D5822C-791D-4F72-9ED4-7DBC164A7E24} = {CD43A6FA-4DEF-47B3-A430-9E7FFAD6B035}
7486
{6AB9BD42-8B23-425C-9B5D-B97A52F008BE} = {F8306255-6F4A-4E70-9932-06B2A3C9DF78}
87+
{090EDB20-CA63-473A-BA68-591BCCCB9D11} = {CD43A6FA-4DEF-47B3-A430-9E7FFAD6B035}
88+
{E41735B3-EA20-40E0-A1F9-E7280FA0FB96} = {CD43A6FA-4DEF-47B3-A430-9E7FFAD6B035}
7589
EndGlobalSection
7690
GlobalSection(ExtensibilityGlobals) = postSolution
7791
SolutionGuid = {F00DE8F4-BF0D-49C3-8854-600E8142BE41}

src/RandomDataGenerator.Gui/Data/DataManager.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,14 @@ public List<Field> GetFields()
9191
return _fields.ToList();
9292
}
9393

94-
public List<SubField> GetSubFields()
95-
{
96-
return _fields.SelectMany(f => f.SubFields).ToList();
97-
}
94+
//public List<SubField> GetSubFields()
95+
//{
96+
// return _fields.SelectMany(f => f.SubFields).ToList();
97+
//}
9898

99-
public List<SubField> GetSubFields(FieldType fieldType)
100-
{
101-
return _fields.Single(f => f.FieldType == fieldType).SubFields.ToList();
102-
}
99+
//public List<SubField> GetSubFields(FieldType fieldType)
100+
//{
101+
// return _fields.Single(f => f.FieldType == fieldType).SubFields.ToList();
102+
//}
103103
}
104104
}

src/RandomDataGenerator.Gui/MainForm.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/RandomDataGenerator.Gui/MainForm.Fields.ListBox.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ private void listBoxFields_SelectedIndexChanged(object sender, EventArgs e)
8080

8181
// Update FieldOptions
8282
var baseUserControl = panelFieldOptions.FindControl<BaseUserControl>();
83-
baseUserControl.UpdateControls(selectedDataField.FieldOptions);
83+
if (baseUserControl != null)
84+
{
85+
baseUserControl.UpdateControls(selectedDataField.FieldOptions);
86+
}
8487

8588
IsMoveUpFieldEnabled = listBoxFields.SelectedIndex > 0;
8689
IsMoveDownFieldEnabled = listBoxFields.SelectedIndex < listBoxFields.Items.Count - 1;

src/RandomDataGenerator.Gui/MainForm.Fields.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ void cmbFields_SelectedValueChanged(object sender, EventArgs e)
1515
var cmb = (ComboBox)sender;
1616
var selectedValue = (Field)cmb.SelectedItem;
1717

18-
cmbSubFields.DataSource = new BindingList<SubField>(_dataManager.GetSubFields(selectedValue.FieldType));
19-
cmbSubFields.SelectedIndex = 0;
18+
cmbSubFields.DataSource = selectedValue.SubFields;
2019
}
2120

2221
void cmbSubFields_SelectedValueChanged(object sender, EventArgs e)
@@ -84,7 +83,7 @@ private void UpdateUserControlExampleText(BaseUserControl baseUserControl)
8483
{
8584
// Just ignore exception
8685
}
87-
86+
8887
userControlExample.txtExample.Text = value != null ? value.ToString() : "NULL";
8988
}
9089
#endregion

src/RandomDataGenerator.Gui/MainForm.Project.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,9 @@ private void ClickEventMenuLoad(object sender, EventArgs e)
7474
foreach (var dataField in settings.DataFields)
7575
{
7676
// Fix Field and SubField
77-
dataField.Field = _dataManager.GetFields().FirstOrDefault(f => f.Name == dataField.Field.Name);
78-
dataField.SubField = _dataManager.GetSubFields().FirstOrDefault(sf => sf.Name == dataField.SubField.Name);
77+
var field = _dataManager.GetFields().First(f => f.Name == dataField.Field.Name);
78+
dataField.Field = field;
79+
dataField.SubField = field.SubFields.First(sf => sf.Name == dataField.SubField.Name);
7980

8081
_dataFields.Add(dataField);
8182
}

src/RandomDataGenerator.Gui/MainForm.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.ComponentModel;
2+
using System.Linq;
23
using System.Windows.Forms;
34
using RandomDataGenerator.Gui.Data;
45
using RandomDataGenerator.Gui.Entities;
@@ -32,9 +33,10 @@ public MainForm()
3233
listBoxFields.DataSource = _dataFields;
3334
_dataFields.ListChanged += DataFields_ListChanged;
3435

35-
cmbFields.SelectedValueChanged -= cmbFields_SelectedValueChanged;
36-
cmbFields.DataSource = new BindingList<Field>(_dataManager.GetFields());
37-
cmbFields.SelectedIndex = -1;
36+
var fields = _dataManager.GetFields();
37+
cmbFields.DataSource = fields;
38+
cmbSubFields.DataSource = fields.First().SubFields;
39+
3840
cmbFields.SelectedValueChanged += cmbFields_SelectedValueChanged;
3941

4042
userControlExample.btnRefresh.Click += UserControlExample_RefreshClicked;

src/RandomDataGenerator.Gui/Program.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ static void Main()
1919
// Text = $"RandomDataGenerator.Gui {VersionInfo.AssemblyVersion}"
2020
Text = "RandomDataGenerator.Gui"
2121
};
22+
23+
#if NETCOREAPP3_0
24+
// https://github.com/dotnet/winforms/issues/135
25+
Application.SetHighDpiMode(HighDpiMode.PerMonitorV2);
26+
#endif
27+
2228
Application.Run(form);
2329
}
2430
}

src/RandomDataGenerator.Gui/Properties/AssemblyInfo.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,14 @@
22
using System.Runtime.InteropServices;
33
using RandomDataGenerator.Gui;
44

5-
// General Information about an assembly is controlled through the following
6-
// set of attributes. Change these attribute values to modify the information
7-
// associated with an assembly.
8-
95
[assembly: AssemblyTitle("RandomDataGenerator.Gui")]
10-
[assembly: AssemblyDescription("")]
11-
[assembly: AssemblyConfiguration("")]
12-
[assembly: AssemblyCompany("")]
136
[assembly: AssemblyProduct("RandomDataGenerator.Gui")]
147
[assembly: AssemblyCopyright(VersionInfo.AssemblyCopyright)]
158
[assembly: AssemblyTrademark("")]
169
[assembly: AssemblyCulture("")]
1710

18-
// Setting ComVisible to false makes the types in this assembly not visible
19-
// to COM components. If you need to access a type in this assembly from
20-
// COM, set the ComVisible attribute to true on that type.
2111
[assembly: ComVisible(false)]
2212

23-
// The following GUID is for the ID of the typelib if this project is exposed to COM
2413
[assembly: Guid("8a9214e0-3b23-4c66-9a1b-f06f2ddf70fd")]
2514

2615
[assembly: AssemblyVersion(VersionInfo.AssemblyVersion)]

src/RandomDataGenerator.Gui/UserControls/BaseUserControl.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,7 @@ protected BaseUserControl()
1919

2020
public virtual void OnOptionsChanged(EventArgs e)
2121
{
22-
EventHandler handler = OptionsChanged;
23-
if (handler != null)
24-
{
25-
handler(this, e);
26-
}
22+
OptionsChanged?.Invoke(this, e);
2723
}
2824

2925
protected virtual void HandleOptionsChangedChanged(object sender, EventArgs e)

src/RandomDataGenerator.Gui/VersionInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ namespace RandomDataGenerator.Gui
33
{
44
public static class VersionInfo
55
{
6-
public const string AssemblyCopyright = "Copyright © Stef Heyenrath (2015-2018)";
6+
public const string AssemblyCopyright = "Copyright © Stef Heyenrath (2015-2019)";
77

88
// Version information for an assembly consists of the following four values:
99
//
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
2+
3+
<PropertyGroup>
4+
<OutputType>WinExe</OutputType>
5+
<TargetFramework>netcoreapp3.0</TargetFramework>
6+
<UseWindowsForms>true</UseWindowsForms>
7+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
8+
<RootNamespace>RandomDataGenerator.Gui</RootNamespace>
9+
<AssemblyName>RandomDataGenerator.Gui</AssemblyName>
10+
<ApplicationManifest>app.manifest</ApplicationManifest>
11+
<PublishSingleFile>true</PublishSingleFile>
12+
<PublishTrimmed>true</PublishTrimmed>
13+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
14+
</PropertyGroup>
15+
16+
<ItemGroup>
17+
<Compile Include="..\RandomDataGenerator.Gui\**\*.cs">
18+
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
19+
</Compile>
20+
<Content Include="..\RandomDataGenerator.Gui\**\*.png">
21+
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
22+
</Content>
23+
<Content Include="..\RandomDataGenerator.Gui\**\*.ico">
24+
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
25+
</Content>
26+
<EmbeddedResource Include="..\RandomDataGenerator.Gui\**\*.resx">
27+
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
28+
</EmbeddedResource>
29+
<EmbeddedResource Include="..\RandomDataGenerator.Gui\**\*.resources">
30+
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
31+
</EmbeddedResource>
32+
</ItemGroup>
33+
34+
<ItemGroup>
35+
<Compile Remove="..\RandomDataGenerator.Gui\obj\**" />
36+
<Compile Remove="..\RandomDataGenerator.Gui\bin\**" />
37+
</ItemGroup>
38+
39+
<ItemGroup>
40+
<Compile Remove="..\RandomDataGenerator.Gui\Properties\Settings.Designer.cs" />
41+
</ItemGroup>
42+
43+
<ItemGroup>
44+
<ProjectReference Include="..\RandomDataGenerator\RandomDataGenerator.csproj" />
45+
</ItemGroup>
46+
47+
</Project>
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
3+
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
4+
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
5+
<security>
6+
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
7+
<!-- UAC Manifest Options
8+
If you want to change the Windows User Account Control level replace the
9+
requestedExecutionLevel node with one of the following.
10+
11+
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
12+
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
13+
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
14+
15+
Specifying requestedExecutionLevel element will disable file and registry virtualization.
16+
Remove this element if your application requires this virtualization for backwards
17+
compatibility.
18+
-->
19+
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
20+
</requestedPrivileges>
21+
</security>
22+
</trustInfo>
23+
24+
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
25+
<application>
26+
<!-- A list of the Windows versions that this application has been tested on
27+
and is designed to work with. Uncomment the appropriate elements
28+
and Windows will automatically select the most compatible environment. -->
29+
30+
<!-- Windows Vista -->
31+
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
32+
33+
<!-- Windows 7 -->
34+
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
35+
36+
<!-- Windows 8 -->
37+
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
38+
39+
<!-- Windows 8.1 -->
40+
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
41+
42+
<!-- Windows 10 -->
43+
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
44+
45+
</application>
46+
</compatibility>
47+
48+
<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
49+
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
50+
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
51+
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->
52+
53+
<application xmlns="urn:schemas-microsoft-com:asm.v3">
54+
<windowsSettings>
55+
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
56+
</windowsSettings>
57+
</application>
58+
59+
60+
<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
61+
<!--
62+
<dependency>
63+
<dependentAssembly>
64+
<assemblyIdentity
65+
type="win32"
66+
name="Microsoft.Windows.Common-Controls"
67+
version="6.0.0.0"
68+
processorArchitecture="*"
69+
publicKeyToken="6595b64144ccf1df"
70+
language="*"
71+
/>
72+
</dependentAssembly>
73+
</dependency>
74+
-->
75+
76+
</assembly>

src/RandomDataGenerator/RandomDataGenerator.csproj

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,6 @@
3030
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
3131
</PropertyGroup>
3232

33-
<ItemGroup>
34-
<Compile Remove="FieldOptions\FieldOptionsNumberFixed.cs" />
35-
<Compile Remove="FieldOptions\IFieldOptions.cs" />
36-
<Compile Remove="Randomizers\RandomizerNumberFixed.cs" />
37-
</ItemGroup>
38-
39-
<ItemGroup>
40-
<None Remove="Data\IBAN.txt" />
41-
<None Remove="Data\Text\BBAN.txt" />
42-
</ItemGroup>
43-
4433
<ItemGroup>
4534
<EmbeddedResource Include="Data\Text\CityNames.txt" />
4635
<EmbeddedResource Include="Data\Text\CountryNames.txt" />

0 commit comments

Comments
 (0)