namespace FSI.BT.Tools.ClipboardMgt
{
    using System;
    using FSI.BT.Tools.Global.Utilities;
    using FSI.BT.Tools.RadialMenu.Business;
    using Microsoft.Win32;
    using WK.Libraries.SharpClipboardNS;

    /// <summary>
    /// App contains the notifyicon, the taskbarform and the menus.
    /// </summary>
    internal class App : IDisposable
    {
        SharpClipboard _clipBoard;
        public App()
        {

            AppRestart.BeforeRestarting += Dispose;
            SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged;


            _clipBoard = new SharpClipboard();
            _clipBoard.ObservableFormats.Texts = true;
            _clipBoard.ClipboardChanged += Clipboard_ClipboardChanged;
        }

        private void Clipboard_ClipboardChanged(object sender, SharpClipboard.ClipboardChangedEventArgs e)
        {
            var test = e.Content.ToString();
            if (e.Content.ToString().StartsWith("\"") && e.Content.ToString().EndsWith("\""))
                System.Windows.Forms.Clipboard.SetDataObject(e.Content.ToString().Substring(1, e.Content.ToString().Length - 2));
        }

        public void Dispose()
        {
          
        }

        private void SystemEvents_DisplaySettingsChanged(object sender, EventArgs e)
        {
          
        }        
    }
}