LunarMind/ImageItem.cs

(开头部分) 5KB

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows.Media;
using System.IO;
using System.Windows.Media.Imaging;
using System.Windows;
using System.Xml;
using System.Windows.Input;

namespace SHomeWorkshop.LunarMind
{

    public class ImageItem : System.Windows.Controls.TreeViewItem
    {
        public ImageItem(string imageDirectoryFullPath)
        {
            if (Directory.Exists(imageDirectoryFullPath) == false) return;

            string[] imgFileFullPaths = System.IO.Directory.GetFiles(imageDirectoryFullPath);

            #region 树型框项目的头部。
            int index = imageDirectoryFullPath.LastIndexOf('\\');
            string shortname = null;
            if (index >= 0)
            {
                shortname = imageDirectoryFullPath.Substring(index + 1);
            }
            else
            {
                shortname = imageDirectoryFullPath;
            }

            this.Header = shortname;

            //this.Foreground = Brushes.White;
            //this.Background = Brushes.Transparent;

            #endregion

            if (imgFileFullPaths.Length <= 0)
            {
                this.AddChild(new TreeViewItem().Header = "此类别无图像...");
            }
            else
            {
                //将所有项目都添加到树型框的内部。
                WrapPanel wpanel = new WrapPanel();
                wpanel.Width = 240;

                foreach (string filepath in imgFileFullPaths)
                {
                    BitmapImage bitmapImage = new BitmapImage();
                    bitmapImage.BeginInit();
                    bitmapImage.UriSource = new Uri(filepath, UriKind.Absolute);
                    bitmapImage.EndInit();

                    CImgButton imgButton = new CImgButton(filepath);
后面还有 94 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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