Skip to content

Commit

Permalink
Net Core 3.0 (#11)
Browse files Browse the repository at this point in the history
* .

* .

* .

* .
  • Loading branch information
StefH committed Sep 23, 2019
1 parent 76f4cf8 commit b8cd385
Show file tree
Hide file tree
Showing 14 changed files with 170 additions and 48 deletions.
18 changes: 16 additions & 2 deletions src/RandomDataGenerator Solution.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2050
# Visual Studio Version 16
VisualStudioVersion = 16.0.29021.104
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RandomDataGenerator", "RandomDataGenerator\RandomDataGenerator.csproj", "{D23EB0AA-1EB0-45D6-8985-14CF01CEDD10}"
EndProject
Expand Down Expand Up @@ -36,6 +36,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Example Project Files", "Ex
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleAppNetCoreApp2", "ConsoleAppNetCoreApp2\ConsoleAppNetCoreApp2.csproj", "{6AB9BD42-8B23-425C-9B5D-B97A52F008BE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RandomDataGenerator.Gui3", "RandomDataGenerator.Gui3\RandomDataGenerator.Gui3.csproj", "{090EDB20-CA63-473A-BA68-591BCCCB9D11}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsFormsApp", "WindowsFormsApp\WindowsFormsApp.csproj", "{E41735B3-EA20-40E0-A1F9-E7280FA0FB96}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -62,6 +66,14 @@ Global
{6AB9BD42-8B23-425C-9B5D-B97A52F008BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6AB9BD42-8B23-425C-9B5D-B97A52F008BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6AB9BD42-8B23-425C-9B5D-B97A52F008BE}.Release|Any CPU.Build.0 = Release|Any CPU
{090EDB20-CA63-473A-BA68-591BCCCB9D11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{090EDB20-CA63-473A-BA68-591BCCCB9D11}.Debug|Any CPU.Build.0 = Debug|Any CPU
{090EDB20-CA63-473A-BA68-591BCCCB9D11}.Release|Any CPU.ActiveCfg = Release|Any CPU
{090EDB20-CA63-473A-BA68-591BCCCB9D11}.Release|Any CPU.Build.0 = Release|Any CPU
{E41735B3-EA20-40E0-A1F9-E7280FA0FB96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E41735B3-EA20-40E0-A1F9-E7280FA0FB96}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E41735B3-EA20-40E0-A1F9-E7280FA0FB96}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E41735B3-EA20-40E0-A1F9-E7280FA0FB96}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -72,6 +84,8 @@ Global
{983EAE55-828B-4135-A1C6-BF7A1BA193EE} = {F8306255-6F4A-4E70-9932-06B2A3C9DF78}
{36D5822C-791D-4F72-9ED4-7DBC164A7E24} = {CD43A6FA-4DEF-47B3-A430-9E7FFAD6B035}
{6AB9BD42-8B23-425C-9B5D-B97A52F008BE} = {F8306255-6F4A-4E70-9932-06B2A3C9DF78}
{090EDB20-CA63-473A-BA68-591BCCCB9D11} = {CD43A6FA-4DEF-47B3-A430-9E7FFAD6B035}
{E41735B3-EA20-40E0-A1F9-E7280FA0FB96} = {CD43A6FA-4DEF-47B3-A430-9E7FFAD6B035}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F00DE8F4-BF0D-49C3-8854-600E8142BE41}
Expand Down
16 changes: 8 additions & 8 deletions src/RandomDataGenerator.Gui/Data/DataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ public List<Field> GetFields()
return _fields.ToList();
}

public List<SubField> GetSubFields()
{
return _fields.SelectMany(f => f.SubFields).ToList();
}
//public List<SubField> GetSubFields()
//{
// return _fields.SelectMany(f => f.SubFields).ToList();
//}

public List<SubField> GetSubFields(FieldType fieldType)
{
return _fields.Single(f => f.FieldType == fieldType).SubFields.ToList();
}
//public List<SubField> GetSubFields(FieldType fieldType)
//{
// return _fields.Single(f => f.FieldType == fieldType).SubFields.ToList();
//}
}
}
2 changes: 1 addition & 1 deletion src/RandomDataGenerator.Gui/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/RandomDataGenerator.Gui/MainForm.Fields.ListBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ private void listBoxFields_SelectedIndexChanged(object sender, EventArgs e)

