using silverlight for user interface only - silverlight

I am planning to make a web application, using silverlight for frontend. requirement is: this frontend will be just an empty shell, and it must be language independent. it will get everything it needs to display and use from server, therefore making it language independent.
i tried to find tutorials, but there is nothing.
as far as i understand, silverlight uses xaml for all its data, so just generating it with whatever language i want shouldn't be a problem. but i don't have any silverlight experience or knowledge, so i'm not sure what is the best way to do this. for example, i don't know how will new content be generated, and what kind of structure silverlight requires.
can anyone give me some starting points?

Your requirements are rather demanding. If i can summarise:
silverlight will be the front end (or container)
you don't know what it will be showing
the content may be dynamically generated
everything, including the visual content, will be retrieved from the server
If i have misunderstood then by all means correct me or adjust your question.
Those requirements are not trivial, especially when you have no prior experience in Silverlight. Fetching data from the server is a normal behaviour in Silverlight, but fetching any generated UI content will be a slow and inefficient use of the technology platform. Silverlight is delivered via the browser, and runs on the client. If you are going to have generated UI, then you may want to consider using straight HTML instead (you can generate the contents using ASP.Net or a scripting language such as PHP). Alternatively, you can generate your required UI views from within the Silverlight app itself by either swapping in and out the appropriate pre-built piece of UI (or controls), programmatically adding new controls into the visual tree, or by loading XAML using the XamlReader class.
This answer may or may not help you much, but like i said before - put some more specific details into your question and you will get more specific answers (either add comments under your question, or post a new more specific question if you cannot edit your current one).
Edit: i have just come across this blog article from Jeff Prosise explaining the use of the INavigationContentLoader interface in Silverlight 4 to dynamically load pages from either remotely or locally. It is a detailed write-up, with a lot of code samples, it may be of use to you.

I would suggest you start at http://Silverlight.net
The "Learn" section has lots of videos that can get you started. http://www.silverlight.net/learn/

Related

How to handle angularJS design time data?

