Showing posts with label Timer. Show all posts
Showing posts with label Timer. Show all posts

Monday, October 26, 2009

Chapter 6-Lesson 1

  • In Client-Server model, a thin client is one where most processing is done on server, while a thick client is one where most processing is done on the client.
  • Every ASP.NET AJAX page should contain one ScriptManager control.
  • This control is reponsible for generating Microsoft AJAX Library code for the client.
  • If a page that uses AJAX controls, contains a ScriptManager, it would conflict if the page uses a masterpage that also uses a ScriptManager. To overcome this, use ScriptManagerProxy control inside the child page.
  • Similarly use ScriptManagerProxy for User Controls that use AJAX, so that they may not conflict with any ScriptManager that is present in the page that employs the User Control.
  • UpdatePanel control defines areas of the page that are able to send Asynchronous Postbacks to the server.
  • Setting UpdatePanel.UpdateMode property to Always denotes that its contents will be updated on every Postback (partial or complete) that occurs from within the page.
  • We may set the UpdatePanel.UpdateMode property to Conditional so that it updates its contents upon certain conditions, e.g. in case of nested UpdatePanels as described in Page 334.
  • Another way is to call the Update( ) method on the UpdatePanel from server-side code. (This might be done during another Async Postback)
  • By default Nested UpdatePanel (whose UpdateMode is set to Conditional) will not cause update to the parent UpdatePanel. To enable this, set ChildrenAsTriggers property of the outer UpdatePanel to true.
  • We may assign different trigger controls to an UpdatePanel using either markup () or using properties pane.
  • If an error occurs during an Async Postback, it may be handled using the AsyncPostbackError event of the ScriptManager control.
  • All the content is place inside ContentTemplate control within an UpdatePanel.
  • UpdateProgress control present inside an UpdatePanel ContentTemplate would render as a hidden div in the resulting HTML.
  • By default the UpdateProgress control shows up on every Async Postback. To associate it with a particular UpdatePanel, set its AssociatedUpdatePanelId property.
  • We may also change the DisplayAfter property to number of milliseconds for the UpdateProgress after which it would show up following the Async Postback. (This defaults to half second)
  • PageRequestManager class contains abortPostBack( ) method which may be used to cancel a partial postback if called from a control within UpdateProgress control.
  • Timer control is used to execute certain code (at Tick event) on the client on periodic basis. If it is placed inside an UpdatePanel, the TimeInterval property will be reset after the UpdatePanel postback is complete. If placed outside, it will be reset as soon as the event is fired.
  • In case a postback is in progress if the Tick event fires, the first postback is cancelled.
  • The Timer control can also be used from outside an UpdatePanel to trigger it for Async Postback.

Saturday, July 18, 2009

Chapter 8-Lesson 3

  • Windows Services are processes that run in their own user-session without any UI.
  • Windows Services inherit from ServicesBase class.
  • The Main( ) method in a service contains code to call Run( ) method responsible for starting/executing the service.
  • The OnStart( ) method method should NOT stick into an infinte loop not should it get blocked. If we wish to create polling mechanism, use System.Timers.Timer object.
  • To override OnPause( ), OnContinue( ) and OnShutDown( ) methods, first set ServiceBase.CanPauseAndContinue or ServiceBase.CanShutdown to true.
  • Remember to always set the ServiceName property in the property pane.
  • System.ServiceProcess.ServiceController class is required to interact with a service from .NET Assembly.
  • To install the service, we need ServiceInstaller and ServiceProcessInstaller objects (automatically created in Visual Studio when we right click Service Design View and choose Add Installer)
  • LocalService is the least previliged Account and LocalSystem is the most previliged Account property for ServiceProcessInstaller.
  • While creating MSI installer for Service, add Project Output from Service Project as Primary Output and then add a Custom Action. (refer to page 462-463)
  • To record Exceptions for a Service use EventLog.