Windows Universal App with C# & CSS? - c#

Is it possible to write an universal app for windows where the logic is written in C# and the styling takes place in HTML and CSS like it is possible with Xamarin Hybrid Apps for Android/iOS?
So far I have only know of C# & XAML or Javascript & HTML/CSS. Either I have to rewrite all my styling in XAML or all my logic in javascript.

Have you heard about using Windows Runtime Components which should do what you are asking for?
https://msdn.microsoft.com/en-us/library/hh441572.aspx
"By using the Windows Runtime, you can create components (essentially DLLs) in C++, C#, or Visual Basic, and call into them in a simple and natural way from a Windows Store app that's built by using JavaScript"

Related

how to use javascript or jquery in windows form?

I'm making this application in c#.net, just for personal use and I'm just making it for practice and to learn more about c#.net programming.
I know java script is meant for web applications, but maybe there are ways to use them in windows applications as well.
No you can't use them directly.
You could technically make a library that parses JQuery and does the same things... or you could make a C# equivalent of the same functionality, but that seems like more work than it's worth.
If you are looking to practice c#.net then practice c#.net, even if you could use javascript/JQuery that wouldn't get you much c# practice would it.
Regular windows (desktop) applications will not run on javascript.
However, windows 8 store applications (either for windows 8 desktop, or windows mobile) can be created using HTML5 & js.
This series should give you a decent start: http://www.microsoftvirtualacademy.com/training-courses/developing-windows-store-apps-with-html5-jump-start#?fbid=ldvGrgy_tPQ

Style my .Net desktop application GUI with Silverlight/windows phone-style controls

