public void Drop(object sender, SurfaceDragDropEventArgs e) { var border = sender as Border; if (border == null) return; border.Background = Brushes.Red; if (!visitedBorders.Contains(border)) visitedBorders.Add(border); taskDragItem = e.Cursor.Data as TaskDragItem; if (taskDragItem == null || taskDragItem.Service == null || taskDragItem.Task == null) return; activeTask = taskDragItem.Task; Lead = Followers = string.Empty; if (visitedBorders.Count > 0) { Lead = (string) visitedBorders[0].DataContext; if (visitedBorders.Count > 1) { var sb = new StringBuilder(); for (var i = 1; i < visitedBorders.Count; i++) { var visitedBorder = visitedBorders[i]; sb.Append((string) visitedBorder.DataContext); sb.Append(", "); } Followers = sb.ToString().TrimEnd(new[] {',', ' '}); } else Followers = "-"; } activeTask.Labels[RecipientsKey] = visitedBorders.Count <= 1 ? Lead : string.Format("{0}, {1}", Lead, Followers); ShowConfirmation = true; RemoveFloatingElement(); e.Handled = true; }
private void PinnedItems_Drop(object sender, SurfaceDragDropEventArgs e) { DragableImageItem image = e.Cursor.Data as DragableImageItem; SurfaceListBoxItem s = (SurfaceListBoxItem)sender; BluetoothHandler.SendBluetooth((s.Content as PhoneThumbVisualization).BTEndpoint, image.Image); }
/// <summary> /// Called when something is tropped on this, manage the drop action /// </summary> public void OnDrop(Object sender, SurfaceDragDropEventArgs arg) { ProviderTemplate droppedCard = arg.Cursor.Data as ProviderTemplate; TrashBin sourceBar = arg.Cursor.DragSource as TrashBin; // Not handled if (droppedCard == null) { return; } droppedCard.setState(ProviderItemState.overview); if (sourceBar != null && sender != sourceBar) { /*if (sourceBar.containsCard(droppedCard) == null) { sourceBar.Items.Add((ProviderTemplate)droppedCard); } */ } /* // Remove duplicated card Card alreadyInsideCard = this.containsCard(droppedCard); if (alreadyInsideCard != null) { this.Items.Remove(alreadyInsideCard); } */ }
/* * Function called when an element is dropped inside the container. */ private void OnCursorDrop(object sender, SurfaceDragDropEventArgs args) { SurfaceDragCursor droppingCursor = args.Cursor; // check if item is not already in the container if (!Items.Contains(droppingCursor.Data)) { Point center = droppingCursor.GetPosition(this); center.X = ((center.X - 45) / this.ActualWidth) * 100; center.Y = ((center.Y - 65) / this.ActualHeight) * 100; ((SimpleCard)droppingCursor.Data).center = center; // Add item in the container ((ObservableCollection <SimpleCard>)ItemsSource).Add((SimpleCard)droppingCursor.Data); // set the properties of the item just dropped var svi = ItemContainerGenerator.ContainerFromItem(droppingCursor.Data) as ScatterViewItem; if (svi != null) { svi.Center = droppingCursor.GetPosition(this); svi.Orientation = droppingCursor.GetOrientation(this); svi.Height = droppingCursor.Visual.ActualHeight; svi.Width = droppingCursor.Visual.ActualWidth; svi.SetRelativeZIndex(RelativeScatterViewZIndex.Topmost); svi.Orientation = 0; svi.CanRotate = false; svi.CanScale = false; } } }
private void OnCursorDrop(object sender, SurfaceDragDropEventArgs args) { SurfaceDragCursor droppingCursor = args.Cursor; // Add dropping Item that was from another drag source. if (droppingCursor.CurrentTarget == this && droppingCursor.DragSource != this) { if (!Items.Contains(droppingCursor.Data)) { Items.Add(droppingCursor.Data); var svi = ItemContainerGenerator.ContainerFromItem(droppingCursor.Data) as ScatterViewItem; if (svi != null) { svi.Style = (Style)Resources["LibraryContainerInScatterViewItemStyle"]; svi.Center = droppingCursor.GetPosition(this); svi.Orientation = droppingCursor.GetOrientation(this); svi.Height = 300; //((UserControl)droppingCursor.Data).Height; svi.Width = 300;// ((UserControl)droppingCursor.Data).Width; svi.MinHeight = 300; svi.MinWidth = 300; svi.MaxHeight = 1000; svi.MaxWidth = 1000; svi.SetRelativeZIndex(RelativeScatterViewZIndex.Topmost); } } } }
private void Drop_Event(object sender, SurfaceDragDropEventArgs e) { // if an onject of type ContentItem is dropped on a device it is set as enabled in the LibraryContent if (e.Cursor.Data is ContentItem && e.Cursor.CurrentTarget is StackPanel) { LibraryCont.SetIsItemDataEnabled(e.Cursor.Data as ContentItem); } }
//will restore the scatterviewitem to visible when the user drops the item where it is not able //to be dropped private void Scatter_DragCanceled(object sender, SurfaceDragDropEventArgs e) { PhotoData data = e.Cursor.Data as PhotoData; ScatterViewItem svi = scatter.ItemContainerGenerator.ContainerFromItem(data) as ScatterViewItem; if (svi != null) { svi.Visibility = Visibility.Visible; } }
//When the user enters a drop target with a dragged image, the image is dropped in the appropriate location private void OnDropTargetDragEnter(object sender, SurfaceDragDropEventArgs e) { PhotoData data = e.Cursor.Data as PhotoData; if (!data.CanDrop) { e.Effects = DragDropEffects.Move; } }
private void OnCursorDrop(object sender, SurfaceDragDropEventArgs args) { SurfaceDragCursor droppingCursor = args.Cursor; if (!HandListBox.Items.Contains(droppingCursor.Data)) { ((ObservableCollection <SimpleCard>)HandListBox.ItemsSource).Add((SimpleCard)droppingCursor.Data); } }
private void PhoneImageDropHandler(object sender, SurfaceDragDropEventArgs e) { Console.WriteLine(e.Cursor.Data as string); var imageInfo = e.Cursor.Data as ImageInfo; var split = imageInfo.FilePath.Split(new[] { "\\images\\" + imageInfo.OriginId + "\\" }, StringSplitOptions.RemoveEmptyEntries); var url = "/images/" + imageInfo.OriginId + "/" + split[split.Length - 1]; SignalR.GetInstance().RequestImageDownloadToPhone(DeviceId, url, split[split.Length - 1]); }
private void StackPanel_Drop(object sender, SurfaceDragDropEventArgs e) { DragableImageItem item = e.Cursor.Data as DragableImageItem; if (BTEndpoint != null) { BluetoothHandler.SendBluetooth(BTEndpoint, item.Image); } }
private void drop2_Drop(object sender, SurfaceDragDropEventArgs e) { drop2.Items.Clear(); drop2.Items.Add(e.Cursor.Data); drop2Height = e.Cursor.Visual.Height; fixRowHeight(); listDisplay2.Items.Clear(); listDisplay2.Items.Add(e.Cursor.Data); }
private void OnDeckButtonCursorDrop(object sender, SurfaceDragDropEventArgs args) { SurfaceDragCursor droppingCursor = args.Cursor; if (!((VMGame)DataContext).Deck.Contains((SimpleCard)droppingCursor.Data)) { ((VMGame)DataContext).Deck.Insert(0, (SimpleCard)droppingCursor.Data); ((VMGame)DataContext).DeckCount = "Deck " + ((VMGame)DataContext).Deck.Count; } }
private void OnExileButtonCursorDrop(object sender, SurfaceDragDropEventArgs args) { SurfaceDragCursor droppingCursor = args.Cursor; if (!((VMGame)DataContext).Exile.Contains((SimpleCard)droppingCursor.Data)) { ((VMGame)DataContext).Exile.Insert(0, (SimpleCard)droppingCursor.Data); ExileButton.Background = new ImageBrush { ImageSource = ((SimpleCard)droppingCursor.Data).Bitmap }; } }
private void OnDeckButtonCursorDrop(object sender, SurfaceDragDropEventArgs args) { SurfaceDragCursor droppingCursor = args.Cursor; if (!((VMGame)DataContext).Deck.Contains((SimpleCard)droppingCursor.Data)) { ((VMGame)DataContext).Deck.Insert(0,(SimpleCard)droppingCursor.Data); ((VMGame)DataContext).DeckCount = "Deck " + ((VMGame)DataContext).Deck.Count; } }
private void ImgScatterView_DragCanceled(object sender, SurfaceDragDropEventArgs e) { DragableImageItem data = e.Cursor.Data as DragableImageItem; ScatterViewItem item = data.DraggedElement as ScatterViewItem; if (item != null) { item.Visibility = Visibility.Visible; item.Orientation = e.Cursor.GetOrientation(this); item.Center = e.Cursor.GetPosition(this); } }
//Code for Title private void OnDropTargetDropTitle(object sender, SurfaceDragDropEventArgs e) { try { ImageBrush myBrushCaption = new ImageBrush(); BitmapImage bitmapImageCaption = new BitmapImage(); myBrushCaption.ImageSource = new BitmapImage(new Uri(@"C:\Users\balichmac1\Desktop\WEBSEMBLY_FINAL\Resources\Icons\title.jpg", UriKind.Relative)); } catch (Exception error) { Console.Out.Write(error); } }
public void DragEnter(object sender, SurfaceDragDropEventArgs e) { var border = sender as Border; if (border == null) return; if (visitedBorders.Contains(border)) { visitedBorders.Remove(border); border.Background = Brushes.Yellow; } else { visitedBorders.Insert(0, border); border.Background = Brushes.Red; } }
//Code for display the content after you "drop" it into its place - Row 1, Right Element private void OnDropTargetDrop3(object sender, SurfaceDragDropEventArgs e) { try { ImageBrush myBrush = new ImageBrush(); BitmapImage bitmapImage = new BitmapImage(); myBrush.ImageSource = new BitmapImage(new Uri(@"C:\Users\balichmac1\Desktop\WEBSEMBLY_FINAL\Resources\Images\wellesley_sci.jpg", UriKind.Relative)); P_R1R_Label.Background = myBrush; String change = "<img src='images/wellesley_sci' alt='Science Center'></p>"; generatedCode.Content = getHTML("Row 1, Right Element", change); } catch (Exception error) { Console.Out.Write(error); } }
//Code for display the content after you "drop" it into its place - Row 2, Right Element private void OnDropTargetDrop6(object sender, SurfaceDragDropEventArgs e) { try { ImageBrush myBrush = new ImageBrush(); BitmapImage bitmapImage = new BitmapImage(); myBrush.ImageSource = new BitmapImage(new Uri(@"C:\Users\balichmac1\Desktop\WEBSEMBLY_FINAL\Resources\Videos\video3.jpg", UriKind.Relative)); P_R2R_Label.Background = myBrush; String change = "<vid src='videos/waban.wmv' alt='Waban Video'></p>"; generatedCode.Content = getHTML("Row 2, Right Element", change); } catch (Exception error) { Console.Out.Write(error); } }
private void OnCursorDrop(object sender, SurfaceDragDropEventArgs args) { SurfaceDragCursor droppingCursor = args.Cursor; // Add dropping Item that was from another drag source. if (droppingCursor.CurrentTarget == this && droppingCursor.DragSource != this) { if (!Items.Contains(droppingCursor.Data)) { Items.Add(droppingCursor.Data); var svi = ItemContainerGenerator.ContainerFromItem(droppingCursor.Data) as ScatterViewItem; if (svi != null) { svi.Center = droppingCursor.GetPosition(this); svi.Orientation = droppingCursor.GetOrientation(this); svi.Height = droppingCursor.Visual.ActualHeight; svi.Width = droppingCursor.Visual.ActualWidth; svi.SetRelativeZIndex(RelativeScatterViewZIndex.Topmost); } } } }
private void Push_Image_container_Drop(object sender, SurfaceDragDropEventArgs e) { e.Effects = DragDropEffects.Move; object neededdata = e.Cursor.Data; Content test = e.Cursor.Data as Content; FrameworkElement findSource = e.OriginalSource as FrameworkElement; SurfaceDragCursor droppingCursor = e.Cursor; if (Names == null) { Names.Add(test.p.ToString()); } if (!Names.Contains(test.p.ToString())) { Names.Add(test.p.ToString()); } Images_drop_window.DataContext = this; Images_drop_window.Items.Add(test.p.ToString()); //Images_drop_window.ItemsSource = names; e.Handled = true; }
///Allows you to drag items from the LibraryContainer to the ScatterView and drop them private void Scatter_Drop(object sender, SurfaceDragDropEventArgs e) { PhotoData e1 = (PhotoData)e.Cursor.Data; //if it isn't already on the Scatterview, add it to the source collection if (!ScatterItems.Contains(e.Cursor.Data)) { e1 = (PhotoData)e.Cursor.Data; ScatterItems.Add(e1); } //get the ScatterViewItem that Scatter automatically generated. ScatterViewItem svi = scatter.ItemContainerGenerator.ContainerFromItem(e.Cursor.Data) as ScatterViewItem; svi.Visibility = System.Windows.Visibility.Visible; svi.Width = e.Cursor.Visual.ActualWidth; svi.Height = e.Cursor.Visual.ActualHeight; svi.Center = e.Cursor.GetPosition(scatter); svi.Orientation = e.Cursor.GetOrientation(scatter); svi.Background = Brushes.Transparent; //setting e.handled to true ensures that default behavior is not performed e.Handled = true; }
private void DropTargetDragLeave(object sender, SurfaceDragDropEventArgs e) { log.Debug("DropTargetDragLeave(object " + sender.ToString() + " SurfaceDragDropEventArgs " + e.ToString() + ") - Begin"); e.Cursor.Visual.Tag = null; SurfaceDragDrop.CancelDragDrop(e.Cursor); log.Debug("DropTargetDragLeave() - End"); e.Handled = true; }
private void PublicationsArticle_DragCanceled(object sender, SurfaceDragDropEventArgs e) { ((ExtendedDesktopViewModel)this.DataContext).Routed_PublicationsArticle_DragCanceled(sender, e); }
/// <summary> /// If Drag get canceld and draged object is a card set card to origin position /// get help at msdn: Dragging and Dropping Items from ScatterView Controls to SurfaceListBox Controls /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DragCanceled(object sender, SurfaceDragDropEventArgs e) { log.Debug("DragCanceled(object " + sender.ToString() + " SurfaceDragDropEventArgs " + e.ToString() + ") - Begin"); Image data = e.Cursor.Data as Image; //Console.WriteLine(data.Name); if (data.Name.Contains("card")) { BitmapImage bimage = new BitmapImage(new Uri("pack://siteoforigin:,,,/Res/Kartenrueckseite/kartenruecken_1.jpg")); Image image = this.FindName(data.Name) as Image; ScatterViewItem svi = this.FindName(data.Name.Substring(0, (data.Name.Length - 5))) as ScatterViewItem; svi.Content = null; svi.Content = image; image.Visibility = Visibility.Visible; } log.Debug("DragCanceled() - End"); e.Handled = true; }
/// <summary> /// collectes chip value in TargetArea /// get help at msdn: Dragging and Dropping Items from ScatterView Controls to SurfaceListBox Controls /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DropTargetDragEnter(object sender, SurfaceDragDropEventArgs e) { log.Debug("DropTargetDragEnter(object " + sender.ToString() + " SurfaceDragDropEventArgs " + e.ToString() + ") - Begin"); e.Cursor.Visual.Tag = "DragEnter"; Image img = e.Cursor.Data as Image; //Get Chip Value string text = img.Source.ToString(); if (text.Contains("chip")) { char[] delimiterChars = { '_', '.' }; string[] words = text.Split(delimiterChars); //Update the personal stack personalStack += (Int32)Convert.ToInt32(words[2]); personalStackField_h.Text = personalStack.ToString(); personalStackField_v.Text = personalStack.ToString(); checkCash(kvp.Key.position); setActionButtonText(); } log.Debug("DropTargetDragEnter() - End"); e.Handled = true; }
private void PinnedItems_DragLeave(object sender, SurfaceDragDropEventArgs e) { e.Cursor.Visual.Tag = null; }
private void LibraryStack_DragLeave(object sender, SurfaceDragDropEventArgs e) { Movie data = e.Cursor.Data as Movie; if (libraryItems.Contains(data)) { libraryItems.Remove(data); if (libraryItems.Count == 0) { price = 0; totalPriceLabel.Content = "$0.00"; } else { price -= data.Price; totalPriceLabel.Content = Price; } } }
private void PublicationsSurfaceListBox_Drop(object sender, SurfaceDragDropEventArgs e) { Console.WriteLine("PublicationsSurfaceListBox_Drop"); //((PublicationsViewModel)this.DataContext).Routed_PublicationsSurfaceListBox_Drop(sender, e); }
private void PinnedItems_DragEnter(object sender, SurfaceDragDropEventArgs e) { e.Cursor.Visual.Tag = "DragEnter"; }
private void scatterView1_Drop(object sender, SurfaceDragDropEventArgs e) { if ((e.Cursor.Data.GetType() == typeof( Patient))) { ScatterViewItem svi = new ScatterViewItem(); PatientInformation pInfo = new PatientInformation(); svi.Style = Resources["ControlInScatterViewItemContentStyle"] as Style; svi.Orientation = e.Cursor.GetOrientation(scatterView1); svi.CanScale = false; svi.Content = pInfo; svi.Center = e.Cursor.GetPosition(scatterView1); scatterView1.Items.Add(svi); } else if ((e.Cursor.Data.GetType() == typeof(DicomContainer))) { ScatterViewItem svi = new ScatterViewItem(); DICOMViewer pInfo = new DICOMViewer(this.intAirAct); svi.Style = Resources["ControlInScatterViewItemContentStyle"] as Style; svi.Content = pInfo; svi.Orientation = e.Cursor.GetOrientation(scatterView1); svi.MinWidth = 400; svi.MinHeight = 400; svi.CanScale = true; svi.Center = e.Cursor.GetPosition(scatterView1); scatterView1.Items.Add(svi); } }
private void DoLeave(object sender, SurfaceDragDropEventArgs e) { _svi.Opacity = 1; }
private void DoEnter(object sender, SurfaceDragDropEventArgs e) { _svi.Opacity = 0.5; }
private void DoDrop(object sender, SurfaceDragDropEventArgs e) { _svi.Opacity = 1; if (e.Cursor.Data is Document) { var d = (Document) e.Cursor.Data; AppState.SendDocument(Client, d); } }
/* * Function called when an element is dropped inside the container. */ private void OnCursorDrop(object sender, SurfaceDragDropEventArgs args) { SurfaceDragCursor droppingCursor = args.Cursor; // check if item is not already in the container if (!Items.Contains(droppingCursor.Data)) { Point center = droppingCursor.GetPosition(this); center.X = ((center.X - 45) / this.ActualWidth) * 100; center.Y = ((center.Y - 65) / this.ActualHeight) * 100; ((SimpleCard)droppingCursor.Data).center = center; // Add item in the container ((ObservableCollection<SimpleCard>)ItemsSource).Add((SimpleCard)droppingCursor.Data); // set the properties of the item just dropped var svi = ItemContainerGenerator.ContainerFromItem(droppingCursor.Data) as ScatterViewItem; if (svi != null) { svi.Center = droppingCursor.GetPosition(this); svi.Orientation = droppingCursor.GetOrientation(this); svi.Height = droppingCursor.Visual.ActualHeight; svi.Width = droppingCursor.Visual.ActualWidth; svi.SetRelativeZIndex(RelativeScatterViewZIndex.Topmost); svi.Orientation = 0; svi.CanRotate = false; svi.CanScale = false; } } }
public void Drop(object sender, SurfaceDragDropEventArgs e) { if (e.Cursor.Data is DataSet) { DataSet ds = (DataSet)e.Cursor.Data; if(DataSets.Any(k => k.Sensor.Id == ds.Sensor.Id)) { SelectedDataSet = DataSets.First(k => k.Sensor.Id == ds.Sensor.Id); } else { var types = DataSets.Select(k => k.Unit).Distinct(); //TODO: Only two different data types can be added to a graph. If user adds third datatype, then alert him. if (types.Count() == 2 && !types.Contains(ds.Unit)) { MessageBox.Show("Units mismatch. Cannot add this datatype to this plot."); return; } else { if (!types.Contains(ds.Unit)) ds.RightAxis = true; DataSets.Add(ds); } } } }
private void ScatterViewDrop(object sender, SurfaceDragDropEventArgs e) { ImageSource i = new BitmapImage(new Uri(e.Cursor.Data as String)); fleche.Source = i; }
private void LibraryStack_DragEnter(object sender, SurfaceDragDropEventArgs e) { Movie data = e.Cursor.Data as Movie; if (!libraryItems.Contains(data)) { libraryItems.Add(data); price += data.Price; totalPriceLabel.Content = Price; } }
private void PublicationsArticle_DragCanceled(object sender, SurfaceDragDropEventArgs e) { _myViewModel.Routed_PublicationsArticle_DragCanceled(sender, e); }
private void scatter_DragCanceled(object sender, SurfaceDragDropEventArgs e) { Movie data = e.Cursor.Data as Movie; ScatterViewItem svi = scatter.ItemContainerGenerator.ContainerFromItem(data) as ScatterViewItem; if (svi != null) { svi.Visibility = Visibility.Visible; } }
private void MainLibraryStack_DragOver(object sender, SurfaceDragDropEventArgs e) { e.Effects = DragDropEffects.None; e.Handled = true; }