Inheritance: ICommandAncestor
Exemplo n.º 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;
        }
Exemplo n.º 2
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();
        }