﻿/// <reference path="jquery.intellisense.js"/>

Type.registerNamespace('Depend');

Depend.Extend = function(destination, source) {
    /// <summary>Extends one object with the properties from a source object</summary>
    /// <param name="destination">destination</param>
    /// <param name="source">source</param>
    /// <returns type="object">object</returns>
    for (var property in source.prototype) {
        if (destination.prototype[property] === undefined) {
            destination.prototype[property] = source.prototype[property];
        }
    }
    return destination;
};

Depend.Core = function() { };
Depend.Core.prototype =
{
    Name: 'Depend.Core',
    __typeName: 'Depend.Core',
    __class: true,
    Display: function() {
        /// <summary>Stub for Display</summary>
    },
    ShowError: $Depend_ShowError,
    ErrorHandler: $Depend_ErrorHandler,
    InitializeServices: function() {
        this.MailService = Depend.Services.MailService;
        this.MailService.set_defaultUserContext(this);
        this.MailService.set_defaultFailedCallback(this.ErrorHandler);
    },
    AttachEvents: function() {
    },
    Display: function() {
    },
    Initialize: function() {
        this.PreInitialize();
        this.InitializeServices();
        this.AttachEvents();
        this.Display();
        this.PostInitialize();
    },
    PreInitialize: function() {
    },
    PostInitialize: function() {
    }
};

Depend.UserControl = function() { };
Depend.UserControl.prototype =
{
    Name: 'Depend.UserControl',
    __typeName: 'Depend.UserControl',
    __class: true,
    ClientID: 'undefined',
    Initialize: function() {
        this.InitializeServices();
        var d = Depend.GetApplication();
        d.RegisterUserControl(this);
        this.AttachEvents();
        this.Display();
    },
    ChangeLoginStatus: function(isAuthenticated) {
    }
};

// inherit from the core
Depend.Extend(Depend.UserControl, Depend.Core);
