using CollaborativePlatformMain.DFEntity.MessageSubUtil;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace CollaborativePlatformMain.Form.MessageSubPage
{
    /// <summary>
    /// SeconToolLibraryPage.xaml 的交互逻辑
    /// </summary>
    public partial class SeconToolLibraryPage : Page
    {
        /// <summary>
        /// 块子功能
        /// </summary>
        public List<ToolFunctionEntity> BlockDatas = new List<ToolFunctionEntity>();

        /// <summary>
        /// 对比子功能
        /// </summary>
        public List<ToolFunctionEntity> ContrastDatas = new List<ToolFunctionEntity>();

        /// <summary>
        /// 二维子功能
        /// </summary>
        public List<ToolFunctionEntity> TwoDimDatas = new List<ToolFunctionEntity>();

        /// <summary>
        /// 文字子功能
        /// </summary>
        public List<ToolFunctionEntity> TextDatas = new List<ToolFunctionEntity>();


        public SeconToolLibraryPage()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 窗体初始化
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ToolFunctionEntity toolFunctionEntity1 = new ToolFunctionEntity("快速建块", @"/Image/folderImage.png", false);
            ToolFunctionEntity toolFunctionEntity2 = new ToolFunctionEntity("块分解", @"/Image/folderImage.png", false);
            ToolFunctionEntity toolFunctionEntity3 = new ToolFunctionEntity("块基点更改", @"/Image/folderImage.png", false);
            ToolFunctionEntity toolFunctionEntity4 = new ToolFunctionEntity("修改块颜色", @"/Image/folderImage.png", false);
            BlockDatas = new List<ToolFunctionEntity>() { toolFunctionEntity1, toolFunctionEntity2, toolFunctionEntity3, toolFunctionEntity4 };

            ToolFunctionEntity toolFunctionEntity5 = new ToolFunctionEntity("图纸对比", @"/Image/folderImage.png", false);
            ContrastDatas = new List<ToolFunctionEntity>() { toolFunctionEntity5 };

            ToolFunctionEntity toolFunctionEntity6 = new ToolFunctionEntity("二维审查", @"/Image/folderImage.png", false);
            TwoDimDatas = new List<ToolFunctionEntity>() { toolFunctionEntity6 };


            ToolFunctionEntity toolFunctionEntity7 = new ToolFunctionEntity("文字替换", @"/Image/folderImage.png", false);
            ToolFunctionEntity toolFunctionEntity8 = new ToolFunctionEntity("文字搜索", @"/Image/folderImage.png", false);
            ToolFunctionEntity toolFunctionEntity9 = new ToolFunctionEntity("文字合并", @"/Image/folderImage.png", false);
            ToolFunctionEntity toolFunctionEntity10 = new ToolFunctionEntity("文字样式补充", @"/Image/folderImage.png", false);
            TextDatas = new List<ToolFunctionEntity>() { toolFunctionEntity7, toolFunctionEntity8, toolFunctionEntity9, toolFunctionEntity10 };
        }

        /// <summary>
        /// 块处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bt_bock_Click(object sender, RoutedEventArgs e)
        {
            sv_legend.ItemsSource = null;
            sv_legend.ItemsSource = BlockDatas;
        }

        /// <summary>
        /// 图纸对比
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bt_Comparison_Click(object sender, RoutedEventArgs e)
        {
            sv_legend.ItemsSource = null;
            sv_legend.ItemsSource = ContrastDatas;
        }

        /// <summary>
        /// 二维审查
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bt_twoReview_Click(object sender, RoutedEventArgs e)
        {
            sv_legend.ItemsSource = null;
            sv_legend.ItemsSource = TwoDimDatas;
        }

        /// <summary>
        /// 文字处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bt_text_Click(object sender, RoutedEventArgs e)
        {
            sv_legend.ItemsSource = null;
            sv_legend.ItemsSource = TextDatas;
        }


        public SuspensionForm BaseForm = null;

        /// <summary>
        /// 添加漂浮工具
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void bt_addTools(object sender, RoutedEventArgs e)
        {
            List<ToolFunctionEntity> allToolEntitys = new List<ToolFunctionEntity>();
            allToolEntitys.AddRange(BlockDatas.Where(x => x.IsCheck));
            allToolEntitys.AddRange(ContrastDatas.Where(x => x.IsCheck));
            allToolEntitys.AddRange(TwoDimDatas.Where(x => x.IsCheck));
            allToolEntitys.AddRange(TextDatas.Where(x => x.IsCheck));


            if (BaseForm != null)
            {
                BaseForm.SetToolEntity(allToolEntitys);
            }
            else
            {
                BaseForm = new SuspensionForm(this, allToolEntitys);
                BaseForm.Show();
            }
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {

        }

        private void CheckBox_Click(object sender, RoutedEventArgs e)
        {

        }

        private void StackPanel_MouseDown(object sender, MouseButtonEventArgs e)
        {

        }
    }
}
