dynamic loading in silverlight - c#

Ill explain a little bit of my project here. I'm trying to make a website in silverlight, my goal is to store all the content in external files, and load them after my silverlight app has loaded. for instance, load the home page, then, while the user is browsing the home page, load the other pages in the backround, and then when a link is clicked, the main content will fade out, and the new page will then fade in its place. My question to you guys is:
whats the best way to create the external files? how should they be created/saved?
how can i load them in the backround while the user is browsing, and then display them by fading when a link is clicked?
how can i add features, for my silverlight app to edit, and re-save the files,for instance, adding a picture to a picture gallery and such
any help would be greatly appriciated. the code-behind of my app is in C#, but im new with the whole silverlight idea, so pretty much any advice at this point would be very welcomed!!

My suggestion for this scenario is using a MEF (Managed Extensibility Framework).
It's provide Dynamically Loading a .XAP, Downloading Based on User Interaction, and other's features out of the box. So, I think, use the MEF it's easyest way approach load-content-on-demand scenario.

You don't mention what sort of content you are dealing with. If it's markup (markdown) and images it should be pretty simple
Log every actual content request, and use that data to rank the order you pre-load the cache in. This way the system is self tuning. If there are complex paths to traverse, consider using a neural network process to determine what to pre-load
Silverlight uses the standard browser HTTP request methods and hence cache, so all you have to do is request a resource and it will be cached
You seem to be describing a wiki (editing pages in Silverlight etc). Consider using an existing wiki engine e.g. screwturn.eu and customising the display and editing interface to work via Silverlight. This will save an enormous amount in versioning, resource management, security etc

Similar to the Managed Extensibility Framework which FFire mentioned, you may also want to look into Prism V2. Heres some resources to get you started and find out if its for you.
WPF/Silverlight - Prism - Resources for beginners
from that list heres a good list of example videos about silverlight, modularity, regions etc.

Related

Pull to Refresh UWP - Grid view?

Could someone please advise me on the "correct" way of implementing Pull to refresh on UWP?
Below are some examples I've found however I'm not sure which one is using the best approach:
Microsoft sample which is for a ListView - This works however it is specific to the ListView Control
AmazingPullToRefresh is a NuGet package that also works however it is somewhat limited in terms of styling
PullToRefreshUWP_WindowsComposition is another example however it works differently to the other two as it does not use an extension class
Any advice is much appreciated
There is no standard answer for this question, basically, there are two points we need to implement:
Get the offset changes when user pull something on the control
Generate some indicator to notify user
Both XamlPullToRefresh and PullToRefreshUWP_WindowsComposition use the new Windows Composition API: Windows.UI.Composition namespace
Ref Windows.UI.Composition Overview
The API is a powerful supplement to existing frameworks such as XAML
to give developers of UWP applications a familiar C# surface to add to
their application. These APIs can also be used to create DX style
framework-less applications.
Please notice that this API works only on Windows 10.
While AmazingPullToRefresh uses Manipulation API and implement all things by calculating offset changes. A similar implementation can be found here
If you want to implement a cool pull-to-refresh control, I would recommend using the Windows.UI.Composition API. You can get start from here
The functionality of pulling to refresh is not used by microsoft.
Reloading a page / data is something we have still in our mind from thinking apps like a website.
Why not have a synced database and alway update your UI with the data which got changed in your local db? For eg. see firebase.google.com
If you want to implement this feature anyway there is not really a way to go.
I have used the PullToRefresh.UWP library from NuGet. For a tutorial see:
codeproject.com
With some tweaking it works but sometimes when I lift my finger of the screen after pulling down the bar won't go up again.
So the answer is: Sorry, but nobody can give you an answer on how to do this the "correct" way. But is there a correct way anywhere? Like almost always in programming. It depends on the case you will use it.
Hope this will help you.

Xamarin Forms Catalog Thumbnail View

I have built a Xamarin Forms app for Android and iOS for the company that I work for. This is my first exposure to Xamarin and while I really like the ability to write native apps for these platforms in C#, there are some details that I'm still working on.
One of the pages that I create is a thumbnail view of all products of a particular type. I was creating the page by dynamically generating a Grid where I would create a stack panel with an image, price and name of the product, and insert it into the appropriate row/cell combination. Problem is, on large catalogs, this would cause the page to crash because it is using too much memory with the Image control. I solved this by using a WebView for the image/price/name combination, which works but I know is not the best way.
I've researched using bindings but I can't for the life of me figure it out. I'm not using XAML but rather generating the UI dynamically from the code. If anyone would be willing to give me a sample of how to do this the right way I would really appreciate it!! There are a fair amount of examples out there, but I can't find anything on how to display essentially a gallery of products.

.NET WebBrowser: Retrieve all videos to play on any given web page