// Update FieldOptions
var baseUserControl = panelFieldOptions.FindControl<BaseUserControl>();
baseUserControl.UpdateControls(selectedDataField.FieldOptions);
if (baseUserControl != null)
{
baseUserControl.UpdateControls(selectedDataField.FieldOptions);
}

IsMoveUpFieldEnabled = listBoxFields.SelectedIndex > 0;
IsMoveDownFieldEnabled = listBoxFields.SelectedIndex < listBoxFields.Items.Count - 1;
Expand Down
5 changes: 2 additions & 3 deletions src/RandomDataGenerator.Gui/MainForm.Fields.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ void cmbFields_SelectedValueChanged(object sender, EventArgs e)
var cmb = (ComboBox)sender;
var selectedValue = (Field)cmb.SelectedItem;

cmbSubFields.DataSource = new BindingList<SubField>(_dataManager.GetSubFields(selectedValue.FieldType));
cmbSubFields.SelectedIndex = 0;
cmbSubFields.DataSource = selectedValue.SubFields;
}

void cmbSubFields_SelectedValueChanged(object sender, EventArgs e)
Expand Down Expand Up @@ -84,7 +83,7 @@ private void UpdateUserControlExampleText(BaseUserControl baseUserControl)
{
// Just ignore exception
}

userControlExample.txtExample.Text = value != null ? value.ToString() : "NULL";
}
#endregion
Expand Down
5 changes: 3 additions & 2 deletions src/RandomDataGenerator.Gui/MainForm.Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ private void ClickEventMenuLoad(object sender, EventArgs e)
foreach (var dataField in settings.DataFields)
{
// Fix Field and SubField
dataField.Field = _dataManager.GetFields().FirstOrDefault(f => f.Name == dataField.Field.Name);
dataField.SubField = _dataManager.GetSubFields().FirstOrDefault(sf => sf.Name == dataField.SubField.Name);
var field = _dataManager.GetFields().First(f => f.Name == dataField.Field.Name);
dataField.Field = field;
dataField.SubField = field.SubFields.First(sf => sf.Name == dataField.SubField.Name);

_dataFields.Add(dataField);
}
Expand Down
8 changes: 5 additions & 3 deletions src/RandomDataGenerator.Gui/MainForm.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.ComponentModel;
using System.Linq;
using System.Windows.Forms;
using RandomDataGenerator.Gui.Data;
using RandomDataGenerator.Gui.Entities;
Expand Down Expand Up @@ -32,9 +33,10 @@ public MainForm()
listBoxFields.DataSource = _dataFields;
_dataFields.ListChanged += DataFields_ListChanged;

cmbFields.SelectedValueChanged -= cmbFields_SelectedValueChanged;
cmbFields.DataSource = new BindingList<Field>(_dataManager.GetFields());
cmbFields.SelectedIndex = -1;
var fields = _dataManager.GetFields();
cmbFields.DataSource = fields;
cmbSubFields.DataSource = fields.First().SubFields;

cmbFields.SelectedValueChanged += cmbFields_SelectedValueChanged;

userControlExample.btnRefresh.Click += UserControlExample_RefreshClicked;
Expand Down
6 changes: 6 additions & 0 deletions src/RandomDataGenerator.Gui/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ static void Main()
// Text = $"RandomDataGenerator.Gui {VersionInfo.AssemblyVersion}"
Text = "RandomDataGenerator.Gui"
};

#if NETCOREAPP3_0
// https://github.com/dotnet/winforms/issues/135
Application.SetHighDpiMode(HighDpiMode.PerMonitorV2);
#endif

Application.Run(form);
}
}
Expand Down
11 changes: 0 additions & 11 deletions src/RandomDataGenerator.Gui/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,14 @@
using System.Runtime.InteropServices;
using RandomDataGenerator.Gui;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.

