MoST Help

Contact Support

Application Development

Automation / Background Processing

MoST contains a variety of automated processes for queuing tasks that might take longer than a user is willing to wait, such as sending bulk emails, importing and exporting data, etc.

It is also possible to extend this processing capability to allow for any custom automated processes such as syncronising data between external sources via web services or SQL database instances, or any other kind of custom background processing that may be required for the website that isn't catered for directly by existing built-in automated processes.

To extend this functionality, simply download the MoST Automation Project, edit the file called 'MoST.Service.Custom.cs' and add any methods or functions you require, then compile and overwrite the existing assemply in the 'bin' folder called 'MoST.Services.dll'.

MoST will automatically execute any defined methods within this class ever 60 seconds.  The timer control is also passed into the class allowing you to customise it's properties such as the interval that it will execute your methods or functions, or whether you want to stop the timer while your methods or functions perform their tasks.

If you do opt for stopping the timer control while your methods or functions execute you should add error handling so that should something go wrong your timer will continue to function.

Example
using System;
using System.Timers;
using System.Web;
  
namespace MoST.Service.Custom
{
    public class Process
    {
        #region Declarations
  
        Timer _Timer;
        HttpContext _Context;
  
        #endregion
  
        /// <summary>
        /// Call for any custom background processing requirements.
        /// </summary>
        /// <param name="Timer">Timer control used for handling user defined custom processes</param>
        /// <param name="Context">HttpContext for this request</param>
        public Process(Timer Timer, HttpContext Context)
        {
            _Timer = Timer;
            _Context = Context;
  
            // Make any calls to methods or functions here...
            DoStuff();
        }
  
        #region Methods
  
        private void DoStuff()
        {
            try
            {
                _Timer.Enabled = false;
  
                Console.Write("I am doing some stuff.");
            }
            catch (Exception exError)
            {
                Util.HandleException(exError);
            }
  
            if (_Timer.Enabled == false)
            {
                _Timer.Enabled = true;
            }
        }
  
        #endregion
    }
}

You can download the VisualStudio automation assemply project here.

Post a Comment
Required.
Required.
Required. Will not be published.
RadEditor - HTML WYSIWYG Editor. MS Word-like content editing experience thanks to a rich set of formatting tools, dropdowns, dialogs, system modules and built-in spell-check.
RadEditor's components - toolbar, content area, modes and modules
   
Toolbar's wrapper  
Content area wrapper
RadEditor's bottom area: Design, Html and Preview modes, Statistics module and resize handle.
It contains RadEditor's Modes/views (HTML, Design and Preview), Statistics and Resizer
Editor Mode buttonsStatistics moduleEditor resizer
  
RadEditor's Modules - special tools used to provide extra information such as Tag Inspector, Real Time HTML Viewer, Tag Properties and other.
   
These comments are moderated. Your comment, will appear when approved.
Rate this page: