Add OS-specific interop
This commit is contained in:
parent
86c7f89788
commit
aea8c11dc4
33 changed files with 1083 additions and 13 deletions
39
Source/LoadByOS/WindowsConfigApp/Form1.Designer.cs
generated
Normal file
39
Source/LoadByOS/WindowsConfigApp/Form1.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
namespace WindowsConfigApp
|
||||
{
|
||||
partial class Form1
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Text = "Form1";
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
10
Source/LoadByOS/WindowsConfigApp/Form1.cs
Normal file
10
Source/LoadByOS/WindowsConfigApp/Form1.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
namespace WindowsConfigApp
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
18
Source/LoadByOS/WindowsConfigApp/Program.cs
Normal file
18
Source/LoadByOS/WindowsConfigApp/Program.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
using AppScaffolding.OSInterop;
|
||||
|
||||
namespace WindowsConfigApp
|
||||
{
|
||||
class Program : OSConfigBase
|
||||
{
|
||||
public override Type InteropFunctionsType => typeof(WinInterop);
|
||||
public override Type[] ReferencedTypes => new Type[]
|
||||
{
|
||||
typeof(Form1),
|
||||
typeof(Bitmap),
|
||||
typeof(Accessibility.IAccIdentity),
|
||||
typeof(Microsoft.Win32.SystemEvents)
|
||||
};
|
||||
|
||||
static void Main() => new Program().Run();
|
||||
}
|
||||
}
|
||||
33
Source/LoadByOS/WindowsConfigApp/WinInterop.cs
Normal file
33
Source/LoadByOS/WindowsConfigApp/WinInterop.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using AppScaffolding.OSInterop;
|
||||
|
||||
namespace WindowsConfigApp
|
||||
{
|
||||
internal class WinInterop : IInteropFunctions
|
||||
{
|
||||
public WinInterop() { }
|
||||
public WinInterop(params object[] values) { }
|
||||
|
||||
|
||||
// examples until the real interface is filled out
|
||||
private string InitValue1 { get; }
|
||||
private int InitValue2 { get; }
|
||||
|
||||
public WinInterop(string initValue1, int initValue2)
|
||||
{
|
||||
InitValue1 = initValue1;
|
||||
InitValue2 = initValue2;
|
||||
}
|
||||
|
||||
public void CopyTextToClipboard(string text) => Clipboard.SetDataObject(text, true, 5, 150);
|
||||
|
||||
public void ShowForm()
|
||||
{
|
||||
ApplicationConfiguration.Initialize();
|
||||
Application.Run(new Form1());
|
||||
}
|
||||
|
||||
public string TransformInit1() => InitValue1.ToUpper();
|
||||
|
||||
public int TransformInit2() => InitValue2 * InitValue2;
|
||||
}
|
||||
}
|
||||
26
Source/LoadByOS/WindowsConfigApp/WindowsConfigApp.csproj
Normal file
26
Source/LoadByOS/WindowsConfigApp/WindowsConfigApp.csproj
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net6.0-windows</TargetFramework>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<OutputPath>..\..\bin\Debug</OutputPath>
|
||||
<DebugType>embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
<OutputPath>..\..\bin\Release</OutputPath>
|
||||
<DebugType>embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\AppScaffolding\AppScaffolding.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Loading…
Add table
Add a link
Reference in a new issue