示例#1
0
        protected override void WndProc(ref Message m)
        {
            base.WndProc(ref m);

            if (m.Msg == WM_DRAWCLIPBOARD)
            {
                var iData = Clipboard.GetDataObject();

                if (iData.GetDataPresent(DataFormats.Text))
                {
                    var data = (string) iData.GetData(DataFormats.Text);
                    if (data == lastData)
                        return;

                    lastData = data;
                    logTextBox.Text = data;
                    var text = itemParser.Parse(data);
                    outputTextBox.Text = text;

                    if (alert != null)
                    {
                        alert.Close();
                    }

                    alert = new AlertForm();
                    alert.Closed += (sender, args) => lastData = null;
                    alert.ShowMessage(text);
                }
            }
        }