From 2997ab7c7ec674127577309ea2d24abc4e30c375 Mon Sep 17 00:00:00 2001 From: luxick Date: Wed, 17 Jun 2020 21:03:51 +0200 Subject: [PATCH] Initial --- .gitignore | 6 ++ .../Controllers/WeatherForecastController.cs | 39 +++++++++++ Mino.Api/Mino.Api.csproj | 15 +++++ Mino.Api/Program.cs | 23 +++++++ Mino.Api/Properties/launchSettings.json | 30 +++++++++ Mino.Api/Startup.cs | 48 ++++++++++++++ Mino.Api/WeatherForecast.cs | 15 +++++ Mino.Api/appsettings.Development.json | 9 +++ Mino.Api/appsettings.json | 10 +++ Mino.Gtk/Mino.Gtk.csproj | 23 +++++++ Mino.Gtk/Program.cs | 17 +++++ Mino.Wpf/Mino.Wpf.csproj | 16 +++++ Mino.Wpf/Program.cs | 14 ++++ Mino.sln | 44 +++++++++++++ Mino.sln.DotSettings.user | 2 + Mino/Commands/SyncCommand.cs | 27 ++++++++ Mino/MainForm.cs | 65 +++++++++++++++++++ Mino/MarkdownArea.cs | 51 +++++++++++++++ Mino/Mino.csproj | 11 ++++ README.md | 1 + 20 files changed, 466 insertions(+) create mode 100644 .gitignore create mode 100644 Mino.Api/Controllers/WeatherForecastController.cs create mode 100644 Mino.Api/Mino.Api.csproj create mode 100644 Mino.Api/Program.cs create mode 100644 Mino.Api/Properties/launchSettings.json create mode 100644 Mino.Api/Startup.cs create mode 100644 Mino.Api/WeatherForecast.cs create mode 100644 Mino.Api/appsettings.Development.json create mode 100644 Mino.Api/appsettings.json create mode 100644 Mino.Gtk/Mino.Gtk.csproj create mode 100644 Mino.Gtk/Program.cs create mode 100644 Mino.Wpf/Mino.Wpf.csproj create mode 100644 Mino.Wpf/Program.cs create mode 100644 Mino.sln create mode 100644 Mino.sln.DotSettings.user create mode 100644 Mino/Commands/SyncCommand.cs create mode 100644 Mino/MainForm.cs create mode 100644 Mino/MarkdownArea.cs create mode 100644 Mino/Mino.csproj create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f400df3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +bin/ +obj/ +/packages/ +riderModule.iml +/_ReSharper.Caches/ +.idea/ \ No newline at end of file diff --git a/Mino.Api/Controllers/WeatherForecastController.cs b/Mino.Api/Controllers/WeatherForecastController.cs new file mode 100644 index 0000000..826513c --- /dev/null +++ b/Mino.Api/Controllers/WeatherForecastController.cs @@ -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 _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet] + public IEnumerable 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(); + } + } +} \ No newline at end of file diff --git a/Mino.Api/Mino.Api.csproj b/Mino.Api/Mino.Api.csproj new file mode 100644 index 0000000..a8d38ae --- /dev/null +++ b/Mino.Api/Mino.Api.csproj @@ -0,0 +1,15 @@ + + + + netcoreapp3.1 + linux-x64 + true + true + + + + + + + + diff --git a/Mino.Api/Program.cs b/Mino.Api/Program.cs new file mode 100644 index 0000000..bc290db --- /dev/null +++ b/Mino.Api/Program.cs @@ -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(); }); + } +} \ No newline at end of file diff --git a/Mino.Api/Properties/launchSettings.json b/Mino.Api/Properties/launchSettings.json new file mode 100644 index 0000000..1822863 --- /dev/null +++ b/Mino.Api/Properties/launchSettings.json @@ -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" + } + } + } +} diff --git a/Mino.Api/Startup.cs b/Mino.Api/Startup.cs new file mode 100644 index 0000000..43baf01 --- /dev/null +++ b/Mino.Api/Startup.cs @@ -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(); }); + } + } +} \ No newline at end of file diff --git a/Mino.Api/WeatherForecast.cs b/Mino.Api/WeatherForecast.cs new file mode 100644 index 0000000..379c247 --- /dev/null +++ b/Mino.Api/WeatherForecast.cs @@ -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; } + } +} \ No newline at end of file diff --git a/Mino.Api/appsettings.Development.json b/Mino.Api/appsettings.Development.json new file mode 100644 index 0000000..8983e0f --- /dev/null +++ b/Mino.Api/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/Mino.Api/appsettings.json b/Mino.Api/appsettings.json new file mode 100644 index 0000000..d9d9a9b --- /dev/null +++ b/Mino.Api/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" +} diff --git a/Mino.Gtk/Mino.Gtk.csproj b/Mino.Gtk/Mino.Gtk.csproj new file mode 100644 index 0000000..54c3a0d --- /dev/null +++ b/Mino.Gtk/Mino.Gtk.csproj @@ -0,0 +1,23 @@ + + + Exe + netcoreapp3.1 + linux-x64 + true + true + + + + Project + false + + + + + + + + + + + diff --git a/Mino.Gtk/Program.cs b/Mino.Gtk/Program.cs new file mode 100644 index 0000000..427ca01 --- /dev/null +++ b/Mino.Gtk/Program.cs @@ -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()); + } + } +} \ No newline at end of file diff --git a/Mino.Wpf/Mino.Wpf.csproj b/Mino.Wpf/Mino.Wpf.csproj new file mode 100644 index 0000000..533373b --- /dev/null +++ b/Mino.Wpf/Mino.Wpf.csproj @@ -0,0 +1,16 @@ + + + + WinExe + netcoreapp3.1 + + + + + + + + + + + diff --git a/Mino.Wpf/Program.cs b/Mino.Wpf/Program.cs new file mode 100644 index 0000000..1775a4b --- /dev/null +++ b/Mino.Wpf/Program.cs @@ -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()); + } + } +} \ No newline at end of file diff --git a/Mino.sln b/Mino.sln new file mode 100644 index 0000000..61276c0 --- /dev/null +++ b/Mino.sln @@ -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 diff --git a/Mino.sln.DotSettings.user b/Mino.sln.DotSettings.user new file mode 100644 index 0000000..cf29e62 --- /dev/null +++ b/Mino.sln.DotSettings.user @@ -0,0 +1,2 @@ + + True \ No newline at end of file diff --git a/Mino/Commands/SyncCommand.cs b/Mino/Commands/SyncCommand.cs new file mode 100644 index 0000000..61870cd --- /dev/null +++ b/Mino/Commands/SyncCommand.cs @@ -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); + } + } +} \ No newline at end of file diff --git a/Mino/MainForm.cs b/Mino/MainForm.cs new file mode 100644 index 0000000..9dc81b1 --- /dev/null +++ b/Mino/MainForm.cs @@ -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 + }; + } + } +} \ No newline at end of file diff --git a/Mino/MarkdownArea.cs b/Mino/MarkdownArea.cs new file mode 100644 index 0000000..2fb0f04 --- /dev/null +++ b/Mino/MarkdownArea.cs @@ -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); + // } + // } + } +} \ No newline at end of file diff --git a/Mino/Mino.csproj b/Mino/Mino.csproj new file mode 100644 index 0000000..4fe1263 --- /dev/null +++ b/Mino/Mino.csproj @@ -0,0 +1,11 @@ + + + + netstandard2.0 + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..260d3bb --- /dev/null +++ b/README.md @@ -0,0 +1 @@ + # Mino \ No newline at end of file