-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate to .NET 6 and Electron.NET 23.6.1
- Loading branch information
1 parent
3e27644
commit 046a171
Showing
40 changed files
with
6,971 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{ | ||
"$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.5.json", | ||
"version": "2.1.0", | ||
"runs": [ | ||
{ | ||
"tool": { | ||
"driver": { | ||
"name": "Dependency Analysis", | ||
"semanticVersion": "0.4.355802", | ||
"informationUri": "https://docs.microsoft.com/en-us/dotnet/core/porting/upgrade-assistant-overview", | ||
"rules": [ | ||
{ | ||
"id": "UA106", | ||
"name": "PackageToBeAdded", | ||
"fullDescription": { | ||
"text": "Packages that need to be added in order to upgrade the project to chosen TFM" | ||
}, | ||
"helpUri": "https://docs.microsoft.com/en-us/dotnet/core/porting/upgrade-assistant-overview" | ||
} | ||
] | ||
} | ||
}, | ||
"results": [ | ||
{ | ||
"ruleId": "UA106", | ||
"message": { | ||
"text": "Package Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers, Version=0.4.410601 needs to be added." | ||
}, | ||
"locations": [ | ||
{ | ||
"physicalLocation": { | ||
"artifactLocation": { | ||
"uri": "file:///C:/Users/Gregor/source/repos/electron.net-api-demos/ElectronNET-API-Demos/ElectronNET-API-Demos.csproj" | ||
}, | ||
"region": {} | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"ruleId": "UA106", | ||
"message": { | ||
"text": "Package Microsoft.AspNetCore.Mvc.NewtonsoftJson, Version=7.0.4 needs to be added." | ||
}, | ||
"locations": [ | ||
{ | ||
"physicalLocation": { | ||
"artifactLocation": { | ||
"uri": "file:///C:/Users/Gregor/source/repos/electron.net-api-demos/ElectronNET-API-Demos/ElectronNET-API-Demos.csproj" | ||
}, | ||
"region": {} | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"columnKind": "utf16CodeUnits" | ||
}, | ||
{ | ||
"tool": { | ||
"driver": { | ||
"name": "API Upgradability", | ||
"semanticVersion": "0.4.355802", | ||
"informationUri": "https://docs.microsoft.com/en-us/dotnet/core/porting/upgrade-assistant-overview" | ||
} | ||
}, | ||
"results": [], | ||
"columnKind": "utf16CodeUnits" | ||
}, | ||
{ | ||
"tool": { | ||
"driver": { | ||
"name": "Component Analysis", | ||
"semanticVersion": "0.4.355802", | ||
"informationUri": "https://docs.microsoft.com/en-us/dotnet/core/porting/upgrade-assistant-overview" | ||
} | ||
}, | ||
"results": [], | ||
"columnKind": "utf16CodeUnits" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
ElectronNET-API-Demos/Controllers/ManageWindowsController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Mvc; | ||
using ElectronNET.API; | ||
using ElectronNET.API.Entities; | ||
|
||
namespace ElectronNET.WebApp.Controllers | ||
{ | ||
public class WindowsController : Controller | ||
{ | ||
public IActionResult Index() | ||
{ | ||
string viewPath = $"http://localhost:{BridgeSettings.WebPort}/windows/demowindow"; | ||
|
||
Electron.IpcMain.On("new-window", async (args) => { | ||
|
||
await Electron.WindowManager.CreateWindowAsync(viewPath); | ||
|
||
}); | ||
|
||
Electron.IpcMain.On("manage-window", async (args) => { | ||
|
||
var browserWindow = await Electron.WindowManager.CreateWindowAsync(viewPath); | ||
browserWindow.OnMove += UpdateReply; | ||
browserWindow.OnResize += UpdateReply; | ||
}); | ||
|
||
Electron.IpcMain.On("listen-to-window", async (args) => { | ||
var mainBrowserWindow = Electron.WindowManager.BrowserWindows.First(); | ||
|
||
var browserWindow = await Electron.WindowManager.CreateWindowAsync(viewPath); | ||
browserWindow.OnFocus += () => Electron.IpcMain.Send(mainBrowserWindow, "listen-to-window-focus"); | ||
browserWindow.OnBlur += () => Electron.IpcMain.Send(mainBrowserWindow, "listen-to-window-blur"); | ||
|
||
Electron.IpcMain.On("listen-to-window-set-focus", (x) => browserWindow.Focus()); | ||
}); | ||
|
||
Electron.IpcMain.On("frameless-window", async (args) => { | ||
var options = new BrowserWindowOptions | ||
{ | ||
Frame = false | ||
}; | ||
await Electron.WindowManager.CreateWindowAsync(options, viewPath); | ||
}); | ||
|
||
return View(); | ||
} | ||
|
||
private async void UpdateReply() | ||
{ | ||
var browserWindow = Electron.WindowManager.BrowserWindows.Last(); | ||
var size = await browserWindow.GetSizeAsync(); | ||
var position = await browserWindow.GetPositionAsync(); | ||
string message = $"Size: {size[0]},{size[1]} Position: {position[0]},{position[1]}"; | ||
|
||
var mainWindow = Electron.WindowManager.BrowserWindows.First(); | ||
Electron.IpcMain.Send(mainWindow, "manage-window-reply", message); | ||
} | ||
|
||
public IActionResult DemoWindow() | ||
{ | ||
return View(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.