[assembly: AssemblyTitle("RandomDataGenerator.Gui")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RandomDataGenerator.Gui")]
[assembly: AssemblyCopyright(VersionInfo.AssemblyCopyright)]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

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

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

[assembly: AssemblyVersion(VersionInfo.AssemblyVersion)]
Expand Down
6 changes: 1 addition & 5 deletions src/RandomDataGenerator.Gui/UserControls/BaseUserControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ protected BaseUserControl()

public virtual void OnOptionsChanged(EventArgs e)
{
EventHandler handler = OptionsChanged;
if (handler != null)
{
handler(this, e);
}
OptionsChanged?.Invoke(this, e);
}

protected virtual void HandleOptionsChangedChanged(object sender, EventArgs e)
Expand Down
2 changes: 1 addition & 1 deletion src/RandomDataGenerator.Gui/VersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace RandomDataGenerator.Gui
{
public static class VersionInfo
{
public const string AssemblyCopyright = "Copyright © Stef Heyenrath (2015-2018)";
public const string AssemblyCopyright = "Copyright © Stef Heyenrath (2015-2019)";

// Version information for an assembly consists of the following four values:
//
Expand Down
47 changes: 47 additions & 0 deletions src/RandomDataGenerator.Gui3/RandomDataGenerator.Gui3.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RootNamespace>RandomDataGenerator.Gui</RootNamespace>
<AssemblyName>RandomDataGenerator.Gui</AssemblyName>
<ApplicationManifest>app.manifest</ApplicationManifest>
<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>true</PublishTrimmed>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\RandomDataGenerator.Gui\**\*.cs">
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
</Compile>
<Content Include="..\RandomDataGenerator.Gui\**\*.png">
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
</Content>
<Content Include="..\RandomDataGenerator.Gui\**\*.ico">
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
</Content>
<EmbeddedResource Include="..\RandomDataGenerator.Gui\**\*.resx">
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
</EmbeddedResource>
<EmbeddedResource Include="..\RandomDataGenerator.Gui\**\*.resources">
<Link>%(RecursiveDir)%(FileName)%(Extension)</Link>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<Compile Remove="..\RandomDataGenerator.Gui\obj\**" />
<Compile Remove="..\RandomDataGenerator.Gui\bin\**" />
</ItemGroup>

<ItemGroup>
<Compile Remove="..\RandomDataGenerator.Gui\Properties\Settings.Designer.cs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\RandomDataGenerator\RandomDataGenerator.csproj" />
</ItemGroup>

</Project>
76 changes: 76 additions & 0 deletions src/RandomDataGenerator.Gui3/app.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
Specifying requestedExecutionLevel element will disable file and registry virtualization.
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- A list of the Windows versions that this application has been tested on
and is designed to work with. Uncomment the appropriate elements
and Windows will automatically select the most compatible environment. -->

<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->

<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->

<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->

<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->

<!-- Windows 10 -->
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />

</application>
</compatibility>

<!-- Indicates that the application is DPI-aware and will not be automatically scaled by Windows at higher
DPIs. Windows Presentation Foundation (WPF) applications are automatically DPI-aware and do not need
to opt in. Windows Forms applications targeting .NET Framework 4.6 that opt into this setting, should
also set the 'EnableWindowsFormsHighDpiAutoResizing' setting to 'true' in their app.config. -->

<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http:https://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>


<!-- Enable themes for Windows common controls and dialogs (Windows XP and later) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->

</assembly>
11 changes: 0 additions & 11 deletions src/RandomDataGenerator/RandomDataGenerator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,6 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup>
<Compile Remove="FieldOptions\FieldOptionsNumberFixed.cs" />
<Compile Remove="FieldOptions\IFieldOptions.cs" />
<Compile Remove="Randomizers\RandomizerNumberFixed.cs" />
</ItemGroup>

<ItemGroup>
<None Remove="Data\IBAN.txt" />
<None Remove="Data\Text\BBAN.txt" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="Data\Text\CityNames.txt" />
<EmbeddedResource Include="Data\Text\CountryNames.txt" />
Expand Down

0 comments on commit b8cd385

Please sign in to comment.