I am involved in an opportunity for which I have been tasked to write a "spider" application whose goal is to dynamically crawl a predefined set of web pages and/or specific URIs and retrieve as many videos as possible either playing on the page or scheduled to play on the page. The goal here is to collect advertising, which is generally not encrypted, so this is not a question about decrypting streamed content or anything in that direction.
We have attempted various solutions, e.g.:
Employing a HTTP Session analysis tool like Fiddler and using a Fiddler extension I wrote to transmit any HTTP sessions that look like video (FLV, MPEG-4, various hints in the URL/headers/etc.) to a separate aggregator application via WCF;
Scanning every single ASCII text file transmitted during the spidering session for URLs to video files, and investigating them/downloading them one at a time before transmitting them to the aggregator application;
etc.
Unfortunately the coverage with these solutions has been less than satisfactory; for some sites, we get absolutely none of the videos; other sites, we get some, and for very few sites we get all of them.
Especially frustrating are sites whose browser must be in focus for any videos to play, or sites where a "play" button must be clicked before any videos will load or play, or sites where the video content must be visible AND in focus before any videos will load or play, etc. It is not very efficient to run only a single spider per server to collect these videos.
As stated, we are using a C# .NET Winforms solution hosting a WebBrowser control. Perhaps there are better components out there? Any suggestions appreciated, though we would very much like to stay within the .NET world (third-party components that work well with .NET interop are fine obviously).
Thanks for any information!

Using Monocross on Windows Phone 7 with Panorama and/or Pivot control

I love the Monocross idea but am a bit lost for Windows Phone 7 when I want to use a Panorama and/or Pivot control. The only view provided is the Page view. So navigating from one page to another works great! But now I want a Pivot or Panorama. Basically I could create a new controller for this view, but do get the "pages" inside the controls. The navigate does really Navigate to it, but not inside the Pivot / Panorama.
For Monotouch and MonoDroid samples have been prepared how to do this (basically a new viewcontroller was created). But WP7 has been left behind.
Anybody?
I am also doing cross platform development using mono and like you and many others face the problem of what to do with respect to the user interface and other underlying hardware integration.
I decided that I did not want to be at the mercy of yet another third party framework (mono is enough) and researched for a solution that I could build and maintain myself. The new MVVM pattern along with Expression Blend is really cool but soon you find yourself stuck when it comes to cross platform development.The MVC an MVP patterns also did not seem to suit what I needed. Finally settled on the PM pattern and expanded it into a PMH where the H is for hardware. To achieve what I needed I had to abstract the fundamental widgets (buttons, panels, textboxes) into a underlying platform layer for each device type. My platform layer represents around 1% of my code base and allows me to skin the application for each device I target it for.
For my WP7 solution I use hardly any HTML only around 25 lines which is enough to initialise the application and the main page. The rest of the user interface is put together programmatically just like I would in WinForms. On WP7 I still make use of the Pivot control as it really is pretty groovy and am modelling a similar control for use on Android/iPhone. While it wont be 100% the same it will be very similar and still use the same navigation engine within my core code.
I am not complete with my development yet but so far I am very happy with my progress. I have been developing user interface for Windows application for some 20 years and I never use the interface builder tools as I find they never give me what I want and really waste my time (Blend is pretty cool though) and also create a tremendous code bloat especially in Blend.
I can't entirely help with monocross - I did do a sample for droid once - https://github.com/slodge/monocross-tab-activity-view - but I never completed the wp7 part of that.
For mvvmcross... which is related... there's a couple of samples - one in the tutorial (a bit hacky!) and one in the conference app - much the preferred sample.
The basic technique I choose was to use sub-viewmodels for each "tab" of the panorama - see how the databinding DataContext is set for each Item in https://github.com/slodge/MvvmCross/blob/master/Sample%20-%20CirriousConference/Cirrious.Conference.UI.WP7/Views/HomeView.xaml
Note that in a bigger app there may be important memory issues to consider when doing this - especially when using a pivot control which does not load all pages into memory at the same time (so you don't really need to load all viewmodels either)
Some bloggage on the conf app: http://slodge.blogspot.co.uk/2012/03/update-on-mvvmcross-sqlbits-conference.html
And the final sql bits source: https://github.com/slodge/MvvmCross/tree/master/Sample%20-%20CirriousConference

Map Navigation Control Approach - .NET

I'd like to know what could be the best approach to develop a Windows desktop application that has a map navigability control - very similar to those in Google Maps and Live Maps, with drag and drop support and so on.
Initially, due to time restrictions, I was thinking about a WinForms solution - I think one future solution using WPF would be better, but I'd have to learn all that WPF stuff first.
With that in mind, what approach should I take to develop that? It could be a third part tool, or some simple implementation/algorithm that I could take some ideas from. To be honest, I'm kinda lost, so any idea would be helpful.
Thanks, have a great day
take a look at this codeplex project. Reviewing the Source and downloading the sample project should be a good start.
GMap.Net # Codeplex
There is open-source application Kosmos for browsing OpenStreetMap maps
http://wiki.openstreetmap.org/wiki/Kosmos
However it reads OSM data and renders it on the fly.
I guess you need some example which loads map tiles and put them in the right order. There is such an example for OpenStreetMap: project osmclient on the sourceforge (sorry cannot post a link, i am a newbie)
It can be simply redone to load other sources, even ArcGIS, but be sure if it is compatible with the Map Provider licence. E.g. you cannot choose Google Maps, because you must use Google Maps within their API.

Categories

Resources