|
FileSystemWatcher
|
|||
---|---|---|---|
#18+
Кто знает как решить эту проблему??????? код: пример using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using System.Data; using System.IO; using System.Collections.ObjectModel; namespace LvData { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } ObservableCollection<GData> _GCollection = new ObservableCollection<GData>(); public ObservableCollection<GData> GCollection { get { return _GCollection; } } System.IO.FileSystemWatcher sr = new FileSystemWatcher(); private void Window_Loaded(object sender, RoutedEventArgs e) { sr.Filter = "*.*"; sr.IncludeSubdirectories = false; sr.NotifyFilter = NotifyFilters.FileName; sr.Path = @"J:\D\00\"; sr.EnableRaisingEvents = true; sr.Created += new System.IO.FileSystemEventHandler(this.FSW_Created); sr.Deleted += new System.IO.FileSystemEventHandler(this.FSW_Delete); } private void FSW_Created(object sender, FileSystemEventArgs e) { try { _GCollection.Add(new GData { GName = e.Name, Status = "другая информация", FPath = e.FullPath }); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } } public class GData { public string GName { get; set; } public string Status { get; set; } public string FPath { get; set; } } пытаюсь заполнить ListView привязку делаю в XAML выдает ошибку: смотрите прикрепленный файл пробовал по другому ругается что ListView и FileSystemWatcher созданы в разных потоках ... |
|||
:
Нравится:
Не нравится:
|
|||
29.06.2011, 15:03 |
|
FileSystemWatcher
|
|||
---|---|---|---|
#18+
VIT2708, использовать Dispatcher? Код: plaintext 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18.
... |
|||
:
Нравится:
Не нравится:
|
|||
29.06.2011, 15:42 |
|
FileSystemWatcher
|
|||
---|---|---|---|
#18+
уТКа, спасибо щас попробую ... |
|||
:
Нравится:
Не нравится:
|
|||
29.06.2011, 15:49 |
|
|
start [/forum/topic.php?fid=21&msg=37329039&tid=1442258]: |
0ms |
get settings: |
8ms |
get forum list: |
11ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
32ms |
get topic data: |
9ms |
get forum data: |
2ms |
get page messages: |
41ms |
get tp. blocked users: |
1ms |
others: | 13ms |
total: | 123ms |
0 / 0 |