|
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.
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
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