using DamnOverSharp.WPF.UiLibrary;
using Example.Connectors;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Threading;

namespace Example
{
    /// <summary>
    /// Interaction logic for IngameControl.xaml
    /// </summary>
    public partial class IngameControl : VirtualControlBase
    {

        DispatcherTimer timer = MainWindow.timer;
        public IngameControl()
        {
            InitializeComponent();
            timer.Tick += (sender, e) => UpdatePagesInformation(sender, e);
        }

        private void mouseCapture_VirtualMouseDrag(object sender, System.Windows.Point e)
        {
            if (ShopMouseCapture.VirtualMouseDown)
            {
                //Debug.Write($" -- XPOS: {e.X} || YPOS: {e.Y}  -- ");
                this.Margin = new Thickness(e.X-this.Width/2, e.Y, 0,0);
                Debug.Write($" (( YPOS: {this.Margin.Top} -- XPOS: {this.Margin.Left}  -- RightPOS: {this.Margin.Right} -- BottomPOS: {this.Margin.Bottom} )) ||\n");
                UpdateVisual();
            }
        }

        private async void UpdatePagesInformation(object sender, EventArgs e)
        {
            Killstext.Text = GetPlayerInfo.PlayerDetails.totalKills.ToString();
            Deathstext.Text = GetPlayerInfo.PlayerDetails.totalDeaths.ToString();
            Advancetext.Text = GetPlayerInfo.PlayerminigameStats.lockpickAdvancedSuccess.ToString();
            Mediumtext.Text = GetPlayerInfo.PlayerminigameStats.lockpickMediumSuccess.ToString();
            Easytext.Text = GetPlayerInfo.PlayerminigameStats.lockpickBasicSuccess.ToString();
            Dialtext.Text = GetPlayerInfo.PlayerminigameStats.dialSuccess.ToString();
            Defusetext.Text = GetPlayerInfo.PlayerminigameStats.defusalSuccess.ToString();
        }

        private void Close_Clicked(object sender, EventArgs e)
        {
            this.Visibility = Visibility.Collapsed;
        }
    }
}
