tryphotino / photino.net Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://tryphotino.io
License: Apache License 2.0
Home Page: https://tryphotino.io
License: Apache License 2.0
Hi thank you all for such a great library.
I have a page with only one input in it for QR scanner data.
In Chrome, Edge after page load focus is on my input but via PhotinoWindow focus is lost.
Seems focus is on PhotinoWindow itself not in document.
Hello
When creating the PhotinoWindow and setting the size, nothing happens.
Hello there, I am really interested in this project and tried out the samples. However, I wasn't able to run the samples unless I updated Photino.NET to v1.1.5 and even then it automatically started installing "Microsoft Edge WebView2" on its own (without even asking first) when I am on Windows 10 (Home) and do have Microsoft edge on it
Another issue I found is that the window freezes when I try to exit it
Is there a way to access webView for custom configuration?
I have React app and test against a rest api that is on HTTPS with a self signed certificate just for testing. In chrome I just put the server's url insecure content setting to 'allow' so that chrome permits me to do request. In Photino I get the following form WebKit's console: Failed to load resource: Unacceptable TLS certificate
. Is there a way around this?
I decided to use Photino for a real (but small) project. So far everything is going smoothly. I have one question regarding JavaScript debugging. I know that F12 brings up the Edge Dev Tools where I can inspect variables and set breakpoints. That is great. But is it possible to debug JavaScript using the Visual Studio debugger? What would be needed to make that work?
We want to start a Blazor app maximized. Unfortunately there is no possibility to do this in the Constructor of the PhotinoWindow or in ComponentsDesktop.Run, similar to the WindowState in Windows Forms.
Scenario:
-published and copied the Hello demo to an Unbuntu 20.04 VM.
-Installed .NET 5 runtime (sudo snap install dotnet-sdk --classic --channel=5.0)
-Installed WebkitGTK+ (sudo apt-get update && sudo apt-get install libgtk-3-dev libwebkit2gtk-4.0-dev)
-Running the app (dotnet HelloPhotino.NET1.dll)
Creating new PhotinoWindow instance.
Unhandled exception. System.DllNotFoundException: Unable to load shared library 'Photino.Native' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libPhotino.Native: cannot open shared object file: No such file or directory
at PhotinoNET.PhotinoWindow.Photino_ctor(String title, IntPtr parentPhotinoNET, WebMessageReceivedDelegate webMessageReceivedCallback, Boolean fullscreen, Int32 x, Int32 y, Int32 width, Int32 height)
at PhotinoNET.PhotinoWindow..ctor(String title, Action`1 configure, Int32 width, Int32 height, Int32 left, Int32 top, Boolean fullscreen)
at HelloPhotinoApp.Program.Main(String[] args) in E:\NeoSim\Photino\HelloPhotino.NET1\Program.cs:line 21
Aborted (core dumped)
The shared libray is present:
-runtimes/linux-x64/native/Photino.Native.so
When we try to access the "Notification API" or devices such as a camera or microphone, we get the following error messages.
Notification API:
The Notification API may no longer be used from insecure origins. You should consider switching your application to a secure origin, such as HTTPS.
Devices:
TypeError: Cannot read property 'enumerateDevices' of undefined
I succesfully ported small winform application as a multiplatform desktop app running under Photino.
With one exception - RegisterWindowClosingHandler works on the windows, but not works on the linux.
When I click on the X (close icon on the toolbar), „closing event“ is not fired and when I close the child window (with X), whole application is closed. On the windows it works as expected.
I 'm just create an demo project .
for some reason i need to Embedded 'wwwroot' files to resources.
my custom schema handler:
options.CustomSchemeHandlers.Add("apps", (string url, out string contentType) =>
{
contentType = "text/javascript";
if (url.EndsWith(".js"))
{
}
if (url.EndsWith(".css"))
{
contentType = "text/css";
}
if (url.EndsWith(".htm")||url.EndsWith(".html"))
{
contentType = "text/html";
}
var path = url.Replace("apps://", string.Empty);
if (_embResourceDict.ContainsKey(path))
{
return new MemoryStream(_embResourceDict[path]) ;
}
else
{
contentType = "text/plain";
return new MemoryStream(_notFoundBytes) ;
}
});
and
but the problem is that can not load the index.html by custom schema at startup.
The sample photino demo app leaks memory at an alarming rate after the first pop message box is closed ("dynamically inserted javascript") over 1Gb after 10 secs idle and consumes cpu cycles constantly.
Since .NET 5 and .NET 6 still doesn't have a fully self-contained single file yet (while .NET Core 3.0/3.1 does) would you consider making Photino work with .NET Core 3.0/3.1 also so people has the option to get a fully self-contained single file application?
Or is there other plans for this?
How can I specify minimum window size?
If you restrict through WindowSizeChanged, by reassigning sizes, then it looks terrible in the final form, the window context starts jumping when it is reduced.
Hi there! I'm wanting to port a codebase from Bridge.NET to this (or something similar). Since it's Bridge, the C# in there basically is constantly interacting directly with the DOM - it is just C# that ends up being transpiled to Java.
Going over this project's APIs.... there doesn't appear to be any awareness of the DOM at all. Am I correct that the only way to really manipulate it would be to write a wrapper on the Javascript side that reads web messages telling it to manipulate a DOM object, and then sending a web message back indicating whether or not the task was completed? Is there already an existing library to do this?
I see difficulties in that this makes effectively every DOM operation an asynchronous task, whereas some do require responses (such as the creation of an element, you need a handle back). You can, of course, make everything that interacts with the DOM wait for a response using some kind of ID, but it does complicate it.
Hi,
I've been getting a blank index page from the sample projects as shown in the picture below.
I've checked that the index.html file does exist and that the program can see it. I've also tried using a link to a website to see if that would load instead.
I assume this could be an issue only on my machine but I can't seem to pinpoint what could cause this issue. Especially when I'm not getting any errors except one about the Touchbar: 2021-03-27 14:00:18.592 dotnet[43611:2198090] Warning: Expected min height of view: (<NSPopoverTouchBarItemButton: 0x7fe9d97180f0>) to be less than or equal to 30 but got a height of 32.000000. This error will be logged once per view in violation.
Any help would be appreciated.
When I update the nuget package, I get an error. Text:CS0234 The type or namespace name 'PhotinoNET' does not exist in the namespace 'PhotinoNET' (are you missing an assembly reference?)
When I go into the WindowProp.razor page and try to change it away from PhotinoNET.PhotinoNET to PhotinoNET.IPhotinoWindow or PhotinoWindow, I get an error saying that Topmost property is missing.
The developers are making changes in preparation for the next major release of Photino and we'd like some feedback. New features include: Chrome-less window support for user-drawn title bars and borders, ability to maximize, minimize and restore windows, support for multiple windows, ability to set window icon on initialization, ability to initialize windows with OS default position and sizes, fixes for "Error loading 'app' scheme" on macOS and Linux, change where WebView2 user folders are saved by default to avoid security issues on Windows when installing in ProgramFiles, and more!
We will also be introducing a 'builder' for creating new Photino windows, which is more consistent with .NET programming and, behind the scenes, we'll be passing a struct/object to the Photino.Native constructor instead of passing individual parameters.
With these changes, we'd like to get some feedback on the API we expose in Photino.NET. Since the builder will now be used for initialization (and fluent syntax will no longer work for initializing new windows), should we keep the fluent syntax for calls made after the instantiation? Is it useful of confusing?
Also, should we maintain access to the properties, or make all interaction happen through an expanded set of methods? For example, call MoveTo() or Offset() or Center() to move a window and not have the Top and Left properties accessible? No access to properties is more consistent with design principles for an API, reduces the documentation and API surface and provides consistency. On the other hand, it reduces the options for the programmer who prefers to use properties directly.
Currently, it's just a memory stream. Should we promote a standard JSON format for messages? Some way to make messages strongly typed?
Also, should we make "channels" to direct IPC calls.
Needs discussion and fleshing out.
The project dependencies have a reference to Newtonsoft.Json, but it is not used anywhere.
I have built a react project and I cant load it in photino
OS: macOS
photino.net version: 2.0.13
Source files: https://github.com/TheOnlyBeardedBeast/PhotinoFetch/tree/master/HelloPhotino/HelloPhotino
MacOS Big Sur 11.6
Running the first line of the example script dotnet new -i TryPhotino.VSCode.Project.Templates
does not work and failes with a
$ dotnet new --install TryPhotino.VSCode.Project.Templates::2.0.1
The following template packages will be installed:
TryPhotino.VSCode.Project.Templates::2.0.1
Warning: Failed to download TryPhotino.VSCode.Project.Templates::2.0.1 from NuGet feed https://api.nuget.org/v3/index.json.
TryPhotino.VSCode.Project.Templates::2.0.1 could not be installed, download failed.
Also the template repository seems to have been removed from github?
Just installed Photino for a test run and I love it (especially the small footprint).
However, I sometimes build scalable UI's, in which the zoom state is connected to the window size.
A zoom property is present in most other web window implementations (e.g. CefSharp),
but it seems to be missing in Photino.NET. I know it is there in Edge.WebView2, it just needs to be exposed.
The target of the link in README.md does not yet exist ;-)
On Linux, when you are trying to start a process after a photino (Webkit) window has been opened, it executes but never returns (Process.WaitForExit never returns and the Process.Exited event is never called).
here is a minimal example program to demonstrate the problem (dotnet 6, but it is the same under 5)
Expected behaviour:
Observed behaviour:
The code (with a different test command for windows) functions as expected (correctly) under both MacOS and Windows, but under Linux the problem exists. In this minimal example we run a process after a photino window has been closed, but the same behavior occurs if you do it in a messagehandler. So I believe the Linux webkit code interferes somehow? I've looked at the Photino.Native code but I could not determine the cause of the issue.
using PhotinoNET;
using System.Diagnostics;
// First Run, works as expected
TestProcess();
// Second Run, just to be sure
TestProcess();
var window = new PhotinoWindow();
window
.SetTitle("Process Test")
.SetMaximized(true)
.Center()
.Load("https://www.google.com");
window.WaitForClose();
// After Photino, the process exit code is never called?
TestProcess();
// Never gets here...
Console.WriteLine("Program is done!");
// Start a child process
void TestProcess() {
var cmd = "ls";
var cmdArgs = "";
var process = new Process
{
EnableRaisingEvents = true,
StartInfo = new ProcessStartInfo
{
CreateNoWindow = true,
ErrorDialog = false,
FileName = cmd,
Arguments = cmdArgs,
RedirectStandardError = true,
RedirectStandardInput = true,
RedirectStandardOutput = true,
UseShellExecute = false,
WorkingDirectory = "."
},
};
Console.WriteLine($"Starting process '{cmd} {cmdArgs}'");
process.Start();
process.Exited += (sender, args) =>
{
Console.WriteLine($"Proces exited event, exit code {process.ExitCode}");
};
string output = process.StandardOutput.ReadToEnd();
Console.WriteLine("Awaiting process exit...");
process.WaitForExit(); // After Photino window, never returns?
Console.WriteLine("Process exited");
}
The possibility to inject custom javascript would allow us to run custom javascript on external websites. This use case is suitable for things like web automation testing, web scrapers and bots.
As far as I know, that's not possible using the current version of Photino.
https://github.com/tryphotino/photino.Samples
I am looking for the sample photinoapp - basic .NET 5
First of all, thank you for the great work. I LOVE Photino.
I'm implementing an automatic reload feature in my application using FileSystemWatcher
. Because the file system events are raised from other thread, It is complicated to co-operate with the web browser thread.
Public Invoke(Action workItem)
method will solve that problem.
When I am using JetBrains Rider to debug my Photino app I an error. I don't get the error when running in Visual Studio.
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
I suspect that it is something to do with the Photino.Native part of the app. Should this question be posted there?
Hi,
Could you please add functionality (or sample showing) whereby you can create a PhotinoWindow and it receives events (loads page, mouse clicks works, etc.) without calling a blocking function like WaitForClose()
If I just call Show()
the window shows but it never accepts [OS] events until I call WaitForClose()
, which then blocks the current Thread/Task, which I don't want to do.
I am trying to tell Photino to close the window from C#, not from the user or the browser context.
When calling window.Close() the thread it is called from blocks (whether or not you use window.Invoke()
as suggested in #29)
Hi,
Is that possible to eliminate the use of *Wide Style property complete, even it's already internal?
a user just uses C# string like StartString, As for semantic level, the user just cares char.
maybe we can do this at #if level?
internal struct PhotinoNativeParameters
{
#if WINDOWS
[MarshalAs(UnmanagedType.LPUTF8Str)]
#else
[MarshalAs(UnmanagedType.LPWStr)]
#endif
internal string StartString;
}
Work has begun in the AdvancedNET sample. Will be moved to .NET when ready.
Hi, Congratulations on V2! Unfortunately, I am still hitting issues with my use scenario:
I am creating a window, showing some information for a short time, and then closing the window so that I can open another.
The reason I cannot navigate between pages is because I need the documents to be a "top-level browsing context[s], whose session history contains only one Document." So that I can close them from JavaScript with window.close()
.
var window = new PhotinoWindow()
// example only
window.WindowCreated += (sender, eventArgs) =>
{
Thread.Sleep(TimeSpan.FromSeconds(5));
window.Close();
};
window.Load(new Uri("https://localhost:5001/"));
window.WaitForClose();
window = null;
// let the message loop run for a bit to make sure everything is cleaned up
Thread.Sleep(100);
var window2 = new PhotinoWindow()
window2.Load(new Uri("https://localhost:5001/"));
window2.WaitForClose()
The second window shows and then instantly closes
I'm trying to reference
<script src="_content/Telerik.UI.for.Blazor/js/telerik-blazor.js" defer></script>
or
<link rel="stylesheet" href="_content/Telerik.UI.for.Blazor/css/kendo-theme-default/all.css" />
But it's not found.
Edit:
I've published the solution to a folder check where the files go. The _content folder was actually created on deploy and the references work. The folder isn't created during the debug build though....
I am trying out Photino in combination with a web server where I run the webserver and the phonito window in separate threads. I consistently get blank pages when running the window on a separate thread:
[STAThread]
static void Main(string[] args)
{
var window = new PhotinoNET.PhotinoWindow("HelloWorldReact App");
window.Center().LoadRawString("<h1>Hello from C#</h1>");
window.WaitForClose();
}
[STAThread]
static async Task Main(string[] args)
{
await Task.Run(() =>
{
var window = new PhotinoNET.PhotinoWindow("HelloWorldReact App");
window.Center().LoadRawString("<h1>Hello from C#</h1>");
window.WaitForClose();
});
}
Using Windows 10 (Home)
Photino.NET v1.1.6
Greetings,
using the sample app "HelloPhotino.NET" (or any other bare-bones configuration) on Ubuntu 20.10 using Wayland and .NET 5.0.5 (SDK 5.0.202), the window buttons are placed on the left side of the titlebar instead of the right side:
Is there a way to configure this setting?
EDIT: the issue only occurs on Wayland, on X11 the buttons are placed correctly.
Thanks in advance!
How do I allow the user to drag a chromeless window?
Photino does not seem to support WindowControlsOverlay which standardizes app-region
CSS property, introduced by Electron.
I am evaluating how to use Photino.NET in a .NET Framework application (in WPF).
Creating a separate window would work well, I already tested using the message loop in WPF (with .NET 5) and it works.
The issue for .NET Framework is that Photino.NET is compiled for .NET Standard 2.1 - if it was .NET Standard 2.0 it would have worked, but there is a dependency on Marshal.GetHINSTANCE that is not available in .NET Standard 2.0.
Do you already evaluated if there could be a workaround?
The alternative seems to create a .NET Framework version of Photino.NET. If I go that route, would it be possible to keep a single version of the source code with conditional directives, or do you think it would be better to create a separate project?
Any idea and comment would be appreciated - thanks!
Hi,
I have the following code
window.RegisterSizeChangedHandler((object sender, System.Drawing.Size size) =>
{
var win = (PhotinoWindow)sender;
if (win.Maximized)
{
try
{
win.SetChromeless(true);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
});
When win.SetChromeless is called in this handler the exception "Chromeless setting cannot be used on an unitialized window." is thrown. If I use "window" instead of "win", same thing (just incase for some reason they were different objects).
Basically I just want a way to make maximize to do a fullscreen style mode. If I try "SetFullScreen" that works from here, however, it fullscreens on monitor 1 and not the window is opened (which in my case will always be monitor 2).
Hi,
I've tried window.RegisterWindowClosingHandler, window.WindowClosing and options.WindowClosingHandler with no luck, is there anyway around this?
While trying to run the samples, it seems the application tries to run the MicrosoftEdgeWebview2Setup.exe file (to update or get the latest WebView2 components). Unfortunately, I have a company GPO that does not allow Edge to be updated.
Isnt there a way to use the existing msedge WebView component or list the existing WebView components to see if they require an update?
John
I just give Photino a try and I couldn't even run it:
PS C:\Programming Projects\Photino-Applications\Photino-App> dotnet run
C:\Programming Projects\Photino-Applications\Photino-App\HelloPhotino.NET.csproj : error NU1202: Package Photino.NET 1.1.6 is not compatible with net50 (.NETFramework,Version=v5.0). Package Photino.NET 1.1.6 supports: netstandard2.1 (.NETStandard,Version=v2.1)
C:\Programming Projects\Photino-Applications\Photino-App\HelloPhotino.NET.csproj : error NU1202: Package Photino.NET 1.1.6 is not compatible with net50 (.NETFramework,Version=v5.0) / win7-x86. Package Photino.NET 1.1.6 supports: netstandard2.1 (.NETStandard,Version=v2.1)
The build failed. Please fix the build errors and run again.
Any idea what going on?
Thanks in advance!
Every time a Photino application starts up, Photino.Native attempts to creates a shortcut in windows start menu.
I would like to avoid that for a portable application.
There is a setShortcutPolicy method in Photino.Native. Can I request a feature to forward a shortcutPolicy from Photino.Net when calling "new PhotinoWindow"?
Great work on this framework, its been a pleasure to use!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.