ScatterViewItem findViewItemWithPointerID(int pointerID) { ScatterViewItem matchedItem = null; foreach (ScatterViewItem item in sv_RemotePointerCanvas.Items) { RemotePointerUI remotePointer = (RemotePointerUI)(item.Content); if (remotePointer.PointerID == pointerID) { matchedItem = item; break; } } return(matchedItem); }
public void NewPointerAddedEvent(RemotePointer addedPointer, string assignedColorCode) { this.Dispatcher.Invoke(new Action(() => { try { ScatterViewItem pointerContainer = new ScatterViewItem(); pointerContainer.ApplyTemplate(); RemotePointerUI pointerUI = new RemotePointerUI(); pointerUI.PointerID = addedPointer.Id; pointerUI.setPointerColor(assignedColorCode); pointerUI.Width = pointerUI.Height = 50; pointerContainer.Width = pointerUI.Width; pointerContainer.Height = pointerUI.Height; //disable surrounding shadow pointerContainer.Background = null; pointerContainer.BorderThickness = new Thickness(0); pointerContainer.ShowsActivationEffects = false; //SurfaceShadowChrome ssc = pointerContainer.Template.FindName("shadow", pointerContainer) as SurfaceShadowChrome; //ssc.Visibility = Visibility.Collapsed; //add to the canvas and adjust location pointerContainer.Content = pointerUI; pointerContainer.Tag = addedPointer; sv_RemotePointerCanvas.Items.Add(pointerContainer); int X = (int)(addedPointer.X * canvasesContainer.Width); int Y = (int)(addedPointer.Y * canvasesContainer.Height); pointerContainer.Center = new System.Windows.Point(X, Y); sv_RemotePointerCanvas.UpdateLayout(); Utilities.BrainstormingEventLogger.GetInstance(dropboxGeneralNoteDownloader.Storage).UploadLogString(Utilities.BrainstormingEventLogger.getLogStr_RemotePointerAdded(addedPointer)); } catch (Exception ex) { Utilities.UtilitiesLib.LogError(ex); } })); }