I am looking for a way to show a busy indicator when Caliburn is loading a control. That means when caliburn automatically calls the OnInitialize-Method I would like it to show an busy indicator above the control that it loads.
I've implemented this by using coroutines. Search documentation on caliburn's project home, there's a 'ShowScreen' class that implements IResult.
Related
I am trying to create custom controls for my JavaFx app and I got a bit lost in the correct architecture of the code.
I have created a custom combobox control, which is based on detailed customization of the default ComboBox control. Since, after the customization, I cannot guarantee the general function of the control as ComboBox type (some methods could "spoil" my customization etc.), I thought the correct way is the encapsulation using this architecture:
My CustomComboControl extends Control, not ComboBox.
It contains a private field internalCombo, which is my customized ComboBox instance. The internal combo is a part of the custom control, not of its skin, so that I can easily get data from the internal combo, delegate things to internal combo etc.
My CustomComboControl uses a custom Skin, which uses the internal combo from the control as its root node.
Is this a correct architecture? It seems generally to work well but I encountered some problems I cannot solve.
Focus and key events. If I keep both my custom control and the internal combo setFocusTraversable(true), the focus seems to be doubled in going through focus cycle (need to press TAB twice to go over my custom control).
If I make only the internal combo focustraversable, I cannot listen for focus on my custom control (which is sometimes needed).
If I make only the custom control focustraversable, the internal combo does not receive keyboard events, which breaks its function.
What is the correct architecture? (I know that this question is probably too broad.)
Question EDITed:
In the second suggested solution (only skin focustraversable, not the control itself) is passing key events from the custom control to the internal combo somehow possible?
I have a page I'm working on and it works correctly in the sense that I press a button and it executes a stored procedure. The problem is the stored procedure takes awhile to complete, and I want the user to know that there is progress being made and that it's not stuck. So is there a good method to give the user some idea of the progress being made? I was going to just simply display an animated gif, but not sure how to do this. Or if there is a more preferred way to do this I'm all ears. Thanks!
Generally it is a bad idea to have a website command take time, but when you have to Microsoft have an Ajax library which works with ASP.Net - this includes a Progress bar control which can appear when you are doing a long task
The site for the ASP.Net Ajax can be found here; http://www.asp.net/ajax
The Ajax Control Toolkit which includes the progress indicator is here; http://www.asp.net/ajaxlibrary/act.ashx
If you do an AJAX call you can use jQuery to show a loading graphic. See this post How to show loading spinner in jQuery?
Yes, you can definitely use an animated .gif to display to the user while the stored procedure is executing. You'll want to use ASP.NET AJAX to accomplish this, specifically using UpdatePanel and UpdateProgress controls.
View the following URL which guides you on implementing the UpdateProgress control: http://www.asp.net/AJAX/Documentation/Live/mref/T_System_Web_UI_UpdateProgress.aspx
The section on "Specifying the Content of the UpdateProgress Control" talks about using the ProgressTemplate to show an animated image that notifies the user of the progress on the page.
--Tyler
So in a WinForm app, the Properties tab has an event button. It shows me all the possible events I can wire up to a delegate for the control that has focus. Then, all I have to do is double-click my event of choice and VS will auto-stub the delegate for me with the appropriate EventArgs type and everything. It'll then automagically take me to that delegate in the class.
How can I do the same thing in ASP.NET? For example, where can I click or double-click to have VS auto-stub in lifecycle Page events such as OnInit or OnUnload and then take me to the newly stubbed delegate? Surely this isn't always a manual process?
The Event tab in the property grid requires that Design View be up to date (synchronized) to work. For this to happen, you either need to be in design view, or have just left it without making changes to the document (or be in split view, so you can refresh the designer easily at will).
See also: Events tab randomly appears and disappears in VS 2008
Adding information from the comments:
Currently (VS2010), the only stubbing support for event handler generation using WebForms is for server control events. There isn't any tooling out-of-the-box to create event handlers for the Page itself (e.g. OnInit, OnUnload) if you're using code-behind files. However, if you are using single file webforms (i.e. no code behind) you can generate these via the Navigation Bar (disabled by default in VS2010, but enabled in previous versions).
Just select the element, go to event tab in property grid. Then double click the event you want.
Also make sure you are using "runat=server" and ASP.NET WebControls. In other words, not HTML controls.
As an addendum to the question: Please see Jimmy's comments above. Looks like everything else works fine but there's no method of auto-wiring up Page-type-specific events.
I would like to know if it's possible to add some jobs on the onload of my air app, what I mean is:
I have an eventHandler which get the event "FlexEvent.APPLICATION_COMPLETE" but this event it`s dispatched after the progress bar ends, I would like to know if there is some event that I can handler and add my jobs there?!?
Or the only way to do this, it's doing a custom preloader??, like the link bellow:
Custom Preloader in Flex 4?
Thanks for all!
There are four events that an Application dispatches during its creation and initial display:
preinitialize
initialize
creationComplete
applicationComplete
More info at Adobe: About Startup Order
EDIT:
However, the Application itself is not instantiated until after all the RSL's have loaded, ie., when the Preloader fires an Event.COMPLETE (for that part of the preload). The preinitialize event on the Application should get fired while the Preloader is still displayed, but the initialization phase might just be much faster relative to the other loading phases. So, yes, if you want to do something concurrent to the Preloader loading RSL's, you have to write a custom preloader.
I'm using your messenger class to communicate between views/controls and viewmodels.
Currently I have the same usercontrol multiple times on the same view.
The problem is that when one viewmodel sends a message back to the usercontrol then all of the
usercontrols (of that same type) in my view get updated.
How can this be prevented?
FYI, I played around with the token functionality that you provide, but I couldn't make it work for my particular case.
Have you tried altering your usercontrol so that upon construction, you can specify whether or not it should Register for that particular message? I would do that as a starting point.
Another thing to watch out with using Messenger.Default -- it isn't threadsafe, so if you end up using it in lots of places other than usercontrols (like in worker threads to notify the main thread of events happening), then you had better wrap it in another class that performs the requisite locking.
You could set the target of the message if your message inherits from MessageBase class,
or use a Guid as a Messenger token.