This commit is contained in:
2020-06-17 21:03:51 +02:00
commit 2997ab7c7e
20 changed files with 466 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@@ -0,0 +1,6 @@
bin/
obj/
/packages/
riderModule.iml
/_ReSharper.Caches/
.idea/

View File

@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
namespace Mino.Api.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
private readonly ILogger<WeatherForecastController> _logger;
public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}
[HttpGet]
public IEnumerable<WeatherForecast> Get()
{
var rng = new Random();
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = rng.Next(-20, 55),
Summary = Summaries[rng.Next(Summaries.Length)]
})
.ToArray();
}
}
}

15
Mino.Api/Mino.Api.csproj Normal file
View File

@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>
<ItemGroup>
<Folder Include="Database" />
</ItemGroup>
</Project>

23
Mino.Api/Program.cs Normal file
View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace Mino.Api
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
}
}

View File

@@ -0,0 +1,30 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:23767",
"sslPort": 44392
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "weatherforecast",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Mino.Api": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "weatherforecast",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

48
Mino.Api/Startup.cs Normal file
View File

@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace Mino.Api
{
public class Startup
{
public Startup(IConfiguration configuration)
{
Configuration = configuration;
}
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseHttpsRedirection();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints => { endpoints.MapControllers(); });
}
}
}

View File