I am writing my first vb.net application ( But I will tag c# here as well, as I am sure even a c# person can answer this with the similar .net implementation).
Short Description of my Applicaiton:
My desktop application will run on win platform only, using vb.net, it is a simple internet cafe management software, with a server gui running on server, and a client gui running on workstations, both communicating with TCP/IP to allocate time to customers, and the server storing some data in either xml files ( for human operators login info e.g) or in a small database. Nothing complicated.
What I would like to do:
I'd like to have a "sexy" look, i.e. either silverlight look or win7 phone look, yet this is a desktop application. I'd like to use CSS but its entirely optional, if there is a simple way to have my controls look like below without CSS thats fine with me.
What I have tried
I have looked into just doing a silverlight out of browser app, but as I am new to .net, and even though I have read up as many articles about using silverlight5 out of browser, I don't want to be caught down the road when I want to implement a feature and realize "Oh silverlight out of box doesnt support that".
So my question is , how do I implement one of the new looks in the picture in my desktop vb app?
You should look at using WPF for your application instead of using WinForms.
WPF (Windows Presentation Foundations) is a platform which works same way as silverlight but on desktop (as far as you need to be aware now.) Silverlight is a cut down version of WPF so WPF will give you a lot more controls and a lot more control over the program.
WPF uses XAML to draw up the UI and it holds the code in the source code file associated to the xaml file. If you have experience using Silverlight you should easily be able to make programs with WPF.
WPF is really powerful and gives you access to all the styling that is possible on Silverlight. WinForms is more so restricted which makes it harder to abandon the consistent Windows look and make your own intuitive and innovative UI.
Hope it helps!
Here are some tutorials if you are interested:
WPF Tutorials
Here is an example WPF desktop app (exact same look as achievable with Silverlight)
You can use wpf with Mahapps Metro : http://mahapps.com/MahApps.Metro/

Do games like Starcraft 2 use Windows Forms to build their UI?

This may be a dumb question...
When I log into Starcraft 2 and see that beautiful UI, I can't help but wonder if it's designed using Windows Forms (.Net or C#). Is the login box just some kind of Windows dialog or do they do their own thing - whatever that may be?
Is it possible to get that much customization within Windows Forms?
No. Games and other apps that use DirectX to take control of the video device don't use WinForms or even the Win32 API for screen output.
StarCraft 2 most likely implements its own windowing and UI system, completely independent of the Windows API or WinForms library.
Yes, you can write an app in C# to perform similar DirectX graphics output, but using DirectX is not as simple as working with WinForms. I wouldn't recommend attempting to write a DirectX app as a way to teach yourself C# unless you are already very experienced with DirectX through other languages or tools (C++, mostly).
WinForms is fine for learning C# and whatever IDE tool chain you choose to use. After you're comfortable with C# patterns and terminology, then tackle learning how to write DirectX code with C#.
No. They use DirectX. DirectX bypasses normal windows and operates at alower level.
You can customize a form to a great degree. You have full control over painting it to look however you want.

Metro style apps with Html and C#

According to this slide
http://media.infragistics.com/community/general/windows8-platform-tools.jpg
Does it mean I have to use XAML view with C# if I want to develop a metro styled application?
Can I use a HTML/JS/CSS - C# combination with event handlers and all? Something like ASP.NET Webforms/MVC . I know it is not the same client server architecture, but since metro styled apps support HTML/JS, I was wondering.
I can use Win-JS. But can I rather write C# than Javascript, and use HTML rather than XAML?(I dont know XAML and I like C#)
All the C# samples I found online use XAML.
Perhaps you can write portions of your program logic in C# and package it as a library and then create a HTML5/JS app that references the C# Library. That way you should only need to use JS for the parts that are directly related to UI functions and C# for the rest.
I will point out that I haven't tried it yet, but Bill in this thread says that he got it to work.
No, you can only use XAML with C#, or HTML+CSS+JS. But XAML is great markup language, so I think you able to use it.
You can create a "WinMD" library in c# (or c++) that can be invoked from JavaScript. There are a ton of limitations that WinMD libraries have over normal .net libraries and the usage model would be would at all like ASP.NET MVC. Frankly, unless you have a lot of business logic in c# already or if you want to reuse a bunch of code in Win8 Metro apps spanning both HTML and XAML, this WinMD thing is more hassle than its worth.
According to MSDN - Dev Center - Metro style apps you can use C#/VB/C++ and XAML and JavaScript and HTML5 to develop a metro styled application (for Windows8/WindowsPhone).

How can I port my Windows Phone game to a Silverlight thing that I can use on a webpage?

I'm confused about how to port my WP7 C# game to the web using Silverlight.
I know that code written in C# using the Windows Phone (add-in? plugin? other?) for Visual Studio makes a Silverlight app. But how can I embed my finished WP7 app in a webpage?
I've seen some things such as ExEn, SilverSprite, and XnaTouch {the page redirects to MonoGame}, but I'm confused if I even need something like this in order to make my game playable on the web. I've got a feeling the capability may even be embedded in Visual Studio. Is it even possible to do this without rewriting all the code?
Shortened version: How can I port my WP7 C# game to the web using Silverlight?
Create a new project in Visual Studio targeting Silverlight beside your WP7 project. Then if your existing code is structured nicely, you should be able to re-use most of your "back-end" code (the views, viewmodels people talk of). The best way to do this for files that are common is to add them as links to the new project, so you don't have to keep them both up to date - if there are small changes between versions you can use conditional compilation to do this.
You'll want to use some completely new classes for some things, such as probably the top level view. Some XAML (eg a UserControl definition) might be usable between both with changes, though some people will favour always creating different versions. Have a look at this extensive article on cross-platform SL/WPF/WP7 development.
What have you tried?
If you create a Silverlight application in Visual Studio, you should be able to include all your existing Views, ViewModels, resources and so on. I don't know if you'll be able to make a single project that both builds into a WP7 and a Silverlight application but I personally wouldn't bother trying.
You can't directly - there are missing runtime components and features that are only available to Windows Phone applications.
You can, however, reuse lots of code, especially C# - all XAML code, I beleive, you'll have to copy/paste from WP7 XAML to Silverlight XAML.

Categories

Resources