using System.Text;
using System.Windows.Controls;
using Aitex.Core.UI.View.Common;

namespace MECF.Framework.UI.Client.CenterViews.Alarms.Alarm
{
    /// <summary>
    /// AlarmView.xaml 的交互逻辑
    /// </summary>
    public partial class AlarmView : UserControl
    {
        public AlarmView()
        {
            InitializeComponent();
        }

        private void listView1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count == 1 && e.AddedItems[0] is AlarmItem item)
            {
                var sb = new StringBuilder();

                sb.Append("Event Type：");
                sb.Append(item.LevelString);
                sb.AppendLine();
                sb.AppendLine();

                sb.Append("Event Source：");
                sb.Append(item.Source);
                sb.AppendLine();
                sb.AppendLine();

                sb.Append("Event Name：");
                sb.Append(item.EventEnum);
                sb.AppendLine();
                sb.AppendLine();

                sb.Append("Time：");
                sb.Append(item.OccuringTime);
                sb.AppendLine();
                sb.AppendLine();

                sb.Append("Description：");
                sb.Append(item.Description);
                sb.AppendLine();
                sb.AppendLine();

                sb.Append("Possible Solution：");
                sb.Append(item.Solution);
                sb.AppendLine();
                sb.AppendLine();

                //sb.Append("Acknowledged：");
                //sb.Append(item.IsAcknowledged ? "Yes" : "No");
                //sb.AppendLine();
                //sb.AppendLine();

                //sb.Append("Acknowledged Time：");
                //sb.Append(item.AcknowledgeTime.ToString("yyyy/MM/dd HH:mm:ss"));
                //sb.AppendLine();
                //sb.AppendLine();


                AnalysisText.Text = sb.ToString();
            }
            else
            {
                AnalysisText.Text = string.Empty;
            }
        }
    }
}
