//预览图是否显示为原始大小 //private bool isOriSize = true; public PreviewWnd(MainWindow mainW) { this.mainW = mainW; this.InitializeComponent(); if (!System.IO.File.Exists(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\nofont.txt")) { FontFamily = new FontFamily("Microsoft YaHei"); } Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xF0, 0xF0, 0xF0)); MouseLeftButtonDown += new MouseButtonEventHandler(MainWindow_MouseLeftButtonDown); }
public MainWindow() { InitializeComponent(); if (!System.IO.File.Exists(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\nofont.txt")) { FontFamily = new FontFamily("Microsoft YaHei"); } //MaxWidth = System.Windows.SystemParameters.MaximizedPrimaryScreenWidth; //MaxHeight = System.Windows.SystemParameters.MaximizedPrimaryScreenHeight; /////////////////////////////////////// init image site list ////////////////////////////////// Dictionary<string, MenuItem> dicSites = new Dictionary<string, MenuItem>(); List<MenuItem> tempSites = new List<MenuItem>(); int index = 0; foreach (ImageSite site in SiteManager.Instance.Sites) { MenuItem menuItem = null; //group by shortName if (dicSites.ContainsKey(site.ShortName)) { menuItem = dicSites[site.ShortName]; } else { int space = site.SiteName.IndexOf(' '); if (space > 0) menuItem = new MenuItem() { Header = site.SiteName.Substring(0, space) }; else menuItem = new MenuItem() { Header = site.SiteName }; menuItem.Style = Resources["SimpleMenuItem"] as Style; dicSites.Add(site.ShortName, menuItem); } MenuItem subItem = new MenuItem() { Header = site.SiteName, ToolTip = site.ToolTip, DataContext = index++ }; subItem.Click += new RoutedEventHandler(menuItem_Click); subItem.Style = Resources["SimpleMenuItem"] as Style; menuItem.Items.Add(subItem); } index = 0; foreach (ImageSite site in SiteManager.Instance.Sites) { MenuItem menuItem = dicSites[site.ShortName]; if (menuItem == null) continue; if (menuItem.Items.Count == 1) { menuItem = menuItem.Items[0] as MenuItem; } //menuItem.Icon = new BitmapImage(new Uri("/Images/site" + (index++) + ".ico", UriKind.Relative)); System.IO.Stream iconStr = site.IconStream; if (iconStr != null) { BitmapImage ico = new BitmapImage(); ico.CacheOption = BitmapCacheOption.Default; ico.BeginInit(); ico.StreamSource = site.IconStream; ico.EndInit(); menuItem.Icon = ico; } tempSites.Add(menuItem); dicSites[site.ShortName] = null; } siteMenu.ItemsSource = tempSites; siteMenu.Header = SiteManager.Instance.Sites[comboBoxIndex].ShortName; siteMenu.Icon = tempSites[0].Icon; siteText.Text = "当前站点 " + SiteManager.Instance.Sites[comboBoxIndex].ShortName; //comboBox1.ItemsSource = tempSites; //comboBox1.SelectedIndex = 0; ///////////////////////////////////////////////////////////////////////////////////////////// viewedIds = new Dictionary<string, ViewedID>(SiteManager.Instance.Sites.Count); Proxy = "127.0.0.1:8000"; ProxyType = MoeLoader.ProxyType.System; bossKey = System.Windows.Forms.Keys.Subtract; LoadConfig(); //itmxExplicit.IsChecked = !showExplicit; MainW = this; }
public OptionWnd(MainWindow main) { this.main = main; this.InitializeComponent(); if (!System.IO.File.Exists(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\nofont.txt")) { FontFamily = new FontFamily("Microsoft YaHei"); } //if (System.Environment.OSVersion.Version.Major >= 6) //{ // if (GlassHelper.DwmIsCompositionEnabled()) // { // chkAero.IsEnabled = true; // } //} //SetColor(main.GetColor()); //chkPos.IsChecked = main.rememberPos; txtProxy.Text = MainWindow.Proxy; //chkProxy.IsChecked = MainWindow.ProxyEnable; if (MainWindow.ProxyType == ProxyType.Custom) { rtCustom.IsChecked = true; txtProxy.IsEnabled = true; } else if (MainWindow.ProxyType == ProxyType.None) { rtNoProxy.IsChecked = true; } txtBossKey.Text = MainWindow.BossKey.ToString(); txtPattern.Text = main.namePatter; chkProxy_Click(null, null); //chkAero.IsChecked = main.isAero; txtCount.Text = PreFetcher.CachedImgCount.ToString(); txtParal.Text = main.downloadC.NumOnce.ToString(); chkSepSave.IsChecked = main.downloadC.IsSepSave; txtSaveLocation.Text = DownloadControl.SaveLocation; if (main.bgSt == Stretch.None) { cbBgSt.SelectedIndex = 0; } else if (main.bgSt == Stretch.Uniform) { cbBgSt.SelectedIndex = 1; } else if (main.bgSt == Stretch.UniformToFill) { cbBgSt.SelectedIndex = 2; } if (main.bgHe == AlignmentX.Left) { cbBgHe.SelectedIndex = 0; } else if (main.bgHe == AlignmentX.Center) { cbBgHe.SelectedIndex = 1; } else if (main.bgHe == AlignmentX.Right) { cbBgHe.SelectedIndex = 2; } if (main.bgVe == AlignmentY.Top) { cbBgVe.SelectedIndex = 0; } else if (main.bgVe == AlignmentY.Center) { cbBgVe.SelectedIndex = 1; } else if (main.bgVe == AlignmentY.Bottom) { cbBgVe.SelectedIndex = 2; } textNameHelp.ToolTip = "%site 站点缩写\r\n%id 编号\r\n%tag 标签\r\n%desc 描述"; }