using NEIntelligentControl2.Models.Windturbine;
using NEIntelligentControl2.Service.Station;
using NEIntelligentControl2.Service.Windturbine;
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 NEIntelligentControl2.Windows
{
    /// <summary>
    /// 风机详情页
    /// </summary>
    public partial class WindturbineInfoWindow : Window
    {
        public WindturbineInfo WindturbineInfo { get; set; }

        private StationManager _StationManager;
        public WindturbineInfoWindow(StationManager sm)
        {
            InitializeComponent();
            _StationManager = sm;
        }


        private void Button_Click(object sender, RoutedEventArgs e)
        {
            switch (((Control)sender).Tag)
            {
                case "close":
                    this.Close();
                    break;
                default: return;
            }
        }

        public static void ShowWindow(WindturbineInfo info)
        {
            WindturbineInfoWindow wiw = App.ServiceProvider.GetService(typeof(WindturbineInfoWindow)) as WindturbineInfoWindow;
            wiw.Owner = Application.Current.MainWindow;
            wiw.WindturbineInfo = info;
            wiw.ShowDialog();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Init();
        }

        private void Init()
        {
            string title = $"{_StationManager.GetStatonInfo(WindturbineInfo.StationId)?.Name} {WindturbineInfo.WindturbineId}    风机型号：{WindturbineInfo.ModelId}";
            _TBTitle.Text = title;
            _WDMain.WindturbineInfo = WindturbineInfo;
            _PDMain.WindturbineInfo = WindturbineInfo;
            //_WAR.WindturbineInfo = WindturbineInfo;
            //_WAH.WindturbineInfo = WindturbineInfo;
            _WAC.WindturbineInfo = WindturbineInfo;
            //_SC.WindturbineInfo = WindturbineInfo;
            _WAC.IsCustom = true;
        }
    }
}
