Windows/FontAwesomeWindow.xaml.cs

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Forms;
using XStart.Const;
using XStart2._0.Bean;
using XStart2._0.Utils;
using XStart2._0.ViewModels;
using static XStart2._0.Utils.FontAwesome6;

namespace XStart2._0.Windows {
    /// <summary>
    /// FontAwesomeWindow.xaml 的交互逻辑
    /// </summary>
    public partial class FontAwesomeWindow : Window {
        public FontAwesomeVM VM { get; set; }
        public FontAwesomeWindow() {
            InitializeComponent();
            // 实体
            IEnumerable<FontAwesome> fontAwesomeList = GetFontAwesomeFieldValue<FontAwesome6>();
            // 品牌
            IEnumerable<FontAwesome> fontAwesomeBrandsList = GetFontAwesomeFieldValue<FontAwesomeBrands>();
            // 常用
            IEnumerable<FontAwesome> fontAwesomeRegularList = GetFontAwesomeFieldValue<FontAwesomeRegular>();
            // V4
            IEnumerable<FontAwesome> fontAwesome4List = GetFontAwesomeFieldValue<FontAwesome4>();
            VM = new FontAwesomeVM {
                CustomFontAwesomes = GetCustomFontAwesome(),
                SolidFontAwesomes = fontAwesomeList,
                RegularFontAwesomes = fontAwesomeRegularList,
                BrandsFontAwesomes = fontAwesomeBrandsList,
                FontAwesomes4 = fontAwesome4List,
                QueryFontAwesomes = new ObservableCollection<FontAwesome>()
            };
            Loaded += WindowLoaded;
        }

        private void WindowLoaded(object sender, RoutedEventArgs e) {
            DataContext = VM;
        }

        private void SelectIconColor(object sender, RoutedEventArgs e) {
            ColorDialog colorDialog = new ColorDialog();
            if (System.Windows.Forms.DialogResult.OK == colorDialog.ShowDialog()) {
                VM.SelectedIconColor = System.Drawing.ColorTranslator.ToHtml(colorDialog.Color);
            }
        }
        private void SelectedFontAwesome(object sender, RoutedEventArgs e) {
            TextBlock text = sender as TextBlock;
            VM.SelectedFf = text.FontFamily.ToString();
            VM.SelectedFa = text.Text;
        }
        private void ConfirmSelectFontAwesome(object sender, RoutedEventArgs e) {
            if (string.IsNullOrEmpty(VM.SelectedFa)) {
                System.Windows.MessageBox.Show("未选择图标", "错误");
                return;
            }
            DialogResult = true;
后面还有 109 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。