Splash for Silverlight - c#

I have an aspx page wherein there are different silverlight components. Each component is of different size and the xaps take different time to download.
Is there any way wherein I can be notified that all my components are downloaded?
I want to display a Splash screen till that time.
Thank You.

Maybe you can try to set an event handler to the "loaded" event of the Silverlight plugin as described here, pointing to a common function that knows each Silverlight plugin on the page and fires another event if all plugins have reported that they are loaded (to hide the splash screen).
But this requires some real-world testing to make sure that the event described there is fired if the plugin is loaded including your "payload" application (and not just the browser plugin).
Another approach could be to implement the "Loaded" event in each of the user controls that make up your applications (maybe by providing a suitable base class) and then invoke a JavaScript method in the surrounding web page as described here, setting a flag for each plugin in the page and hiding the splash screen if all plugins/applications reported to be loaded.

Related

Winform Application UI Freeze while switching between other opened application

I've developed Windows Application using C# and .Net Framework 4.5
My application loads user control and takes input from users. There are probably more than 100 controls on that user control. It works fine when I am actively using my system.
Problem is when I keep my application open and toggle to other applications which are also running e.g. checking my email, browse internet or using excel. After returning to my program, I can see the frame of my program and few controls but not all of them and I can see through my program to the last application which I visited. Also title bar of my app will become black.
Please note that my app doesn't become inaccessible. It's just won't load my all controls. I've assigned shortcut key to reload user control by which I can reload my user control and then it works fine.
I believe that your custom controls need some special drawing and this makes me think about the paint event.
Since you found a fix yourself
I've assigned shortcut key to reload user control
I believe that you can use the OnFocus event to call this shortcut key or the code behind it.

Enable events in main windows while modal window is active

In a WPF window I implemented a component that gives an indication of all active errors in the system.
The component is located in the task bar and
If one hovers over the component a tool-tip is shown with summary info
If one clicks on the control, a panel is the activated that is showing a detailed list.
In the application we also use wizards implemented as modal windows.
Now, here's my problem: if a new event occurs in the system during an active wizard, the component in the task bar is updated however I cannot use the hover event to see a summary. Both events (hover and click) are not usable due to the modal dialog that hides the parents message loop.
Is their a way (or what's the best solution/suggestion) to have at least the hover message active while the modal wizard is present.
Thanks.
They don't call it "modal" for nothin' :-)
Humor aside, depending on your exact scenario, here's two options and a third option that's a bit more involved and you probably don't need it but it can handle a wider range of scenarios:
Option 1. It sounds like you have a normal app that does not show its MainWindow and is using only its taskbar presence. If this is the case then you don't need a dialog at all, simply use the MainWindow itself as the "dialog".
Option 2. If you are already using the MainWindow visibly then use a pseudo-modal approach whereby you don't actually use a dialog but all other controls except the control acting as your "dialog" control are hidden/collapsed.
Option 3. Use two separate processes. Basically, this is two separate apps - one is your taskbar component and the other is your main app. Use IPC to link the two - e.g. I have used a Windows pipe for such a thing and it works fine.

Update user control on Main Window from Page in another solution

Ok, I'm being really thick here and am having a few minor issues which are turning into major ones in my head:
I have a MainWindow that houses a tab control into which I have several "apps" sitting which all have their own solutions. I have built a neat "loading" control which is housed in the main window but is hidden and is only displayed when one of the displayed pages has a button clicked. However, I don't seem to be able to access the user control from the page.
As an example, I have an admin page which controls users in a database which wotks fine. When I click on the submit button I want to make the user control visible on the MainWindow and when the function is finished to hide the control. I know how to unhide and hide the control just not how to access it. I have attached a representation of the file structure below so you can see the issue I have accessing the MainWindow in the main solution from say the pageAdmin.xaml.
I have been googalizing this for a while and can't seem to find a solution that works. Can anyone point me in the right direction? I am open to any suggestions about how to handle this.
Andy
Just to be sure: what do you mean with "apps"? Do you have one WPF application which hosts different components?
Maybe PRISM (Microsoft Framework) is interesting for you. In PRISM you can dynamically load components from different dlls and host them in one WPF application. It has a build in messaging framwork which works very well and the diffetent dlls don't need any references among themselves.

Winforms WPF Interop - Wpf controls rendered inactive

I have a similar problem to this question regarding painting of wpf controls
The application I work on is a rather large Windows forms threaded application with several wpf user controls throughout the application. The problem occurs in a plugin of the application where a third party c++ library is called on a separate thread, WndProc is overriden to get the progress updates from the third party library. I have yet to determine the exact scenario that causes the problem but similar to the above mentioned question, after a few runs the wpf controls fails to paint and update.
Setting the width of the elementhosts does solve the painting issue for most of the controls but after this all the wpf controls in the application seems to become 'unresponsive' - visually... the progress bars fails to show progress (though the value does change), scrollbars does not respond, selecting an item in the listview does not highlight it(it does get highlighted after resizing and it does actually get selected - you just can see it is selected) the treeviews does not paint after the resizing, it only shows a black background where the treeview should be (though when I click on the items where they should be in the treeview, the events does get trigerred)
I know I should probably find out the root of the problems that causes this first (its hapening rather randomely and is hard to trap) - allthough putting a breakpoint in the WndProc method does seem to cause it to fail on a regualar base...
What I was hoping for is a way to 'reactivate'/refresh all the other controls throughout the application... I am an intermediate wpf, c# developer and dont really know enough yet about the messaging and events that happens in the background to use them effectively ... my thought is that some event or message that tells wpf to redraw must be broken or interrupted or something - how can I determine what is broken and maybe reactivate it??
Any advice will be much appreciated...
Thank You
It could be that the event that causes the WPF control graph render is never being processed because of that WndProc override.
Since you are inter-oping with WinForms, you can force the events to process by performing a call to Application.DoEvents(); somewhere. Perhaps after you update the progress bar.

Can Silverlight 2.0 pages be removed from a collection manually (garbage collected)?

I have multiple xaml based pages stored as children of a canvas on another page. I add and remove the children pages as the application runs. However, pages that are removed from the children collection are still running and respond to keyboard shortcuts. How can I force the older pages to be removed completely?
When you have your XAML pages displayed, are you registering for keyboard events?
If so, are you forgetting to unregister from keyboard events when you remove those pages from the screen?
Since there is no "Unloading"-like event on either the UserControl or Page class in Silverlight (at least that I know of), what I do is have my pages implement a interface I define that contains a single method like "Cleanup" or "Close". Before I remove the control from the screen, I call Cleanup() on the control and have it do things like unregister from events it may have registered.
If you don't unregister from events the page's object will never be garbage collected because the CLR thinks the object is still live.

Categories