using CollaborativePlatformMain.CADStartUtil;
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>
    /// FullProfessionPage.xaml 的交互逻辑
    /// </summary>
    public partial class FullProfessionPage : Page
    {
        /// <summary>
        /// 父级窗体
        /// </summary>
        public HomepageForm HomepageForm;

        public FullProfessionPage(HomepageForm homepageForm)
        {
            InitializeComponent();
            HomepageForm = homepageForm;
        }

        private void tr_threemodel_PreviewMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            int a = 1;
        }

        /// <summary>
        /// 建筑-鼠标点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tb_arch_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            // 创建新的列定义
            ColumnDefinition colDef1 = new ColumnDefinition();
            colDef1.Width = new GridLength(3, GridUnitType.Star);
            ColumnDefinition colDef2 = new ColumnDefinition();
            colDef2.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinition colDef3 = new ColumnDefinition();
            colDef3.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinition colDef4 = new ColumnDefinition();
            colDef4.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinition colDef5 = new ColumnDefinition();
            colDef5.Width = new GridLength(1, GridUnitType.Star);

            // 清除旧的列定义
            gridName.ColumnDefinitions.Clear();
            // 添加到Grid中
            gridName.ColumnDefinitions.Add(colDef1);
            gridName.ColumnDefinitions.Add(colDef2);
            gridName.ColumnDefinitions.Add(colDef3);
            gridName.ColumnDefinitions.Add(colDef4);
            gridName.ColumnDefinitions.Add(colDef5);
        }

        /// <summary>
        /// 结构-鼠标点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tb_stru_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            // 创建新的列定义
            ColumnDefinition colDef1 = new ColumnDefinition();
            colDef1.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinition colDef2 = new ColumnDefinition();
            colDef2.Width = new GridLength(3, GridUnitType.Star);
            ColumnDefinition colDef3 = new ColumnDefinition();
            colDef3.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinition colDef4 = new ColumnDefinition();
            colDef4.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinition colDef5 = new ColumnDefinition();
            colDef5.Width = new GridLength(1, GridUnitType.Star);

            // 清除旧的列定义
            gridName.ColumnDefinitions.Clear();
            // 添加到Grid中
            gridName.ColumnDefinitions.Add(colDef1);
            gridName.ColumnDefinitions.Add(colDef2);
            gridName.ColumnDefinitions.Add(colDef3);
            gridName.ColumnDefinitions.Add(colDef4);
            gridName.ColumnDefinitions.Add(colDef5);
        }

        /// <summary>
        /// 给排水-鼠标点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tb_water_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            // 创建新的列定义
            ColumnDefinition colDef1 = new ColumnDefinition();
            colDef1.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinition colDef2 = new ColumnDefinition();
            colDef2.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinition colDef3 = new ColumnDefinition();
            colDef3.Width = new GridLength(3, GridUnitType.Star);
            ColumnDefinition colDef4 = new ColumnDefinition();
            colDef4.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinition colDef5 = new ColumnDefinition();
            colDef5.Width = new GridLength(1, GridUnitType.Star);

            // 清除旧的列定义
            gridName.ColumnDefinitions.Clear();
            // 添加到Grid中
            gridName.ColumnDefinitions.Add(colDef1);
            gridName.ColumnDefinitions.Add(colDef2);
            gridName.ColumnDefinitions.Add(colDef3);
            gridName.ColumnDefinitions.Add(colDef4);
            gridName.ColumnDefinitions.Add(colDef5);
        }

        /// <summary>
        /// 暖通-鼠标点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tb_warm_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            // 创建新的列定义
            ColumnDefinition colDef1 = new ColumnDefinition();
            colDef1.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinition colDef2 = new ColumnDefinition();
            colDef2.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinition colDef3 = new ColumnDefinition();
            colDef3.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinition colDef4 = new ColumnDefinition();
            colDef4.Width = new GridLength(3, GridUnitType.Star);
            ColumnDefinition colDef5 = new ColumnDefinition();
            colDef5.Width = new GridLength(1, GridUnitType.Star);

            // 清除旧的列定义
            gridName.ColumnDefinitions.Clear();
            // 添加到Grid中
            gridName.ColumnDefinitions.Add(colDef1);
            gridName.ColumnDefinitions.Add(colDef2);
            gridName.ColumnDefinitions.Add(colDef3);
            gridName.ColumnDefinitions.Add(colDef4);
            gridName.ColumnDefinitions.Add(colDef5);
        }

        /// <summary>
        /// 电气-鼠标点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tb_ele_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            // 创建新的列定义
            ColumnDefinition colDef1 = new ColumnDefinition();
            colDef1.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinition colDef2 = new ColumnDefinition();
            colDef2.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinition colDef3 = new ColumnDefinition();
            colDef3.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinition colDef4 = new ColumnDefinition();
            colDef4.Width = new GridLength(1, GridUnitType.Star);
            ColumnDefinition colDef5 = new ColumnDefinition();
            colDef5.Width = new GridLength(3, GridUnitType.Star);

            // 清除旧的列定义
            gridName.ColumnDefinitions.Clear();
            // 添加到Grid中
            gridName.ColumnDefinitions.Add(colDef1);
            gridName.ColumnDefinitions.Add(colDef2);
            gridName.ColumnDefinitions.Add(colDef3);
            gridName.ColumnDefinitions.Add(colDef4);
            gridName.ColumnDefinitions.Add(colDef5);
        }

        /// <summary>
        /// 点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cb_Check_Checked(object sender, RoutedEventArgs e)
        {
        }

        /// <summary>
        /// 鼠标点击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Label_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Label label = sender as Label;
            if (label == null) return;
            OperatEntity operatEntity = label.DataContext as OperatEntity;
            if (operatEntity == null) return;
            if (operatEntity.DrawPath != null && operatEntity.DrawPath != "")
            {
                OpenDrawPathData openDrawPathData = new OpenDrawPathData(true, operatEntity.DrawPath);

                StartCADUtil.StartCADMath(false, openDrawPathData);
            }
        }
    }
}
