private void InternalRenderComplete(object sender, EventArgs e) { this.DynamicRendererThreadManager.MainMediaContextRenderComplete -= this._mainRenderComplete; List <DryingDrawingVisual> dryingDrawingVisualList = this._dryingDrawingVisualList; bool flag = false; List <DryingDrawingVisual> source; try { Monitor.Enter(dryingDrawingVisualList, ref flag); source = this._dryingDrawingVisualList.ToList <DryingDrawingVisual>(); this._dryingDrawingVisualList.Clear(); } finally { Monitor.Exit(dryingDrawingVisualList); } var group = (from temp in source group temp by temp.ContainerVisual); foreach (var dryingDrawingVisual in group) { ContainerVisual containerVisual = dryingDrawingVisual.Key; if (!containerVisual.CheckAccess()) { containerVisual.Dispatcher.InvokeAsync(delegate() { TestLable.RemoveDrawingVisual(dryingDrawingVisual, containerVisual); }, DispatcherPriority.Background); continue; } TestLable.RemoveDrawingVisual(dryingDrawingVisual, containerVisual); } }
public MouseRender(TestLable inkCanvas) { AllowsMouseInput = true; this._fillSolidColorBrush = MouseRender.DefaultFillSolidColorBrush; this._strokeInfoList = new Dictionary <int, MouseRender.StrokeInfo>(50); this.InkCanvas = inkCanvas; this._drawingAttributes = new DrawingAttributes { FitToCurve = false, IgnorePressure = false, StylusTip = StylusTip.Ellipse, Color = Colors.Blue, Width = 3, Height = 3 }; this._fillSolidColorBrush = Brushes.Red; //if (this._inkBoardSettings == null) //{ // InkBoardSettings inkBoardSettings = new InkBoardSettings // { // InkColor = MouseRender.DefaultFillSolidColorBrush.Color, // InkThickness = 3.0 // }; // this.UpdateInkBoardSettingsInternal(inkBoardSettings); //} }
public InkCanvasThreadManager(TestLable inkCanvas, DynamicRendererThreadManager dynamicRendererThreadManager) { if (inkCanvas == null) { throw new ArgumentNullException("inkCanvas"); } if (dynamicRendererThreadManager == null) { throw new ArgumentNullException("dynamicRendererThreadManager"); } InkCanvas = inkCanvas; DynamicRendererThreadManager = dynamicRendererThreadManager; }