Templates & Templates & Templates

This commit is contained in:
cra0zy 2017-10-26 19:49:21 +02:00
parent ccb48b505c
commit 77a12bc24f
30 changed files with 250 additions and 113 deletions

View file

@ -1,17 +0,0 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoDevelop.GtkSharp.Addin", "MonoDevelop.GtkSharp.Addin\MonoDevelop.GtkSharp.Addin.csproj", "{52AC8491-F6B7-4631-92BA-D5E95A091B74}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{52AC8491-F6B7-4631-92BA-D5E95A091B74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{52AC8491-F6B7-4631-92BA-D5E95A091B74}.Debug|Any CPU.Build.0 = Debug|Any CPU
{52AC8491-F6B7-4631-92BA-D5E95A091B74}.Release|Any CPU.ActiveCfg = Release|Any CPU
{52AC8491-F6B7-4631-92BA-D5E95A091B74}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View file

@ -1,96 +1,96 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{52AC8491-F6B7-4631-92BA-D5E95A091B74}</ProjectGuid> <ProjectGuid>{52AC8491-F6B7-4631-92BA-D5E95A091B74}</ProjectGuid>
<ProjectTypeGuids>{86F6BF2A-E449-4B3E-813B-9ACC37E5545F};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> <ProjectTypeGuids>{86F6BF2A-E449-4B3E-813B-9ACC37E5545F};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace>MonoDevelop.GtkSharp.Addin</RootNamespace> <RootNamespace>MonoDevelop.GtkSharp.Addin</RootNamespace>
<AssemblyName>MonoDevelop.GtkSharp.Addin</AssemblyName> <AssemblyName>MonoDevelop.GtkSharp.Addin</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath> <OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants> <DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath> <OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\AddinInfo.cs" /> <Compile Include="Properties\AddinInfo.cs" />
<Compile Include="CheckMissing.cs" /> <Compile Include="CheckMissing.cs" />
<Compile Include="GladeDisplayBindings.cs" /> <Compile Include="GladeDisplayBindings.cs" />
<Compile Include="GladeDesktopApplication.cs" /> <Compile Include="GladeDesktopApplication.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="Properties\Manifest.addin.xml" /> <EmbeddedResource Include="Properties\Manifest.addin.xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="Templates\Projects\GtkSharpProject.CS.xpt.xml"> <None Include="Templates\Projects\GtkSharpProject.CS.xpt.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Templates\Projects\Data\Program.cs"> <None Include="Templates\Projects\Data\Program.cs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Templates\Projects\Data\MainWindow.glade"> <None Include="Templates\Projects\Data\MainWindow.glade">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Templates\Projects\Data\MainWindow.cs"> <None Include="Templates\Projects\Data\MainWindow.cs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Templates\File\Window.CS.xft.xml"> <None Include="Templates\File\Window.CS.xft.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Templates\File\Data\Window.glade"> <None Include="Templates\File\Data\Window.glade">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Templates\File\Data\Window.cs"> <None Include="Templates\File\Data\Window.cs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Templates\File\Data\Dialog.glade"> <None Include="Templates\File\Data\Dialog.glade">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Templates\File\Data\Dialog.cs"> <None Include="Templates\File\Data\Dialog.cs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Templates\File\Dialog.CS.xft.xml"> <None Include="Templates\File\Dialog.CS.xft.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Templates\File\Data\Widget.glade"> <None Include="Templates\File\Data\Widget.glade">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Templates\File\Data\Widget.cs"> <None Include="Templates\File\Data\Widget.cs">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Templates\File\Widget.CS.xft.xml"> <None Include="Templates\File\Widget.CS.xft.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Templates\Projects\GtkSharpProject.FS.xpt.xml"> <None Include="Templates\Projects\GtkSharpProject.FS.xpt.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="glade.sh"> <None Include="glade.sh">
<LogicalName>glade.sh</LogicalName> <LogicalName>glade.sh</LogicalName>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Templates\" /> <Folder Include="Templates\" />
<Folder Include="Templates\Projects\" /> <Folder Include="Templates\Projects\" />
<Folder Include="Templates\Projects\Data\" /> <Folder Include="Templates\Projects\Data\" />
<Folder Include="Templates\File\" /> <Folder Include="Templates\File\" />
<Folder Include="Templates\File\Data\" /> <Folder Include="Templates\File\Data\" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\MonoDevelop.Addins.0.3.3\build\net40\MonoDevelop.Addins.targets" Condition="Exists('..\packages\MonoDevelop.Addins.0.3.3\build\net40\MonoDevelop.Addins.targets')" /> <Import Project="..\packages\MonoDevelop.Addins.0.3.3\build\net40\MonoDevelop.Addins.targets" Condition="Exists('..\packages\MonoDevelop.Addins.0.3.3\build\net40\MonoDevelop.Addins.targets')" />
</Project> </Project>

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<package>
<metadata>
<id>Gtk.Template.CSharp</id>
<version>3.0.0</version>
<title>Gtk template for CSharp</title>
<summary>A simple C# template for your .Net Core Gtk Application.</summary>
<description>A simple C# template for your .Net Core Gtk Application.</description>
<authors>GLibSharp Team</authors>
<owners>GLibSharp Team</owners>
<projectUrl>https://github.com/GLibSharp/GtkSharp</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<releaseNotes></releaseNotes>
<tags>gtk app dotnet new template</tags>
<packageTypes>
<packageType name="Template" />
</packageTypes>
</metadata>
</package>

View file

@ -0,0 +1,15 @@
{
"$schema": "http://json.schemastore.org/template",
"author": "GLibSharp Team",
"classifications": [ "Console" ],
"name": "Gtk Application",
"identity": "Gtk.Template.CSharp",
"groupIdentity": "Gtk.Template",
"shortName": "gtkapp",
"tags": {
"language": "C#",
"type": "project"
},
"sourceName": "GtkNamespace",
"preferNameDirectory": true
}

View file

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<EmbeddedResource Include="MainWindow.glade">
<LogicalName>MainWindow.glade</LogicalName>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="GtkSharp" Version="3.2.0" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,37 @@
using System;
using Gtk;
using UI = Gtk.Builder.ObjectAttribute;
namespace GtkNamespace
{
class MainWindow : Window
{
#pragma warning disable 0649
[UI] private Label _label1;
[UI] private Button _button1;
#pragma warning restore 0649
private int _counter;
public MainWindow() : this(new Builder("MainWindow.glade")) { }
private MainWindow(Builder builder) : base(builder.GetObject("MainWindow").Handle)
{
builder.Autoconnect(this);
DeleteEvent += OnDeleteEvent;
_button1.Clicked += Button1_Clicked;
}
private void OnDeleteEvent(object sender, DeleteEventArgs a)
{
Application.Quit();
}
private void Button1_Clicked(object sender, EventArgs a)
{
_counter++;
_label1.Text = "Hello World! This button has been clicked " + _counter + " time(s).";
}
}
}

View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.18"/>
<object class="GtkWindow" id="MainWindow">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Example Window</property>
<property name="default_width">480</property>
<property name="default_height">240</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">4</property>
<property name="margin_right">4</property>
<property name="margin_top">4</property>
<property name="margin_bottom">4</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="_label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Hello World!</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="_button1">
<property name="label" translatable="yes">Click me!</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View file

@ -0,0 +1,23 @@
using System;
using Gtk;
namespace GtkNamespace
{
class Program
{
[STAThread]
public static void Main(string[] args)
{
Application.Init();
var app = new Application("org.GtkNamespace.GtkNamespace", GLib.ApplicationFlags.None);
app.Register(GLib.Cancellable.Current);
var win = new MainWindow();
app.AddWindow(win);
win.Show();
Application.Run();
}
}
}