Metro style apps with Html and C# - 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).

Related

Visual Studio Xamarin with C# and XAML: Alternative to WPF-like Data Bindig?

I'm creating a simple App in which some view elements are generated programmatically on runtime. I want some of the properties of these views to be bound to data (text for example), but I do not know how this is done in Android.
I'm familiar with WPF, where this is achieved with Data Binding, but this is not supported in Xamarin (unless I use something 3rd party like MVVMCross, which I'd rather avoid or an approach like THIS). So my qustion is: What is the best way to bind UI elements to data in Android? What is the common practise in, say, Android Studio, and how could I implement it in Xamarin with C#?
I have something like THIS in mind, but this is Android Studio (I guess), so it won't work in Xamarin.
You would need to add your own implementation to do this if you don't want to use a third part library, Microsoft has data binding in wpf because they implemented it, Xamarin is just a wrapper around android, and android doesn't have this functionality as far as I know. It's sort of like how JavaScript doesn't support data binding but angular does, it's a third party thing most of the time. That said, to answer your question better, your options are use third party or implement your own library.

Windows Universal App with C# & CSS?

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"

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/

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.

Can i use javascript in C#.Net Windows Form?

I want to know if I can use JavaScript in C#.Net Windows Form. If it can be used, how can I use that JavaScript.
You might want to check out Javascript.NET.
However, please make sure you are not trying to use javascript to solve a task much more easily solved with a more mainstream parts of the framework/c# language.
No, javascript is a client scripting engine based on the Document Object Model (DOM) elements within a browser.
You list c# against this post, I'd suggest that you should invest some time learning LINQ for .net as this provides a DOM like query syntax for your windows forms. In fact, you can then query any .Net classes / objects.
Here's a link to the LINQ 101 examples;
http://msdn.microsoft.com/en-us/vcsharp/aa336746
No. JavaScript needs a runtime environment. Such a runtime environment is present in browser, but not in Windows Forms.
In Windows Forms, you can use all the features of C# or any other programming language on the .NET platform. Hence, there is no need for a cross-browser, cross-platform language like JavaScript.
If you have an existing web application which have some functionality you would like to reuse, you could show it in browser frame within your Windows Forms application.
Not directly, but you can write/use an existing framework that handles this for you, and write some bindings to your UI or something. I've used http://jurassic.codeplex.com/ in the past, and its proven very efficient.
I found this helpful:
object result = this.Browser.InvokeScript("showOverlay", false);
For the full example:
https://weblog.west-wind.com/posts/2008/sep/27/calling-javascript-functions-in-the-web-browser-control

Categories

Resources