Ejemplo n.º 1
0
        public async void _ViewFileGetDBClick(object sender, EventArgs e)
        {
            try
            {
                string fileName = _view.GetDBFile;
                string content  = "";

                await Task.Factory.StartNew(() =>
                                            content = _manegerDB.GetContent(fileName),
                                            TaskCreationOptions.LongRunning);

                _view.Content = content;

                if (content == "")
                {
                    _messageService.ShowExclamation("file not exists or empty");
                }
            }
            catch (Exception ex)
            {
                _messageService.ShowError(ex.Message);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// select file from a file system
        /// </summary>
        public void _ViewFileOpenClick(object sender, EventArgs e)
        {
            try
            {
                string filePath  = _view.FilePath;
                bool   isExistst = _maneger.IsExist(filePath);

                if (!isExistst)
                {
                    _messageService.ShowExclamation("The file is not exist");
                    return;
                }

                _currentFilePath = filePath;

                string content = _maneger.GetContent(filePath);

                _view.Content = content;
            }
            catch (Exception ex)
            {
                _messageService.ShowError(ex.Message);
            }
        }