Beispiel #1
0
        public FSData(string path, FSDataContainer owner)
        {
            _isChecked = false;
            _parent    = null;
            _owner     = owner;
            try
            {
                _node = new DirectoryInfo(path);
            }
            catch (IOException)
            {
                try
                {
                    _node = new FileInfo(path);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error: Unhandled Exception", MessageBoxButton.OK);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error: Unhandled Exception", MessageBoxButton.OK);
            }

            LoadChildren();
        }
Beispiel #2
0
 public FSData(FileSystemInfo d, FSData parent, FSDataContainer owner)
 {
     _isChecked = false;
     _parent    = parent;
     _node      = d;
     _owner     = owner;
     LoadChildren();
 }
Beispiel #3
0
        private void LoadFolders()
        {
            txtMessage.Text         = $"{Properties.Resources.txtMessageSearch}\n{location}";
            txtLocation.IsEnabled   = false;
            btnFilePicker.IsEnabled = false;
            LoadFoldersDelegate load_folders = ((string path) => {
                FSDataContainer newRoot = new FSDataContainer(path);
                return(newRoot);
            });

            load_folders.BeginInvoke(location, FoldersLoaded, this);
        }
Beispiel #4
0
        private void FoldersLoaded(IAsyncResult theResults)
        {
            AsyncResult         results = (AsyncResult)theResults;
            LoadFoldersDelegate source  = (LoadFoldersDelegate)results.AsyncDelegate;

            this.Dispatcher.Invoke(DispatcherPriority.Background, (Action)(() =>
            {
                root = source.EndInvoke(results);
                tvDirectory.Items.Refresh();
                txtMessage.Text = $"{Properties.Resources.txtMessageDone}\n{location}";
                txtLocation.IsEnabled = true;
                btnFilePicker.IsEnabled = true;
            }));
        }