public static IContainer Configure(ILogger logger) { var builder = new ContainerBuilder(); builder.Register(context => { ILogFolder logFolder = context.Resolve <ILogFolder>(); IMainModel model = MainModel.Create(logFolder, logger); return(model); }).As <IMainModel>(); builder.Register(context => { IMainModel mainModel = context.Resolve <IMainModel>(); IMainViewModel mainWindowViewModel = new MainViewModel(mainModel, logger); return(mainWindowViewModel); }).As <IMainViewModel>(); builder.Register(context => { ILogFolder logFolder = new LogFolder(); return(logFolder); }).As <ILogFolder>(); IContainer container = builder.Build(); return(container); }
private void UpdateLogFolderIsActiveProperty(LogFolder logFolder) { if (!_disposed) { LogFolderService.UpdateLogFolderIsActiveSettingAsync(logFolder.Folder.FullName, logFolder.IsActive); } }
private void GenerateDesignTimeData() { var parentLogFolder = new LogFolder(@"C:\WY\Test Logs", this); var parentLogFile = new LogFile(@"C:\WY\Test Logs\20190523_TestApp", parentLogFolder); for (int j = 0; j < 5; j++) { for (int i = 0; i <= 9; i++) { //LogEntries.Add(new LogEntry((LogMessageType)i, DateTime.UtcNow, Environment.UserName, Environment.MachineName, "New message", parentLogFile)); } } }
static void VerifyLogFolder() { if (LogFolder == null) { throw new DirectoryNotFoundException("Target logging directory not found."); } LogFolder.Refresh(); if (!LogFolder.Exists) { LogFolder.Create(); } }
static bool canDelete(LogFolder folder, string filename) { string ext = Path.GetExtension(filename).ToLower(); foreach (string itm in folder.FileExtNameInclude) { if (itm.Equals("*")) { return(true); } if (isExtEqual(itm, ext)) { return(true); } } return(false); }