public MainViewModel(ISnackbarMessageQueue messageQueue, Interfaces.ILog log, IBookmarkService bookmarkService, [ImportMany] IEnumerable <ExportFactory <IPageViewModel, IPageViewModelMetadata> > viewModels, [ImportMany] IEnumerable <Lazy <IPageView, IPageViewMetadata> > views, DialogHelpViewModel helpViewModel) { _log = log; _pageFactories = viewModels.ToDictionary(vm => vm.Metadata.Context, vm => (ExportFactory <IPageViewModel>)vm); _bookmarkService = bookmarkService; MessageQueue = messageQueue; Pages = new ObservableCollection <Model.Context>(views.Where(p => p.Metadata.Context != null).OrderBy(p => p.Metadata.Index).Select(p => (Model.Context)Activator.CreateInstance(p.Metadata.Context))); Bookmarks = new ObservableCollection <Context>(_bookmarkService.Bookmarks); Tabs = new ObservableCollection <IPageViewModel>(); UseDarkColorScheme = Properties.Settings.Default.DarkColorScheme; OpenInNewTab = Properties.Settings.Default.OpenInNewTab; OpenTabCommand = new DelegateCommand <Context>(CreateTab); ReplaceTabCommand = new DelegateCommand <Context>(ReplaceTab); CloseTabCommand = new DelegateCommand <PageViewModel>(CloseTab, t => Tabs.Count > 1); ReindexCommand = new DelegateCommand(() => _log.Update(null, CancellationToken.None)); OpenCommand = new DelegateCommand <string[]>(Open); EditCommand = new DelegateCommand <SearchContext>(_bookmarkService.Edit, c => !c.IsFromRepository); DeleteCommand = new DelegateCommand <SearchContext>(_bookmarkService.Remove, c => !c.IsFromRepository); SaveCommand = new DelegateCommand(() => _bookmarkService.Save((SearchContext)CurrentTab.Context), () => CurrentTab is IPageViewModel page && page.Context is SearchContext); ManageBookmarksCommand = new DelegateCommand(_bookmarkService.Manage); SelectBookmarkRepositoryCommand = new DelegateCommand(SelectBookmarkRepository); ClearBookmarkRepositoryCommand = new DelegateCommand(ClearBookmarkRepository, () => !string.IsNullOrEmpty(Properties.Settings.Default.BookmarkRepositoryFile)); ShowHelpCommand = new DelegateCommand(() => DialogHost.Show(helpViewModel)); // update the bookmark list when the service updates _bookmarkService.CollectionChanged += (s, e) => { Bookmarks.Clear(); Bookmarks.AddRange(_bookmarkService.Bookmarks); }; // create the initial tab CreateTab((Context)Pages.First().Clone()); }
public WaveStream(IFileMedia fileMedia, IFileConfiguration fileConfig, Interfaces.ILog log) { this.logger = log; this.fileConfig = fileConfig; this.ms = new MemoryStream(); this.writeToWaveFunc = fileMedia.GetDataSenderFunc(fileConfig, log).Result; }
public Model(Interfaces.IBackend backend, Interfaces.ILog logger, string tableName) { this._backend = backend; this.tableName = tableName; this._logger = logger; // create table for the model this.createTable(); }
public static void Init() { generalAppLogger = IoC.Get <ILog>(); string logDir = DirectoryUtilities.GetLogDirectory(); string filename = string.Format("activity_log_main.{0}.txt", GeneralUtilities.ProcessId); string logFile = Path.Combine(logDir, filename); generalAppLogger.ConfigureLogging(filename, logFile); IoC.Get <ILogInstanceManager>().Register(filename, generalAppLogger, true); HandBrakeUtils.MessageLogged += HandBrakeUtils_MessageLogged; HandBrakeUtils.ErrorLogged += HandBrakeUtils_ErrorLogged; }
public SearchViewModel(ISnackbarMessageQueue messages, Interfaces.ILog log) { _messageQueue = messages; _log = log; _log.Loaded += (s, e) => Invoke(async() => { InvalidateQuery(); await Update(); }); Rows = new ILogItem[0]; Columns = new ObservableCollection <ColumnData>(); Chart = new ChartViewModel(); Chart.Updated += (s, e) => StoreVisualizationsToModel(); NavigateBackwardCommand = new DelegateCommand(NavigateBackward, () => _past.Count > 0); NavigateForwardCommand = new DelegateCommand(NavigateForward, () => _future.Count > 0); UpdateCommand = new DelegateCommand(UpdateCommandExecute); CopyDataCommand = new DelegateCommand <ILogItem>(CopyData); SaveDataCommand = new DelegateCommand(SaveDataCommandExecute, SaveDataCommandCanExecute); }
/// <summary> /// Gets an shared instance of the logger. Logging is enabled by default /// You can turn it off by calling Disable() if you don't want it. /// </summary> /// <returns> /// An instance of this logger. /// </returns> public static ILog GetLogger() { return(loggerInstance ?? (loggerInstance = new LogService())); }
public DotNetCoreWrapper(Interfaces.ILog logger) { this.logger = logger; }
public static void ConfigureLogger(Interfaces.ILog logger) { ImporterException.logger = logger; }