Пример #1
0
        private void ClbTaskList_DragDrop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent(DataFormats.Text))
            {
                e.Effect      = DragDropEffects.Copy;
                nmTaskId.Text = string.Empty;
                var a = e.Data.GetData(DataFormats.Text).ToString();
                tbSourceUrl.Text = a;
                Uri    uriA         = new Uri(a);
                string formattedUrl = URLParser.Tokenize(uriA);
                tbUrlFormat.Text         = formattedUrl;
                uriA                     = new Uri(formattedUrl);
                tbDestinationFormat.Text = uriA.Segments.LastOrDefault();
                MessageBox.Show($"Drag and drop of {a}");

                var htmlFragment = e.Data.GetData(DataFormats.Html).ToString().Split(stringSeparators, StringSplitOptions.RemoveEmptyEntries);
                var source       = htmlFragment[8];
                RetrieveBrowserData(source);
                //var testing = TestOfDragDropFormats(e);
            }
            else
            {
                e.Effect = DragDropEffects.None;
                MessageBox.Show("Invalid type for drag and drop.");
            }
        }
Пример #2
0
        private void Tokenize(MyDownloadTask d)
        {
            var destinationFormat = URLParser.Tokenize(d.SourceUrl);
            Uri destFormat        = new Uri(destinationFormat);
            var f          = destFormat.Segments;
            var fileFormat = HttpUtility.UrlDecode(f[f.Length - 1]);

            tbDestinationFormat.Text = fileFormat;
        }