protected override void Append(log4net.Core.LoggingEvent loggingEvent) { try { string asm, version; var app = SAPServiceFactory.ApplicationFactory(); GetAsmName(loggingEvent.LocationInformation.ClassName, out asm, out version); if (app != null) { UIAPILog(loggingEvent, app, asm); } if (B1DAO != null && loggingEvent.Level >= Level.Error) { DIAPILog(loggingEvent, asm, version); } } catch (COMException c) { // do nothing, SAP is closed, ignore. } catch (Exception e) { System.Windows.Forms.MessageBox.Show(String.Format("{0}\n\n{1}", e.Message, e.StackTrace)); // Cannot log, can't do anything. Just prevent app crash. } }
public int CompareTo(MenuAttribute other) { SAPbouiCOM.Application app = SAPServiceFactory.ApplicationFactory(); bool thisExists = app.Menus.Exists(this.FatherUID); bool otherExists = app.Menus.Exists(other.FatherUID); if (thisExists && !otherExists) { return(-1); } if (otherExists && !thisExists) { return(1); } if (this.FatherUID == other.FatherUID) { return(this.Position.CompareTo(other.Position)); } return(this.UniqueID.CompareTo(other.UniqueID)); }