Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » C# » General » Downloads
 
Add your own
alternative version

VSA Scripting in .NET

, 27 Feb 2005
Using Visual Studio for Applications to add scripting capabilities to your .NET apps.
vsascripting_demo.zip
vsascripting_src.zip
Scripting with Vsa
App.ico
bin
Debug
VsaScripting.dll
obj
Debug
temp
TempPE
Scripting with Vsa.csproj.user
VsaScripting
bin
Debug
obj
Debug
temp
TempPE
VsaScripting.csproj.user
import System;
import System.Diagnostics;
import System.ComponentModel;
import System.Windows.Forms;

// declare an instance of the Scriptlet type, and create a new instance all at once
var scriptlet : Scriptlet = new Scriptlet;

// call the main method to get things running inside the class, 
// i just don't like top-down sequential execution
// outside of classes, it just seems archaic to me
scriptlet.Main();

/// <Summary>
/// The Scriptlet class contains methods to redirect script flow from sequential into a class controlled flow
/// </Summary>
public class Scriptlet // extends Scriptlet
{		
	/// <Summary>
	/// Initializes a new instance of the Scriptlet class
	/// </Summary>
	function Scriptlet()
	{
	
	}

	/// <Summary>
	/// The main method that channels script flow into the class
	/// </Summary>				
    function Main() : void
    {     
		Debug.WriteLine("This information is being written to the Debug output from a script!!!");
		Debug.WriteLine(_scriptingHost.VsaEngine.RootMoniker);        
		
		// change the title of the window
		_scriptableForm.Text = "Scriptable Window";
		
		// add a menu item
		_scriptableForm.FileMenu.MenuItems[0].MenuItems.Add("Scripted Menu Item");
		
		// wire up to some events on the form
		_scriptableForm.add_Closing(this.ScriptableForm_Closing);		
    }
        
	/// <Summary>
	/// Intercepts the closing event from the form
	/// </Summary>
    function ScriptableForm_Closing(sender : Object, e : CancelEventArgs) : void
	{
		// prompts the user and confirms 
		if (MessageBox.Show("Are you sure you want to exit?", "Exit Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
			e.Cancel = true;			
	}	
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Mark Belles
Software Developer (Senior)
United States United States
Senior Application Developer specializing in Windows desktop and network development.
 
Professional Experience
- B.S. of Computer Science (Graduated 2001 - PSU)
- Senior Application Developer (8+ yrs)
- Microsoft Certified Professional
 
Primary Interests
- C#, C++, HTML, Javascript
- XML, ASP.NET, Web Services, SOAP, UDDI
- Socket programming and anything network related
- Reflection, Serialization, and Plugin Frameworks
- Owner-drawn controls and GDI+ goodness

| Advertise | Privacy | Mobile
Web02 | 2.8.140821.2 | Last Updated 27 Feb 2005
Article Copyright 2005 by Mark Belles
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid