﻿//version:1.0
//published by:Microsoft
//company:http://www.microsoft.com
//description:OOB EventDriven Activity
//assembly:System.Workflow.Activities.dll

function EventDrivenActivity(element) {
	this.element = element	
	this.innerBar=document.createElement("DIV")
	this.innerBar.className="bar"
	this.innerBar.style["width"]=100+"%"
	this.innerBar.style["heigth"]=28+"px"
    this.innerBar.innerHTML = "<DIV id='"+element.id+"_id' class='idlabel'>"+element.id+"</DIV>"
    element.appendChild(this.innerBar)
    this.group = Quanticks.drag().createSimpleActivity(element, this.innerBar)
    this.Properties = new Array()
	this.RegisteredProperties = new Array()
	this.RegisteredProperties[0] = "Name"
	this.RegisteredProperties[1] = "Description"
	this.RegisteredProperties[2] = "Enabled"	
    //composite resize handling
	this.element.onresize=CompositeResize
	this.ActWidth = 160
	this.BlockWidth = 160
	this.noResizeFlag = false
	this.noToolboxIcon = true
}

EventDrivenActivity.GetToolboxIcon = function()
{
    return null;
}

EventDrivenActivity.prototype = {
    Initialize : function()
    {
		var innerConnector=document.createElement("DIV")
	    innerConnector.className="connector"
	    var innerImg=document.createElement("IMG")
	    innerImg.src="http://netfxlive.com/images/connector.gif"
        innerConnector.appendChild(innerImg);
	    connectors[connectors.length] = innerConnector
	    this.element.appendChild(innerConnector)
    },
    
    Serialize : function()
    {
        var activityFactory = Quanticks.activityFactory()
        var result = "";
        result += "<EventDrivenActivity x:Name=\""+this.Properties["Name"]+"\">\n"
        for(var ch=0;ch<this.element.children.length;ch++)
        {
            var childActivity = activityFactory.getActivity(this.element.children[ch])
            if (childActivity!=null)
            {
                result += childActivity.Serialize()
            }
        }
        result += "</EventDrivenActivity>\n"
        return result
    }    
}


