Esempio n. 1
0
        private async Task ExecuteOpenFile(FileSystemInfoModel model)
        {
            if (model == null)
            {
                var dlg = new OpenFileDialog();
                if (dlg.ShowDialog().GetValueOrDefault())
                {
                    model          = new FileSystemInfoModel(new FileInfo(dlg.FileName), null);
                    ActiveDocument = await OpenAsync(model);
                }
            }
            else
            {
                if (model.IsDirectory)
                {
                    model.IsExpanded = !model.IsExpanded;
                }
                else if (model.IsFile)
                {
                    // TODO: make this a background task
                    await RequestFileOpen(model);

                    //await Task.Run(() => RequestFileOpen(model));
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// class constructor
        /// </summary>
        /// <param name="workSpaceViewModel"></param>
        /// <param name="initialPath"></param>
        /// <param name="isExistingInFileSystem"></param>
        public DocumentViewModel(IWorkSpaceViewModel workSpaceViewModel,
                                 FileSystemInfoModel model,
                                 bool isExistingInFileSystem)
            : this(workSpaceViewModel)
        {
            fileinfo     = model;
            _initialPath = fileinfo.FullName;

            try
            {
                Title = System.IO.Path.GetFileName(fileinfo.FullName);
            }
            catch { }

            ContentId = fileinfo.FullName;
            _IsExistingInFileSystem = isExistingInFileSystem;
        }
Esempio n. 3
0
 private bool CanOpenFile(FileSystemInfoModel model) => true;