예제 #1
0
        /// <summary>
        /// Imports the current contents of the Windows clipboard to
        /// <c><see cref="_copyr"/></c> and enables
        /// <c><see cref="it_PasteRange"/></c> and
        /// <c><see cref="it_ClipExport"/></c>.
        /// </summary>
        /// <param name="sender"><c><see cref="it_ClipImport"/></c></param>
        /// <param name="e"></param>
        void clipclick_ImportCopy(object sender, EventArgs e)
        {
            _copyr.Clear();

            string clip = ClipboardService.GetText();

            if (clip.Length != 0)
            {
                string[] lines = clip.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
                string   line;

                for (int i = 0; i != lines.Length; ++i)
                {
                    if ((line = lines[i].Trim()).Length != 0)
                    {
                        string[] fields = YataGrid.ParseTableRow(line);
                        _copyr.Add(fields);
                    }
                }

                if (_fclip != null)
                {
                    _fclip.SetRowsBufferText();
                }

                it_PasteRange.Enabled = Table != null && !Table.Readonly;
                it_ClipExport.Enabled = true;
            }
        }