Пример #1
0
        public AddFolderPathVM(IWinSimple win)
        {
            _callingWin = win;

            CommandExit = new CommandRelay(commandExitExecute, p => true);
            CommandSave = new CommandRelay(commandSaveExecute, commandSaveCanExecute);
            CommandAdd = new CommandRelay(commandAddExecute, commandAddCanExecute);
            CommandRemove = new CommandRelay(commandRemoveExecute, commandRemoveCanExecute);
            CommandSelectFolder = new CommandRelay(commandSelectFolderExecute, p => true);

            string path = Constants.FOLDERS_FILE_PATH;
            IList<PathItem> folders = null;
            ;
            try
            {
                folders = DataService.ParseFolderFile(path);
            }
            catch (Exception ex)
            {
                string message = String.Format((string) Resources.GlobalHelper_ParseFolderFile_Error_Text, path, ex.Message);
                MessageBox.Show(message, Resources.GlobalHelper_ParseFolderFile_Error_Title, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                
            }
           
            
            _pathList = folders != null ? new ObservableCollection<PathItem>(folders) : new ObservableCollection<PathItem>();

            ListChanged = false;
        }
Пример #2
0
        public MainWindowVM(IWinSimple win,
                            RecentFileList recentFileList)
        {
            _layoutFileName = Path.Combine(AppDataDirectoryPath,
                                           Assembly.GetEntryAssembly().GetName().Name + ".ColLayout");

            _callingWin = win;

            _workspace = new LogAnalysisWorkspace();
            YalvRegistry.Instance.SetActualLogAnalysisWorkspace(_workspace);

            _yalvLogViewModel = new YalvViewModel();

            CommandCancelProcessing = YalvLogViewModel.CommandCancelProcessing;

            if (CreateAppDataDir())
            {
                _yalvLogViewModel.LogEntryRows.LoadColumnsLayout(_layoutFileName);
            }

            RecentFileList = recentFileList;

            CommandExit     = new RelayCommand <object>((p) => CommandExitExecute(p), p => true);
            CommandOpenFile = new RelayCommand <object>((p) => CommandOpenFileExecute(p), CommandOpenFileCanExecute);

            CommandExport                 = new RelayCommand <object>((p) => CommandExportExecute(p), p => true);
            CommandOpenSqliteDatabase     = new RelayCommand <object>((p) => CommandOpenSqliteDatabaseExecute(p), p => true);
            CommandOpenLogAnalysisSession = new RelayCommand <object>((p) => CommandOpenLogAnalysisSessionExecute(p), p => true);
        }
Пример #3
0
        public AddFolderPathVM(IWinSimple win)
        {
            _callingWin = win;

            CommandExit         = new CommandRelay(commandExitExecute, p => true);
            CommandSave         = new CommandRelay(commandSaveExecute, commandSaveCanExecute);
            CommandAdd          = new CommandRelay(commandAddExecute, commandAddCanExecute);
            CommandRemove       = new CommandRelay(commandRemoveExecute, commandRemoveCanExecute);
            CommandSelectFolder = new CommandRelay(commandSelectFolderExecute, p => true);

            string           path    = Constants.FOLDERS_FILE_PATH;
            IList <PathItem> folders = null;

            ;
            try
            {
                folders = DataService.ParseFolderFile(path);
            }
            catch (Exception ex)
            {
                string message = String.Format((string)Resources.GlobalHelper_ParseFolderFile_Error_Text, path, ex.Message);
                MessageBox.Show(message, Resources.GlobalHelper_ParseFolderFile_Error_Title, MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }


            _pathList = folders != null ? new ObservableCollection <PathItem>(folders) : new ObservableCollection <PathItem>();

            ListChanged = false;
        }
Пример #4
0
        public AddFolderPathVM(IWinSimple win)
        {
            _callingWin = win;

            CommandExit         = new CommandRelay(commandExitExecute, p => true);
            CommandSave         = new CommandRelay(commandSaveExecute, commandSaveCanExecute);
            CommandAdd          = new CommandRelay(commandAddExecute, commandAddCanExecute);
            CommandRemove       = new CommandRelay(commandRemoveExecute, commandRemoveCanExecute);
            CommandSelectFolder = new CommandRelay(commandSelectFolderExecute, p => true);

            IList <PathItem> folders = GlobalHelper.ParseFolderFile(GlobalHelper.FOLDERS_FILE_PATH);

            _pathList = folders != null ? new ObservableCollection <PathItem>(folders) : new ObservableCollection <PathItem>();

            ListChanged = false;
        }
Пример #5
0
        public MainWindowVM(IWinSimple win)
        {
            _callingWin = win;

            CommandExit = new CommandRelay(commandExitExecute, p => true);
            CommandOpenFile = new CommandRelay(commandOpenFileExecute, commandOpenFileCanExecute);
            CommandSelectFolder = new CommandRelay(commandSelectFolderExecute, commandSelectFolderCanExecute);
            CommandSaveFolder = new CommandRelay(commandSaveFolderExecute, commandSaveFolderCanExecute);
            CommandRefresh = new CommandRelay(commandRefreshExecute, commandRefreshCanExecute);
            CommandRefreshFiles = new CommandRelay(commandRefreshFilesExecute, commandRefreshFilesCanExecute);
            CommandClear = new CommandRelay(commandClearExecute, commandClearCanExecute);
            CommandDelete = new CommandRelay(commandDeleteExecute, commandDeleteCanExecute);
            CommandOpenSelectedFolder = new CommandRelay(commandOpenSelectedFolderExecute, commandOpenSelectedFolderCanExecute);
            CommandSelectAllFiles = new CommandRelay(commandSelectAllFilesExecute, commandSelectAllFilesCanExecute);
            CommandIncreaseInterval = new CommandRelay(commandIncreaseIntervalExecute, p => true);
            CommandDecreaseInterval = new CommandRelay(commandDecreaseIntervalExecute, p => true);
            CommandAbout = new CommandRelay(commandAboutExecute, p => true);

            FileList = new ObservableCollection<FileItem>();
            Items = new ObservableCollection<LogItem>();
            loadFolderList();

            SelectedFile = null;
            IsFileSelectionEnabled = false;
            IsLoading = false;

            _selectAll = true;
            _selectDebug = _selectInfo = _selectWarn = _selectError = _selectFatal = false;
            _showLevelDebug = _showLevelInfo = _showLevelWarn = _showLevelError = _showLevelFatal = true;

            bkLoader = new BackgroundWorker();
            bkLoader.WorkerSupportsCancellation = true;
            bkLoader.DoWork += bkLoaderRun;
            bkLoader.RunWorkerCompleted += bkLoaderCompleted;

            _dispatcherTimer = new DispatcherTimer();
            _dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick);

            AutoRefreshInterval = Constants.DEFAULT_REFRESH_INTERVAL;
            IsAutoRefreshEnabled = false;

            refreshWindowTitle();
        }
Пример #6
0
 public static IMainWindowVM CreateMainViewModel(IWinSimple win,
                                                 RecentFileList recentFileList)
 {
     return(new MainWindowVM(win, recentFileList));
 }
Пример #7
0
 public AddFolderPathVM(IWinSimple win)
     : this(win, new PathItemService())
 {
 }