using System; using System.Reflection; using System.IO; using ScriptNET.Runtime; namespace ScriptNET.CustomFunctions { /// /// About function /// internal class AboutFunc : IInvokable { /// /// Function instance /// public static AboutFunc FunctionDefinition = new AboutFunc(); /// /// Function Name /// public static string FunctionName = "About"; private AboutFunc() { } #region IInvokable Members /// /// /// /// Always true public bool CanInvoke() { return true; } /// /// Executes function /// /// /// /// public object Invoke(IScriptContext context, object[] args) { string timeStamp = "25 March 2009"; string message = "Script.NET with Irony Compiler, build " + Assembly.GetExecutingAssembly().GetName().Version + "\r\n" + timeStamp + " Kiev, Ukraine\r\n(c) Petro Protsyk\r\nPiter.Protsyk@gmail.com"; #if PocketPC System.Windows.Forms.MessageBox.Show(message); #elif SILVERLIGHT #else if (System.Windows.Forms.Form.ActiveForm != null) { System.Windows.Forms.MessageBox.Show(message); } else { Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(message); Console.ForegroundColor = ConsoleColor.Gray; } #endif return message; } #endregion } }