예제 #1
0
 public static TM_Event <T, P> raise <T, P>(this TM_Event <T, P> tmEvent, P parameter)
 {
     if (tmEvent.notNull())
     {
         tmEvent.Last_Exception = null;
         foreach (var action in tmEvent)
         {
             if (action.notNull())
             {
                 tmEvent.Total_Invocations++;
                 try
                 {
                     action.Invoke(tmEvent.Target, parameter);
                 }
                 catch (Exception ex)
                 {
                     tmEvent.Last_Exception = ex;
                     tmEvent.Total_Exceptions++;
                     // TODO add option to decide if it should return on exception
                 }
             }
         }
     }
     return(tmEvent);
 }
예제 #2
0
 //TM_Event<T>
 public static TM_Event <T> add_Action <T>(this TM_Event <T> tmEvent, Action <T> action)
 {
     if (tmEvent.notNull() && action.notNull())
     {
         tmEvent.add(action);
     }
     return(tmEvent);
 }
예제 #3
0
        public Events_TM_UserData(TM_UserData tmUserData)
        {
            this.Target = tmUserData;
            this.Before_TM_Config_Load    = new TM_Event <TM_UserData>(tmUserData);
            this.After_TM_Config_Load     = new TM_Event <TM_UserData>(tmUserData);
            this.After_TM_Config_Changed  = new TM_Event <TM_UserData>(tmUserData);
            this.After_TM_SecretData_Load = new TM_Event <TM_UserData>(tmUserData);
            this.After_Users_Load         = new TM_Event <TM_UserData>(tmUserData);

            this.User_Deleted = new TM_Event <TM_UserData, TMUser>(tmUserData);
            this.User_Updated = new TM_Event <TM_UserData, TMUser>(tmUserData);
        }
예제 #4
0
        public Events_TM_Xml_Database(TM_Xml_Database tmXmlDatabase)
        {
            this.Target                 = tmXmlDatabase;
            Before_Setup                = new TM_Event <TM_Xml_Database>(tmXmlDatabase);
            After_Setup                 = new TM_Event <TM_Xml_Database>(tmXmlDatabase);
            After_Set_Default_Values    = new TM_Event <TM_Xml_Database>(tmXmlDatabase);
            After_Set_Path_XmlLibraries = new TM_Event <TM_Xml_Database>(tmXmlDatabase);
            //         After_TmServer_Load         = new TM_Event<TM_Xml_Database>(tmXmlDatabase);
            After_Load_UserData  = new TM_Event <TM_Xml_Database>(tmXmlDatabase);
            After_Load_SiteData  = new TM_Event <TM_Xml_Database>(tmXmlDatabase);
            After_Load_Libraries = new TM_Event <TM_Xml_Database>(tmXmlDatabase);

            Articles_Cache_Updated = new TM_Event_TM_Xml_Database(tmXmlDatabase);
            Article_Saved          = new TM_Event_TM_Article(tmXmlDatabase);
            Article_Deleted        = new TM_Event_TM_Article(tmXmlDatabase);

            Library_Deleted       = new TM_Event_TM_Library(tmXmlDatabase);
            GuidanceExplorer_Save = new TM_Event_GuidanceExplorer(tmXmlDatabase);

            VirtualArticles_Loaded = new TM_Event_TM_Xml_Database(tmXmlDatabase);
            VirtualArticles_Saved  = new TM_Event_TM_Xml_Database(tmXmlDatabase);
        }