Code Monkey home page Code Monkey logo

Comments (6)

smj389 avatar smj389 commented on August 18, 2024 1

from cppwinrt.

kennykerr avatar kennykerr commented on August 18, 2024 1

The XAML startup model is a bit odd because if you only look at WinMain it seems as if the XAML framework never gets a reference to your App class, but keep in mind that your App class derives from the XAML Application class. This causes the Application constructor to run, which is the way that the XAML framework discovers that the app is ready for launch.

from cppwinrt.

smj389 avatar smj389 commented on August 18, 2024

Windows.UI.Xaml.Application takes a delegate as its argument. The Lambda is converted to that. In the callback you create your app object.

from cppwinrt.

Firelark avatar Firelark commented on August 18, 2024

Yes, but the App object doesn't seem to go anywhere, from the looks of it the object should die just as soon as it returns from make<App>(); as there is nothing to keep it alive. Unless it is somehow assigned to some global internal variable inside the make<App> funktion?

I reckon that there should only be one App object within the application and so I'm figuring that it might be implemented in a singleton pattern with a static data member somewhere?

I just find the

Application::Start(
[](auto &&) 
{
make<App>();
});

to be a little unintuitive and confusing. Perhaps have a differently named function to make and register the App objekt, maybe something like register_new<App>() or something similar instead of make<App>().

Just my thoughts, and I might have misunderstood things.

from cppwinrt.

Firelark avatar Firelark commented on August 18, 2024

Aha that makes a lot more sense! Thanks smj389 for clarifying that.

If I could make a suggestion, maybe have a function named run<App>() or something like that would be more clear than make<App>().

from cppwinrt.

Firelark avatar Firelark commented on August 18, 2024

Thanks for the information and for the good work on cppwinrt!

from cppwinrt.

Related Issues (20)

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.