Ejemplo n.º 1
0
        /// <summary>
        /// Constructor for the MainViewModel
        /// </summary>
        /// <param name="iDialogWrapper">Interface for the log-file-open-selection-dialog</param>
        /// <param name="iAssemblyWrapper">Interface for the get-application-version class</param>
        /// <param name="iParsingFactory">Interface for determining which parsing strategy we need to use</param>
        /// <param name="iFilterFactory">Interface for the filters we need to use in the TabViewModel</param>
        /// <param name="iLog">Interface for the LogParse's log file</param>
        public MainViewModel(IDialogWrapper iDialogWrapper, IAssemblyWrapper iAssemblyWrapper, IParsingFactory iParsingFactory, IFilterFactory iFilterFactory, ILog iLog)
        {
            _dialogWrapper   = iDialogWrapper ?? throw new ArgumentNullException(nameof(iDialogWrapper));
            _assemblyWrapper = iAssemblyWrapper ?? throw new ArgumentNullException(nameof(iAssemblyWrapper));
            _parsingFactory  = iParsingFactory ?? throw new ArgumentNullException(nameof(iParsingFactory));
            _filterFactory   = iFilterFactory ?? throw new ArgumentNullException(nameof(iFilterFactory));
            _iLog            = iLog ?? throw new ArgumentNullException(nameof(iLog));
            _listLoadLine    = new ObservableCollection <LogModel>();
            _closedTabsList  = new List <ITab>();

            Tabs = new ObservableCollection <ITab>();

            ClickMenuCommand         = new RelayCommand(SelectLogFile);
            OpenClosedTabMenuCommand = new RelayCommand(ReOpenLastClosedTab);
            CloseTabCommand          = new RelayCommand <ITab>(CloseTab);
            ClickOpenNotepadCommand  = new RelayCommand(OpenNotepad);
            ExitCommand                   = new RelayCommand(ExitApplication);
            DropInFileCommand             = new RelayCommand <DragEventArgs>(OpenDroppedFiles);
            ChangeSizeWindowCommand       = new RelayCommand <EventArgs>(ChangeSizeWindow);
            CloseWindowCommand            = new RelayCommand(CloseWindow);
            LastClosedTabOpenEventCommand = new RelayCommand(ReOpenLastClosedTabEvent);
            TabMouseClickCommand          = new RelayCommand <ITab>(CloseTabMiddleButton);

            GetVersion();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor for the TabViewModel
        /// </summary>
        /// <param name="iParsingFactory">Interface for determining which parsing strategy we need to use</param>
        /// <param name="iParsingStrategy">Interface for the determining how to parse a log file</param>
        /// <param name="iFilterFactory">Interface for the filters we need to use</param>
        /// <param name="iLog">Interface for the LogParse's log file</param>
        /// <param name="logFilePath">A string containing the path to the log file</param>
        public TabViewModel(IParsingFactory iParsingFactory, IParsingStrategy iParsingStrategy, IFilterFactory iFilterFactory, ILog iLog, string logFilePath)
        {
            _fileWatcher     = new FileWatcher();
            _parsingFactory  = iParsingFactory;
            _filterfactory   = iFilterFactory;
            _parsingStrategy = iParsingStrategy;
            _iLog            = iLog;
            _logFilePath     = logFilePath;

            ListFilters          = new ObservableCollection <ObservableCollection <LogModel> >();
            _logLvlComboEnumList = Enum.GetValues(typeof(LogLevelEnum)).OfType <LogLevelEnum>().ToList();

            PopulateList(GetLines(logFilePath));

            Messenger.Default.Register <double>(this, UpdateScrollViewSize);

            ExtractFileName();
            GetLogInfo();

            _fileWatcher.OnFileModified = (s) => FileChangeEvent(s);
            _fileWatcher.Watch(logFilePath);

            NoDateCheckBoxIsValid = _listLoadLine.Any(x => x.DateTime == DateTime.MinValue);
        }
Ejemplo n.º 3
0
 public void Initialize()
 {
     parsingFactory = new ParsingFactory();
 }