private async void Window_Loaded(object sender, RoutedEventArgs e) { NotifyIcon.Create(this); Fetcher.BindWindow(this); textBoxAmount.Text = Default.FetchAmount.ToString(); FetchAmount = Default.FetchAmount; #region FetchSource //switch ( Default . FetchSource ) //{ //default: //case 0: // sourceNewest . IsChecked = true; // break; //case 1: // sourceYesterday . IsChecked = true; // break; //} #endregion randomCheckBox.IsChecked = Default.RandomWallpaper; textBoxInterval.Text = Default.WallpaperSetInterval.TotalMinutes.ToString(); wallpaperMainSwitch.IsChecked = Default.WallpaperMainSwitch; if (!string.IsNullOrWhiteSpace(Default.DownloadPath)) { setPath(Default.DownloadPath); } filterCheckBox.IsChecked = Default.FilterAspectRatio; ratio.Value = Default.AspectRatioLimit; ratioText.Text = Default.AspectRatioLimit.ToString(); foreach (TreeViewItem item in categoryTreeView.Items) { if (item.Tag != null && (string)item.Tag == Default.FetchSource) { item.IsSelected = true; } foreach (TreeViewItem item2 in item.Items) { if (item2.Tag != null && (string)item2.Tag == Default.FetchSource) { item2.IsSelected = true; } } } autoRunCheckBox.IsChecked = AutoRun.IsEnabled; FetchInterval = TimeSpan.FromHours(6); if (!string.IsNullOrWhiteSpace(Default.DownloadPath)) { await Fetcher.Fetch(); } showWindowTimer.Interval = TimeSpan.FromSeconds(1); showWindowTimer.Tick += (s2, e2) => { if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "Icarus_Show")) { Show(); Activate(); File.Delete(AppDomain.CurrentDomain.BaseDirectory + "Icarus_Show"); } }; showWindowTimer.Start(); }
//private void test_Click ( object sender , RoutedEventArgs e ) //{ // OpenFileDialog ofd = new OpenFileDialog (); // ofd . InitialDirectory = Environment . GetFolderPath ( Environment . SpecialFolder . MyPictures ); // if ( ofd . ShowDialog ( this ) == true ) // { // wallpaper . SetWallpaper ( null , ofd . FileName ); // } //} private async void buttonManualFetch_Click(object sender, RoutedEventArgs e) { ResetFetchTimer(); await Fetcher.Fetch(); }