Silverlight had a nice feature ("design time data") that allowed one to indicate data for use in views which was only used at design time. This allowed a designer to work with fleshed out screens that looked realistic rather than just a skeleton.
(for a bit of background on this feature in Silverlight, here's a random msdn post about it)
Is there a similar approach for doing this in angularjs?
I don't think that's possible w/ Angular. Angular populates the views as it's processed, so you see the "skeleton" until it's done processing. The design data you talk about would still have to be processed by Angular to be viewable.
You could always populate your scope with "design" data if you are waiting for API's to be built out, etc. You could then work with the view html/css in Chrome dev tools or with any other browser tool set. Not sure that's what you're looking for as it's still technically "runtime" development, but it might get you closer to what you are looking for.

How are you integrating help into your WPF application. Any recommendations?

The question says it all really. If you are writing a WPF application, how are you integrating the application help? What is the state of play in mid-2013?
It seems that there is no clear answer to this from an afternoon with a search engine, but several options:
Write your own fancy tooltip based help (but where are you getting your data from?)
Use .CHM files and the Windows Forms help system (seems archaic to me).
Use Microsoft Help Viewer 1.X or Microsoft Help 2.0.
There is some confusion as to which is more recent / approved of by MS. It appear Help Viewer 1.X might be the recommended option over Microsoft Help 2.0. It doesn't help that the names are so similar...
What is the status of 2.0? Should we use it? Was it ever fully deployed?
Use a third-party product to author your help files and link to them somehow - DocToHelp/NetHelp, NetAdvantage on-line help, etc...
Furthermore, what XAML based mark-up / attributes are you using to provide the necessary context? What is the recommended method?
It seems surprising there is no clear path for supporting application based help in WPF.
My current preference is to use a third party help authorizing system to generate HTML based help.
We then use a WebBrowser to display this help as needed. The authoring system we use makes it fairly easy to extract out a single page from the main help (each "topic" is a single HTML file, and can be included with full contents or not as desired).
Granted, this definitely felt like a bit of a nasty hack at first - but once we wrote the basic plumbing (some attached properties for xaml to specify attributes for context location and add behavior to trigger help, etc), it's fairly clean.
One very nice advantage to this approach, however, is a single help system build works perfectly in all contexts - we can include the documentation online, expose it locally for use in a browser, and use it with context from within our application directly.

Why does NavigationService on Silverlight/WP7 uses Strings over Classes?

Given that C# is a leans more towards a strongly typed language, why did the designers chose navigation based on URIs over Classes?
NavigationService.Navigate(new Uri("/MyPage.xaml", UriKind.Relative))
fails at run time if MyPage is missing.
If there were a method that support passing a PhoneApplicationPage as a argument like
NavigationService.Navigate(new MyPage());
Navigation related errors can be caught at compile time.
Why was this not an inherent design in Silverlight/WP7 ?
Only the WP7 dev tools team can say for sure, but absent their input, I'll give it my best shot. My guess is that it arises out of using a plug-in framework for client application development. Web Silverlight doesn't even really have the concept of navigation. You can switch frames in and out of the applications main frame, but that's not really navigation persay. So, when they were asked to use Silverlight as a client application tool for WP7, they had to decide how they were going to navigate around.
The most obvious way to solve the navigation problem, if you're a team that's been building internet applications, is to make something as close to the internet model as possible. This allows developers to carry internet applications to the browser and do minimal rewrites of their code. Think about it, if you had a web application that used relative URLs to move between application pages, your WP7 could reuse most of that navigation logic with only slight modifications to use the new NavigationService. This also minimizes the changes from core Silverlight that the WP7 version has to make, making everything easier to keep synchronized between platforms.
It obviously isn't the best way of doing things, and it makes state maintenance between pages a royal pain in the ass, but I can at least see why they decided to do it this way. The main flaws, in my experience, are the runtime checking of navigation destinations (instead of compile time with classes), passing parameters (every page needs an OnNavigatedTo that parses out variables) and maintenance of non-trivial objects between pages (I've taken to just using Singletons to hold relevant objects as a sort of poor-man's cache). I'm hoping for at least some modification to the navigation paradigm in 7.5 or 8, but I'm not holding my breath.
This navigation model was inherited from Silverlight on the desktop (and WPF before it). It's important to note: this is not a String-based model, but rather a URI-based model. The difference here is key: we're not talking about an arbitrary string to point to some XAML, we're talking about a universal locator for a resource that is a page within the application. By addressing navigation this way, your application actually has more than one entry point -- any URI within the application can be a valid entry point. And by making navigation URI-based, you ensure that the "state" of your application as it relates to what you're looking at can be serialized, accessed at any time from any direction, etc.
Imagine, for example, that you have a link on a webpage (or in an email, or anywhere else) that you want to open in your application. Click the link, and because the URI fully describes the resource that the application should display (e.g. an item in a catalog, filters on a search, etc.), you can jump straight to it (a.k.a. deep-linking). This isn't implemented on Windows Phone 7 (at least not from other apps, but it's really how the back button, etc. work), but the model comes straight from Silverlight on the desktop (the Navigation framework is in the Silverlight SDK), and you can see where they might take it on Windows Phone in the future.
Again, the power of the URI is its universality -- it is a common way to identify a resource. Without it, you're stuck with a tight coupling of anything that wants to navigate into your application and the application itself.
Silverlight/WP7 navigation service is fairly lacking in many regards, but there are a fair number of frameworks around that allow you to navigate to the ViewModel/View. Some examples:
Windows Phone MVP
Columbus
Xamling Core
In Caliburn Micro (MVVM framework) you have a nice way of handling navigation using only ViewModels - "Screens, Conductors and Composition"
Also keep in mind that using frames you can use routing in Silverlight to map one or more user-friendly URLs to the same .xaml file. If you would specify only the view class then Silverlight wouldn't know to which URL to map to.
Passing query parameters for state managment might be ugly, but it allows your application to be stateless which has some advantages (e.g. deep links) and fits the stateless nature of http web applications.

UC(User component) concept in Win32/.NET Win forms

