public MainWindow() { InitializeComponent(); cs = new CurrentSynchro(); DataContext = this; if (string.IsNullOrEmpty(Properties.Settings.Default.rootFolder)) { if (System.IO.Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments))) { txtRootFolder.Text = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); Properties.Settings.Default.rootFolder = txtRootFolder.Text; Properties.Settings.Default.Save(); } } else { txtRootFolder.Text = Properties.Settings.Default.rootFolder; } _rootFolder = txtRootFolder.Text; itemProvider = new ItemProvider(); items = itemProvider.GetItems(txtRootFolder.Text); //tvFilesFolders.DataContext = items; //lstFiles.DataContext = items; txtRootFolder.TextChanged += txtRootFolder_TextChanged; GetGoogleAccountSettings(); AdaptGoogleAccountList(); SetColorsOfItemList(items); //cmb_GoogleAccount.ItemsSource = GoogleAccounts; lstFiles.ItemsSource = items; }
void txtRootFolder_TextChanged(object sender, TextChangedEventArgs e) { _rootFolder = txtRootFolder.Text; var itemProvider = new ItemProvider(); var items = itemProvider.GetItems(txtRootFolder.Text); //tvFilesFolders.DataContext = items; lstFiles.ItemsSource = items; if (_GoogleAccounts != null && _GoogleAccounts.Count > 0) { foreach (GoogleAccount ga in _GoogleAccounts) { ga.ClearListToUpload(); } } SetColorsOfItemList(items); }