diff --git a/TWeather2015/MainWindow.xaml.cs b/TWeather2015/MainWindow.xaml.cs index 9653734..fe9f9d4 100644 --- a/TWeather2015/MainWindow.xaml.cs +++ b/TWeather2015/MainWindow.xaml.cs @@ -124,6 +124,7 @@ private void Window_Loaded(object sender, RoutedEventArgs e) files.AddRange(Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.CommonDesktopDirectory))); dIconManager.loadIcons(files.ToArray()); } + dIconManager.reCalculateItems(); //dIconManager.UpdateLayout(); } diff --git a/TWeather2015/TWeather2015.csproj b/TWeather2015/TWeather2015.csproj index 7c0798f..eb9ae45 100644 --- a/TWeather2015/TWeather2015.csproj +++ b/TWeather2015/TWeather2015.csproj @@ -5,7 +5,7 @@ Debug AnyCPU {58FBC381-0364-4014-8EED-8E4EC0E169AC} - Exe + WinExe Properties TWeather2015 TWeather2015 diff --git a/TWeather2015/Theme/DIconManager.xaml.cs b/TWeather2015/Theme/DIconManager.xaml.cs index f44d36f..4283975 100644 --- a/TWeather2015/Theme/DIconManager.xaml.cs +++ b/TWeather2015/Theme/DIconManager.xaml.cs @@ -1,17 +1,10 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; -using System.Text; -using System.Threading.Tasks; 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 TWeather2015.Core; namespace TWeather2015.Theme @@ -76,6 +69,7 @@ public void loadIcons(string[] files) DIconPositionManager.loadPositions(); foreach (var f in files) { + if (isFileHidden(f)) continue; var p = DIconPositionManager.getPosition(f); if (p.x == 0 && p.y == 0) addNewIconToEnd(f); @@ -89,6 +83,7 @@ public void loadIcons(string[] files) public DIcon addNewIconToEnd(string filename) { + if (isFileHidden(filename)) return null; for (int i = 0; i < wcount; i++) for (int j = 0; j < hcount; j++) { @@ -283,6 +278,7 @@ internal void addNewIcon(string fullPath) { this.Dispatcher.Invoke((Action)(() => { + if (isFileHidden(fullPath)) return; var p = DIconPositionManager.getPosition(fullPath); if (p.x == 0 && p.y == 0) addNewIconToEnd(fullPath); @@ -375,5 +371,10 @@ public int Compare(TKey x, TKey y) #endregion } + + static public bool isFileHidden(string fileName) + { + return new FileInfo(fileName).Attributes.HasFlag(FileAttributes.Hidden); + } } }