Giter Club home page Giter Club logo

photino.net's Introduction

NEW POLL!!

Hello Photino Community! We have a new poll question, regarding where and how you use Photino:

PHOTINO USAGE POLL

Build native, cross-platform desktop apps

https://tryphotino.io

Photino is a lightweight open-source framework for building native, cross-platform desktop applications with Web UI technology.

Photino enables developers to use fast, natively compiled languages like C#, C++, Java and more. Use your favorite development frameworks like .NET 6, and build desktop apps with Web UI frameworks, like Blazor, React, Angular, Vue, etc.!

Photino uses the OSs built-in WebKit-based browser control for Windows, macOS and Linux. Photino is the lightest cross-platform framework. Compared to Electron, a Photino app is up to 110 times smaller! And it uses far less system memory too!

Photino.NET

This project represents the .NET 6 wrapper for the Photino.Native project, which makes it available for all operating systems (Windows, macOS, Linux). This library is used for all the sample projects provided by Photino, which include Blazor, Vue.JS, Angular, React, or the basic HTML app: https://github.com/tryphotino/photino.Samples

If you made changes to the Photino.Native project, or added new features to it, you will likely need this repo to hook it all up and expose the new system calls to the .NET wrapper. In all other cases, you can just grab the nuget package for your projects: https://www.nuget.org/packages/Photino.NET

How to build this repo

If you want to build this library itself, you will need:

  • Windows 10+, Mac 10.15+, or Linux (Tested with Ubuntu 18.04+)
  • Make sure the Photino.Native Nuget package is added and up to date.

photino.net's People

Contributors

andersen27 avatar brettfo avatar budcribar avatar denny09310 avatar jammerxd avatar laurawebdev avatar mikeyeager avatar mikeyeager2 avatar ottodobretsberger avatar philippjbauer avatar raxdiam avatar xaevman avatar y56380x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

photino.net's Issues

[feature request] StartStringWide/StartString style of property very confuse to user

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;
      }

Error in Photino.Blazor example project when updating package

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.

Attached image of files updated in the nuget update
image

Unable to debug window inside of Rider

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?

Ubuntu 20.04

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

Invoke(Action workItem) should be public

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.

Feedback Wanted: Next version

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.

Start maximized (not fullscreen)

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.

Cant run photino.net on macOS

Hi, I am not able to run Photino .net on macOS Big Sur 11.6.

photino version:

<PackageReference Include="Photino.NET" Version="2.0.11" />

I have got this message below, nothing else shown, nothing in the terminal.

Screenshot 2021-10-03 at 15 59 44

I am running an umodified HelloPhotinoApp sample.

Cannot start window in a separate Task

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:

Works

[STAThread]
static void Main(string[] args)
{
    var window = new PhotinoNET.PhotinoWindow("HelloWorldReact App");
    window.Center().LoadRawString("<h1>Hello from C#</h1>");
    window.WaitForClose();
}

Doesn't work

[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

Javascript debugging

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?

Chromeless setting cannot be used on an unitialized window.

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).

Photino Samples not finding WebView2 component

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?

Thanks,

John

(React) samples out of date and are not working unless you update Photino.NET to v1.1.5

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

photino

First Launch Not Working

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!

Static files from nugets

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....

SetSize(1024, 768)

Hello

When creating the PhotinoWindow and setting the size, nothing happens.

Creating a 2nd PhotinoWindow after closing all others fails

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

RegisterWindowClosingHandler not working on linux (Debian)

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.

Window Closing Events Not Firing

Hi,

I've tried window.RegisterWindowClosingHandler, window.WindowClosing and options.WindowClosingHandler with no luck, is there anyway around this?

Zoom property

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.

Interacting with the DOM

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.

Templates fail installing

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?

Version of Photino.NET for .NET Framework

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!

Possibility to inject custom javascript

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.

Photino.NET 2.0.12 buggy?

Hi,

I updated the sample Photino template to version 2.0.12 from 2.0.11, and I got this when running dotnet run?
Also, the text comes up in Chinese?

image

Show with WaitForCloseAsync or other non-blocking function

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)

Problem with "insecure origins".

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

Constantly high CPU (+ possible memory leak?)

Hi,

I just tried the template for .NET dotnet new photinoapp -o MyPhotinoApp (version 2.0.11)

And noticed that the CPU was always high 35% on my 4-core MacBook Pro (+ memory leak like constantly climbing up to 1.2 Gb then down to 300 Mb)
Is this normal?

image

Self-contained Single File

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?

can not load custom scheme by window.load()

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

image

but the problem is that can not load the index.html by custom schema at startup.

the screen shot:
image

Memory leak in msedgewebview2.exe on windows

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.

Option to set shortcutPolicy when creating PhotinoWindow

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!

Running a process after a Photino window has been opened never exits (Linux only)

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)

MinimalProcessExample.zip

Expected behaviour:

  1. run process once, return
  2. run process again, return
  3. open photino window, close photino window
  4. run process for a third time, return
  5. program finishes

Observed behaviour:

  1. run process once, return
  2. run process again, return
  3. open photino window, close photino window
  4. run process for a third time, now it does not return
  5. program never finishes

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");
}

Chromeless windows do not display on Windows 11

When setting Chromeless = true for a new PhotinoWindow the window does not display, but does show in the taskbar

Photino in taskbar

OS build: 22458.1000 (Dev Channel) & 22000.194 (Release Preview)
Edge: 95+

Is there a way to bypass WebKits SSL check?

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?

Window buttons are on the left side on Ubuntu 20.10 (Wayland)

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:

image

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!

Focus

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.

Blank index page on macOS Big Sur

Hi,

I've been getting a blank index page from the sample projects as shown in the picture below.
image

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.

Minimum window size

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.