implement first demo app template

This commit is contained in:
Gregor Biswanger
2017-10-19 06:01:54 +02:00
parent 3cdf667457
commit 98fdb519a5
62 changed files with 1446 additions and 128 deletions

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace ElectronNET.WebApp.Controllers
{
public class AboutController : Controller
{
public IActionResult Index()
{
return View();
}
}
}

View File

@@ -1,48 +1,11 @@
using Microsoft.AspNetCore.Mvc;
using ElectronNET.API;
using ElectronNET.API.Entities;
using System.Linq;
namespace ElectronNET.WebApp.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
Electron.IpcMain.On("SayHello", async (args) =>
{
Electron.Notification.Show(new NotificationOptions("Hallo Robert", "Nachricht von ASP.NET Core App"));
Electron.IpcMain.Send(Electron.WindowManager.BrowserWindows.First(), "Goodbye", "Elephant!");
var currentBrowserWindow = Electron.WindowManager.BrowserWindows.First();
var openDialogOptions = new OpenDialogOptions
{
Title = "Wuhuuu",
ButtonLabel = "Mhh Okay",
DefaultPath = await Electron.App.GetPathAsync(PathName.pictures),
Message = "Hello World",
Properties = new OpenDialogProperty[] { OpenDialogProperty.openDirectory }
};
var filePaths = await Electron.Dialog.ShowOpenDialogAsync(currentBrowserWindow, openDialogOptions);
});
Electron.IpcMain.On("GetPath", async (args) =>
{
Electron.Notification.Show(new NotificationOptions("test", "test2"));
var currentBrowserWindow = Electron.WindowManager.BrowserWindows.First();
string pathName = await Electron.App.GetPathAsync(PathName.pictures);
Electron.IpcMain.Send(currentBrowserWindow, "GetPathComplete", pathName);
currentBrowserWindow.Minimize();
await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions {
Title = "My second Window",
AutoHideMenuBar = true
},"http://www.google.de");
});
{
return View();
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using ElectronNET.API;
namespace ElectronNET.WebApp.Controllers
{
public class WindowsController : Controller
{
public IActionResult Index()
{
Electron.IpcMain.On("new-window", async (args) => {
await Electron.WindowManager.CreateWindowAsync();
});
return View();
}
}
}