Exemplo n.º 1
0
 protected void DestPageList_OnDrop(object sender, System.Windows.DragEventArgs e)
 {
     if (e.Data != null && e.Data.GetDataPresent(typeof(List <PageItem>)))
     {
         List <PageItem> items = (List <PageItem>)e.Data.GetData(typeof(List <PageItem>));
         if (items.Count > 0)
         {
             int selectedDoc = dest.SelectedIndex;
             if (selectedDoc == -1)
             {
                 selectedDoc = _documentRollUp.AddDocument();
                 DocumentItem docItem = new DocumentItem(items[0].FixedPage);
                 dest.Items.Add(docItem);
                 dest.SelectedItem = docItem;
             }
             foreach (PageItem item in items)
             {
                 destPage.Items.Add(new PageItem(item));
                 _documentRollUp.AddPage(selectedDoc, item.PageContent.Source, (item.PageContent as IUriContext).BaseUri);
             }
         }
     }
     e.Handled = true;
 }
Exemplo n.º 2
0
 protected void DestDocList_OnDrop(object sender, System.Windows.DragEventArgs e)
 {
     if (e.Data != null && e.Data.GetDataPresent(typeof(List <DocumentItem>)))
     {
         List <DocumentItem> items = (List <DocumentItem>)e.Data.GetData(typeof(List <DocumentItem>));
         dest.BeginInit();
         dest.SelectedItems.Clear();
         DocumentItem firstItem = null;
         foreach (DocumentItem item in items)
         {
             DocumentItem newItem = new DocumentItem(item);
             dest.Items.Add(newItem);
             // only select fist item
             if (firstItem == null)
             {
                 firstItem = newItem;
             }
             _documentRollUp.AddDocument(item.DocumentReference.Source, (item.DocumentReference as IUriContext).BaseUri);
         }
         dest.SelectedItem = firstItem;
         dest.EndInit();
     }
     e.Handled = true;
 }