SilverScreen Solid Modeler

TempfileCreate Event

TempfileCreate Event

Previous topic Next topic  

TempfileCreate Event

Previous topic Next topic JavaScript is required for the print function  

SilverSharpAPI

 

The TempfileCreate Event

 

Synopsis

The TempfileCreate event is raised when SilverSharp creates a temporary file.

 

 

Delegate

The TempfileCreate delegate is declared as follows:

 

C# Code

 

 delegate void TempfileCreateEventHandler(string path);

 

 

A delegate is similar to a C/C++ function pointer, but delegates are type-safe and can only refer to a method that matches the signature of the delegate. The TempfileCreate delegate declares a function signature that must be used when installing an event handler for the TempfileCreate event.

 

 

Event

The TempfileCreate event is declared within Events as follows:

 

C# Code

 

 static event TempfileCreateEventHandler TempfileCreate;

 

 

An event maintains a list of methods to call when it is raised (usually in response to an important activity). TempfileCreate allows your application to subscribe to or unsubscribe from the TempfileCreate event.

 

 

Raise method

The method to raise the TempfileCreate event is declared within Events as follows:

 

C# Code

 

 static void RaiseTempfileCreate(string path);

 

 

The SilverSharp assembly will automatically raise the TempfileCreate event whenever a temporary file is created. It would not be typical for a SilverSharp application to raise the event itself.

 

 

Remarks

It is not necessary for a SilverSharp application to establish a handler for the TempfileCreate event.

 

 

See Also

Events, TempfileClose, set_tempfile_create_handler

 

Example

The following code shows a sample TempfileCreate event handler. Note that the method declaration must match the delegate for this event in parameters and return type:

 

C# Code

   

 using SilverSharp;

 

 . . .

 

 void OnTempfileCreate(string path)

    {

    // Take action appropriate for the creation of a temporary file

    }

 

 

The following code shows how to subscribe to the TempfileCreate event, assigning the above handler:

 

C# Code

   

 Events.TempfileCreate +=

    new TempfileCreateEventHandler(this.OnTempfileCreate);

 

 

The following code shows how to unsubscribe from the TempfileCreate event, removing the above handler:

 

C# Code

   

 Events.TempfileCreate -=

    new TempfileCreateEventHandler(this.OnTempfileCreate);