Skip to content

Commit

Permalink
Create .NET GUI Example project
Browse files Browse the repository at this point in the history
  • Loading branch information
sappho192 committed Jan 25, 2024
1 parent 1c54cc1 commit 44416d9
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 4 deletions.
15 changes: 15 additions & 0 deletions onnx_project/dotnet/GuiExample/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Application x:Class="GuiExample.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:GuiExample"
StartupUri="MainWindow.xaml"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ui:ThemesDictionary Theme="Light" />
<ui:ControlsDictionary />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
14 changes: 14 additions & 0 deletions onnx_project/dotnet/GuiExample/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Configuration;
using System.Data;
using System.Windows;

namespace GuiExample
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}

}
10 changes: 10 additions & 0 deletions onnx_project/dotnet/GuiExample/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
15 changes: 15 additions & 0 deletions onnx_project/dotnet/GuiExample/GuiExample.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="WPF-UI" Version="2.1.0" />
</ItemGroup>

</Project>
49 changes: 49 additions & 0 deletions onnx_project/dotnet/GuiExample/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<Window x:Class="GuiExample.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:GuiExample"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
mc:Ignorable="d"
Title="GUI Example of FF14 Ja→Ko Translator" Height="400" Width="600">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="AUTO"/>
<RowDefinition Height="7*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Margin="4">
<StackPanel Orientation="Vertical">
<Expander Header="Model Configuration" IsExpanded="True" Margin="4">
<StackPanel Orientation="Horizontal">
<ui:Button Content="Download"/>
<Border Width="24"/>
<Button Content="Load Model"/>
</StackPanel>
</Expander>
<ui:Card Margin="4">
<Grid>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<Button Content="Input 1"/>
<Border Width="8"/>
<Button Content="Input 2"/>
<Border Width="8"/>
<Button Content="Input 3"/>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Content="Translate"/>
</StackPanel>
</Grid>
</ui:Card>
</StackPanel>
</Grid>
<Grid Grid.Row="1" Margin="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<TextBox DockPanel.Dock="Left" Text="src" Margin="4"/>
<TextBox Grid.Column="1" DockPanel.Dock="Right" Text="dst" Margin="4"/>
</Grid>
</Grid>
</Window>
24 changes: 24 additions & 0 deletions onnx_project/dotnet/GuiExample/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace GuiExample
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}
14 changes: 10 additions & 4 deletions onnx_project/dotnet/onnxtest.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,26 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "infer_onnx", "infer_onnx\infer_onnx.csproj", "{FDD3B36A-50D6-4E06-BBA0-AE3F1F32881D}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "infer_onnx", "infer_onnx\infer_onnx.csproj", "{FDD3B36A-50D6-4E06-BBA0-AE3F1F32881D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GuiExample", "GuiExample\GuiExample.csproj", "{9EA84F50-F200-48D7-8925-853D92CC7C95}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FDD3B36A-50D6-4E06-BBA0-AE3F1F32881D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FDD3B36A-50D6-4E06-BBA0-AE3F1F32881D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FDD3B36A-50D6-4E06-BBA0-AE3F1F32881D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FDD3B36A-50D6-4E06-BBA0-AE3F1F32881D}.Release|Any CPU.Build.0 = Release|Any CPU
{9EA84F50-F200-48D7-8925-853D92CC7C95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9EA84F50-F200-48D7-8925-853D92CC7C95}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9EA84F50-F200-48D7-8925-853D92CC7C95}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9EA84F50-F200-48D7-8925-853D92CC7C95}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

0 comments on commit 44416d9

Please sign in to comment.