/// <summary> /// 选择图片 /// </summary> /// <param name="bgPath">被选择的图片路径</param> private void SelectImage(string bgPath) { string thumbPath = Path.Combine(AyuiConfig.AYUI_BackgroundImageThumbDirectoryPath, "z自定义", Path.GetFileName(bgPath)); ConfigSetting.SetXmlValue("skinBg", "path", bgPath.Replace(Environment.CurrentDirectory, "")); if (!File.Exists(thumbPath)) { Bitmap bm = new Bitmap(bgPath); BitmapImage bi = bm.SetSize(128, 72).ToBitmapImage(); byte[] thumbBuffer = bi.ToBytes(); if (!Directory.Exists(Path.GetDirectoryName(thumbPath))) { Directory.CreateDirectory(Path.GetDirectoryName(thumbPath)); } FileStream fs = new FileStream(thumbPath, FileMode.Create); fs.Write(thumbBuffer, 0, thumbBuffer.Length); fs.Close(); } ConfigSetting.SetXmlValue("skinBg", "thumb", thumbPath.Replace(Environment.CurrentDirectory, "")); //更新主题色,使出反编译大法才找到下面这个方法↓ ThemeManager.AYUI(Application.Current); BackgroundImageChanged?.Invoke(this, new StringEventArgs(bgPath)); }