Couple of year ago I when to work for company as web developer. It has my first Sirius web development job, (ASPx/C#) so it has very exciting and I learned a lot about that world, from the developer point of view.
In that group we had a concept for the pages where loaded in the page UC’s (User controls), I don’t know if it’s the same in every web development team with every language, I’ll assume it is so.
The contract ended and I came back to develop win32 “winForm” application.
But since them I have tried to apply the same principle for my win32 development I learn there, meaning having bunch of UC’s (Visual User controls) that I load in the form.
They are regular visual components, not loaded in the toolbox, code is available in the project, but the component is not developed in the form, they are loaded there.
I would like to know opinions about this approach, what other are doing similar or better to this And improvements that can help us to speed up development and increase code reuse, because that is what this is all about.
If you're using the layout components in Winforms, this might be an acceptable approach although I think the thing that distinguishes the web and Windows Forms (note: NOT WPF!) is that in the former you do a lot of "compositing" which is why the UserControl concept is so useful whereas in the latter you operate on very sophisticated controls (e.g. 3rd party - in my last gig we used an incredible grid control via a small company called Infralution)
The main problem I would see is with layouts since the rendering model is a little different than the web. I know nothing about your application but if it "works" that is what is most important. I assume in this case you use things like the FlowLayoutPanel and the TableLayoutPanel properly.
If you want to go a more canonical route, take a look beyond simply creating components at how you can use the inheritance model to composite your application in a more robust way - having a base Form class that has containers for where your "UserControl" type components go and then using some kind of interface based dependency injection to swap them out while the application is running.
Finally, take a look at some of the open source Windows Forms applications out there to see if you're being too hard on yourself since common UI and reusable components are a goal in every application. Even though I've always thought Microsoft's Patterns & Practices stuff teetered towards being bloated, there are some good ideas and you should study some of the approaches of the Composite UI Application Block they put out.
Okay, not finally, there's one more thing I'd like to add: take a long hard look at WPF which will bring back a lot of the concepts from your web development days and give you that kind of power in a desktop application.

Dynamic data for winforms

i have played around with dynamic data website. is there something similar for winforms.
if there isn't anything out there for doing the same with winforms than the question would be why not? we have a massive ERP application that we want to migrate from AS400 to .Net
Winform application. my initial thoughts were to have all the maintenances be as simple as Dynamic Data Website project.
I would think that WPF would be a better starting point then WinForms, as it has support for style to say how item of data are displayed.
Dynamic Data makes it easy to edit your DB on the web. For desktop (and web) apps take a look at the new Microsoft LightSwitch:
http://msdn.microsoft.com/en-us/lightswitch/gg441300
LightSwitch doesn't use Windows Forms. Rather it creates a Silverlight App that can run both on the desktop and the web. Pretty cool.
Dynamic data is using the routing functionality of the MVC framework. In Windows forms we don't have this approach of fetching data with URLs from a server.
I am not sure how this model could fit into Windows forms.
I think it's pretty hard to create something like dynamic data for Windows Forms.
My biggest concern is here, once you created that Framework, how do you configure it? I mean if you want to change 1 form to be a bit different than the others :-)
I think its better to generate Forms for the various tables in the Database context, using a powerful Grid control from one of the big vendors. And then you can configure those.
Remember this is a different approach then the dynamic data one, where no code is generated before compile time
I think the reason you don't see something like this in winform applications is because it's much easier to store a HTML page inside a database and then display it on the screen formatted properly when using a web application because your browser knows how to format the HTML.
You would have to, stored in the database, know where each label and field would go on the form in some sort of co-ordinates fashion (or you could use a layout 3rd party control) but the amount of work that would take might be tedious to do properly.
The dynamic data website I worked on did not take input from the user. It only displayed different web pages to the user and allowed the admin person to easily make changes to the content. If you wanted a user to beable to save data then that would even be more complex because you have to worry about validation, required fields, etc.
If you have lots of users that need to see different information based on their access level then I would just suggest having a table in the database that tells the system whether or not they should see the field on the form. Then use a 3rd party layout panel to format the visible fields.
my 2 cents
As much as Dynamic Data looks simple and cheap enough to access a database it wouldn't work for an ERP system anyways. Business systems are more than moving data between database and the user interface, they require business rule actions when saving data and while retrieving the may require some massaging to ensure meaningful presentation of storage optimized data.
If you still like to pursue this option it would be very easy to create an application that is build on top of Entity Framework.
I'm not aware of a Dynamic-Data-alike, but (having written one before, years ago, for ASP) I don't actually think it would be that hard, particularly with WPF and its templating support.
Actually if you were really clever you could probably 'borrow' the backend from Dynamic Data, and just reimplement the UI as WPF.
Would make a fun little project actually.
Alternative answer: Use Microsoft Access. No really.
Alternative answer #2: So why not just use Dynamic Data then?

Resources