Beispiel #1
0
        public MainWindow(bool hasStartupArgs = false, string[] startupArgs = null)
        {
            _isInitializing              = true;
            _hasStartupArgs              = hasStartupArgs;
            _startupArgs                 = startupArgs;
            _pipeServer                  = new AsyncPipeServer();
            _pipeServer.MessageRecieved += new ServerMessage(MessageRecievedHandler);
            InitializeComponent();
            ClippySettings.Instance.InitializeSettings();
            ClipDataManager.Instance.ItemsChanged += ItemsChangedHandler;

            SetupWindow();
            Action hotkeyPressed = GlobalHotkeyPressed;
            var    interopHelper = new WindowInteropHelper(this);

            interopHelper.EnsureHandle();
            HotKeyHelper.Instance.Initialize(interopHelper.Handle, hotkeyPressed);

            LoadItemsList();
            ApplySettings();
            string pipeName = StaticHelper.GetPipeName();

            _pipeServer.Listen(pipeName);
            _isInitializing = false;
        }
Beispiel #2
0
        private void Window_Closing(object sender, EventArgs e)
        {
            if (ClippySettings.Instance.SaveWindowLayoutState == true)
            {
                ClippySettings.Instance.SaveWindowLayout(this);
            }

            _pipeServer.MessageRecieved -= new ServerMessage(MessageRecievedHandler);
            _pipeServer.Shutdown();
            _pipeServer = null;
        }