Example #1
0
        private async void PasteFromClipboard(TextItem textItem)
        {
            try
            {
                if (textItem == null)
                {
                    return;
                }

                _window.HideWithPrevStatePreserved();

                await System.Threading.Tasks.Task.Run(() => System.Threading.Thread.Sleep(200));

                IntPtr targetWindow = await Win32Wrapper.PasteText(textItem.Text, KeepOnClipboardAfterInsert);

                _window.ShowWithPreservedState();

                Win32Wrapper.SetForegroundWindow(targetWindow);
            }
            catch (Exception ex)
            {
                string error = Localization.TranslationManager.Instance.TranslateString("ErrorMessagePasterFromClipboard");
                LogHelper.LogException(ex, error);
                _confirmer.ConfirmStop(error);
            }
        }