private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { if (activityLogger != null) { activityLogger.Dispose(); activityLogger = null; } } // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. // TODO: set large fields to null. disposedValue = true; } }
public Hagen(LPath dataDirectory = null) { if (dataDirectory == null) { dataDirectory = DefaultDataDirectory; } this.dataDirectory = dataDirectory; LogDatabase = new LogDatabase(this.LogDatabasePath); activityLogger = new ActivityLogger(LogDatabase); this.Context = new Context(this) { DataDirectory = dataDirectory, DocumentDirectory = Paths.GetFolderPath(Environment.SpecialFolder.MyDocuments).CatDir("hagen") } .AddService(this.LogDatabase) .AddService <IContract>(new Contract()) .AddService <IWorkTime>(_ => new WorkTime(_.GetService <ILogDatabase>(), _.GetService <IContract>())) .AddService <IFileIconProvider>(_ => new FileIconProvider()); }