using System; using System.Collections.Generic; using System.Linq; using System.Text; using AyaNova.PlugIn; using GZTW.AyaNova.BLL; namespace AyaNova.PlugIn.PerfAdvisor { class perf : IAyaNovaPlugin { private static bool bActive = false; #region IAyaNovaPlugin Members #region header stuff public string PluginName { get { return "Performance Advisor"; } } public string PluginVersion { get { return "6.0.0.0"; } } public string About { get { return "AyaNova Performance Advisor Copyright 2009-2010 Ground Zero Tech-Works Inc."; } } public Guid PluginID { get { return new Guid("{0883B817-7BD5-4ee0-A233-C924256C33C9}"); } } public System.Drawing.Image PluginSmallIcon { get { return null; } } public System.Drawing.Image PluginLargeIcon { get { return null; } } public System.Resources.ResourceManager AyaNovaResourceManager { set { ; } } #endregion header stuff #region start / stop public bool Initialize(Version AyaNovaVersion, LocalizedTextTable localizedText) { // User u = User.GetItem(User.CurrentThreadUserID); bActive = true;// (u.UserType == UserTypes.Administrator && AyaBizUtils.Right(RootObjectTypes.Client) > (int)SecurityLevelTypes.ReadOnly); return bActive; } public void Close() { ; } #endregion start stop #region Show / menu options public bool SingleObjectMenuShow(RootObjectTypes objectType) { //Only show in main menu return objectType == RootObjectTypes.Nothing; } public bool MultipleObjectsMenuShow(RootObjectTypes objectType) { return false; } public List SingleObjectMenuOptions(RootObjectTypes objectType, object ayaNovaObject) { List l = new List(1); l.Add(new AyaNovaPluginMenuItem("ADVISE", "Test", null, null)); return l; } public List MultipleObjectsMenuOptions(RootObjectTypes objectType) { return null; } #endregion show/options #region Commands public bool CommandSelectedForList(string commandKey, RootObjectTypes objectType, List objectIDList, object listObject) { return false; } public void CommandSelectedForSingleObject(string commandKey, RootObjectTypes objectType, object ayaNovaObject) { if (commandKey == "ADVISE") new Advisor().ShowDialog(); } #endregion commands #endregion } #region Menu item structure /// ///Performance test data /// [Serializable] public struct PerfItem { public PerfItem(string Test, long Milliseconds, long Count) { mTest = Test; mMilliseconds = Milliseconds; mCount = Count; } internal string mTest; internal long mMilliseconds; internal long mCount; public string Test { get { return mTest; } } public long Milliseconds { get { return mMilliseconds; } } public long Count { get { return mCount; } } public long MillisecondsAverage { get { return mMilliseconds / mCount; } } public long Seconds { get { return mMilliseconds / 1000; } } } #endregion }