define(['scripts/knockout-3.3.0','scripts/act.js','scripts/CallWebObject.js'], function(ko, ACTSocket, InvokeCallback) {

    function LoadedAppsListComponentViewModel(params) {
		this.applications = ko.observableArray(params && params.Model.Applications || '');
		for (var key in this.applications()) {
			this.applications()[key].click = function() {
				InvokeCallback("ApplicationsData", this.Started, []);
			}.bind(this.applications()[key]);
		}
		this.onRefresh = function(obj) {
			this.applications(obj.Applications);
			for (var key in this.applications()) {
				this.applications()[key].click = function() {
					InvokeCallback("ApplicationsData", this.Started, []);
				}.bind(this.applications()[key]);
			}
		}.bind(this);
		
		ACTSocket.registerService("ApplicationsData", this.onRefresh);
		
    }

    return LoadedAppsListComponentViewModel;

});