@@ -0,0 +1,15 @@
using System;
namespace Mino.Api
{
public class WeatherForecast
{
public DateTime Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int) (TemperatureC / 0.5556);
public string Summary { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

10
Mino.Api/appsettings.json Normal file
View File

@@ -0,0 +1,10 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}

23
Mino.Gtk/Mino.Gtk.csproj Normal file
View File

@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<PublishSingleFile>true</PublishSingleFile>
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>
<PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' ">
<StartAction>Project</StartAction>
<ExternalConsole>false</ExternalConsole>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Mino\Mino.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Eto.Platform.Gtk" Version="2.5.2" />
</ItemGroup>
</Project>

17
Mino.Gtk/Program.cs Normal file
View File

@@ -0,0 +1,17 @@
using System;
using Eto;
using Eto.Drawing;
using Eto.Forms;
using Eto.GtkSharp.Forms.Controls;
namespace Mino.Gtk
{
class MainClass
{
[STAThread]
public static void Main(string[] args)
{
new Application(Eto.Platforms.Gtk).Run(new MainForm());
}
}
}

16
Mino.Wpf/Mino.Wpf.csproj Normal file
View File

@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>netcoreapp3.1</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Mino\Mino.csproj"/>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Eto.Platform.Wpf" Version="2.5.2"/>
</ItemGroup>
</Project>

14
Mino.Wpf/Program.cs Normal file
View File

@@ -0,0 +1,14 @@
using System;
using Eto.Forms;
namespace Mino.Wpf
{
class MainClass
{
[STAThread]
public static void Main(string[] args)
{
new Application(Eto.Platforms.Wpf).Run(new MainForm());
}
}
}

44
Mino.sln Normal file
View File

@@ -0,0 +1,44 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mino", "Mino\Mino.csproj", "{19917542-BE90-4FCB-B4C5-A17671CBBBE1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mino.Gtk", "Mino.Gtk\Mino.Gtk.csproj", "{38F6A766-25A7-4D3C-AE9E-6B129B2815A4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mino.Wpf", "Mino.Wpf\Mino.Wpf.csproj", "{72054FA2-974F-4EED-8033-3EA382CC02B0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Desktop", "Desktop", "{F9BE77B4-2619-46D6-B5C4-C3861B173E50}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Server", "Server", "{C699AC55-4CDC-464C-89CF-AF4581EBC153}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mino.Api", "Mino.Api\Mino.Api.csproj", "{029F5CD7-E578-402A-AF5B-3D2DFB73A326}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{19917542-BE90-4FCB-B4C5-A17671CBBBE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{19917542-BE90-4FCB-B4C5-A17671CBBBE1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{19917542-BE90-4FCB-B4C5-A17671CBBBE1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{19917542-BE90-4FCB-B4C5-A17671CBBBE1}.Release|Any CPU.Build.0 = Release|Any CPU
{38F6A766-25A7-4D3C-AE9E-6B129B2815A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{38F6A766-25A7-4D3C-AE9E-6B129B2815A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{38F6A766-25A7-4D3C-AE9E-6B129B2815A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{38F6A766-25A7-4D3C-AE9E-6B129B2815A4}.Release|Any CPU.Build.0 = Release|Any CPU
{72054FA2-974F-4EED-8033-3EA382CC02B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{72054FA2-974F-4EED-8033-3EA382CC02B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72054FA2-974F-4EED-8033-3EA382CC02B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{72054FA2-974F-4EED-8033-3EA382CC02B0}.Release|Any CPU.Build.0 = Release|Any CPU
{029F5CD7-E578-402A-AF5B-3D2DFB73A326}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{029F5CD7-E578-402A-AF5B-3D2DFB73A326}.Debug|Any CPU.Build.0 = Debug|Any CPU
{029F5CD7-E578-402A-AF5B-3D2DFB73A326}.Release|Any CPU.ActiveCfg = Release|Any CPU
{029F5CD7-E578-402A-AF5B-3D2DFB73A326}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{19917542-BE90-4FCB-B4C5-A17671CBBBE1} = {F9BE77B4-2619-46D6-B5C4-C3861B173E50}
{38F6A766-25A7-4D3C-AE9E-6B129B2815A4} = {F9BE77B4-2619-46D6-B5C4-C3861B173E50}
{72054FA2-974F-4EED-8033-3EA382CC02B0} = {F9BE77B4-2619-46D6-B5C4-C3861B173E50}
{029F5CD7-E578-402A-AF5B-3D2DFB73A326} = {C699AC55-4CDC-464C-89CF-AF4581EBC153}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=Mino/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -0,0 +1,27 @@
using System;
using Eto.Forms;
namespace Mino.Commands
{
public class SyncCommand : Command
{
public Window MainWindow { get; set; }
public SyncCommand()
{
MenuText = "Sync";
ToolBarText = "Sync";
ToolTip = "Resync database with server";
Shortcut = Application.Instance.CommonModifier | Application.Instance.AlternateModifier | Keys.S;
}
protected override void OnExecuted(EventArgs e)
{
base.OnExecuted(e);
var dlg = new Dialog
{
Content = new Label {Text = "It Works"}
};
dlg.ShowModal(MainWindow);
}
}
}

65
Mino/MainForm.cs Normal file
View File

@@ -0,0 +1,65 @@
using Eto.Forms;
using Eto.Drawing;
using Mino.Commands;
namespace Mino
{
public partial class MainForm : Form
{
public MainForm()
{
Title = "Mino";
ClientSize = new Size(800, 600);
Content = new TableLayout
(
new MarkdownArea(this)
);
// create menu
AddMenuBar();
// create toolbar
ToolBar = new ToolBar {};
}
private void AddMenuBar()
{
var aboutItem = new ButtonMenuItem { Text = "About..." };
aboutItem.Click += (sender, e) =>
{
var dlg = new Dialog
{
Content = new Label { Text = "About my app..." },
ClientSize = new Size(200, 200)
};
dlg.ShowModal(this);
};
Menu = new MenuBar
{
Items =
{
new ButtonMenuItem
{
Text = "&File",
Items =
{
new SyncCommand {MainWindow = this},
}
}
},
ApplicationItems =
{
// application (OS X) or file menu (others)
new ButtonMenuItem {Text = "&Preferences..."},
},
QuitItem = new Command((sender, e) => Application.Instance.Quit())
{
MenuText = "Quit",
Shortcut = Application.Instance.CommonModifier | Keys.Q
},
AboutItem = aboutItem
};
}
}
}

51
Mino/MarkdownArea.cs Normal file
View File

@@ -0,0 +1,51 @@
using Eto.Forms;
namespace Mino
{
public class MarkdownArea : TextArea
{
private readonly Window _owner;
public MarkdownArea(Window owner)
{
_owner = owner;
Style = "TextConsole";
}
protected override void OnKeyDown(KeyEventArgs e)
{
e.Handled = true;
if (e.Alt && e.Key == Keys.Enter)
{
var dlg = new Dialog
{
Content = new Label {Text = "Insert new Item of: ???"}
};
dlg.ShowModal(_owner);
}
else
{
e.Handled = false;
base.OnKeyDown(e);
}
}
// protected override void OnKeyUp(KeyEventArgs e)
// {
// e.Handled = true;
// if (e.Alt && e.Key == Keys.Enter)
// {
// var dlg = new Dialog
// {
// Content = new Label {Text = "Insert new Item of: ???"}
// };
// dlg.ShowModal(_owner);
// }
// else
// {
// e.Handled = false;
// base.OnKeyUp(e);
// }
// }
}
}

11
Mino/Mino.csproj Normal file
View File

@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Eto.Forms" Version="2.5.2" />
</ItemGroup>
</Project>

1
README.md Normal file
View File

@@ -0,0 +1 @@
# Mino