private void Button_Copy(object sender, RoutedEventArgs e) { VisualHost host = Host; Canvas canvas = MainCanvas; host.CopyImage(canvas); }
/// <summary> /// Initialize drawing instances that we will use to append to the canvas /// </summary> public void Init() { this.shirtDrawing = new DrawingVisual(); this.visualHost = new VisualHost { visual = this.shirtDrawing }; }
internal void Refresh() { _canvas.Children.Clear(); foreach (Geometry figure in _figures) { var lines = _camera.GeometryToRasterSpace(figure); VisualHost vH = new VisualHost(new Pen(Brushes.Beige, 1)); vH.AddLines(lines); _canvas.Children.Add(vH); } }
/// <summary> /// Executes when ready to go /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Event</param> private void WindowLoaded(object sender, RoutedEventArgs e) { this.BeginSpeechRecognition(); // set up shir manager and load first shirt onto skeleton this.shirtManager = new ShirtManager(ChosenShirt, PreviousShirt, NextShirt, this.Dispatcher); this.shirt = this.shirtManager.NextShirt(); // for drawing skeleton bones and joints onto body this.drawingVisual = new DrawingVisual(); this.visualHost = new VisualHost { visual = this.drawingVisual }; // Select Sensor to be used foreach (KinectSensor potentialSensor in KinectSensor.KinectSensors) { if (potentialSensor.Status == KinectStatus.Connected) { // found a potential sensor that's connected, so now we use it this.sensor = potentialSensor; break; } } // execute only if we successfully acquired a sensor if (this.sensor == null) { return; } // enable the necessary streams this.sensor.ColorStream.Enable(); this.sensor.SkeletonStream.Enable(); this.sensor.DepthStream.Enable(); // add event handlers for the frames this.sensor.AllFramesReady += this.SensorOnAllFramesReady; try { this.sensor.Start(); } catch (IOException) { this.sensor = null; } }
private VisualHost GetVisualHost(MarkerColor color, bool isQueen) { VisualHost visualHost = null; if (color != MarkerColor.Undefined) { string path = GameManager.GetMarkerPath(color, isQueen); DrawingVisual drawingVisual = new DrawingVisual(); DrawingContext drawingContext = drawingVisual.RenderOpen(); BitmapImage img = new BitmapImage(new Uri(path)); drawingContext.DrawImage(img, new Rect(4, 4, img.PixelWidth / 6, img.PixelHeight / 6)); drawingContext.Close(); visualHost = new VisualHost { Visual = drawingVisual, IsHitTestVisible = false }; } return(visualHost); }
private void InitializeCellEditControl() { _cellEditControl = new TextBox { AcceptsTab = true, BorderThickness = new Thickness(0), AcceptsReturn = true, Name = "_cellEditControl", TabIndex = 0, Text = "" }; _cellEditControl.PreviewKeyDown += (s, e) => { var ee = new HandledEventArgs(false); CellEdit_PreviewKeyPressed?.Invoke(GuiHelper.ToAltaxo(e.Key), ee); e.Handled = ee.Handled; }; _cellEditControl.TextChanged += (s, e) => CellEdit_TextChanged?.Invoke(); _cellEditControl.LostKeyboardFocus += (s, e) => CellEdit_LostFocus?.Invoke(); _cellEditControl.Visibility = Visibility.Hidden; _visualHost = new VisualHost(EhView_TableAreaPaint); LowerCanvas.Children.Add(_visualHost); Canvas.Children.Add(_cellEditControl); }
/// <summary> /// Inicializa una nueva instancia de la clase /// <see cref="TestViewModel"/>. /// </summary> public TestViewModel() { _pgnum = ++_count; SumCommand = new SimpleCommand(OnSum); BusyOpCommand = BuildBusyCommand(OnBusyOp); SaluteCommand = new SimpleCommand(OnSalute); SpawnSiblingCommand = new SimpleCommand(OnSpawnSibling); InputNameCommand = new SimpleCommand(OnInputName); OkTkxByeCommand = new SimpleCommand(() => (UiServices ?? throw Errors.UiHostAccess).VisualHost.Close()); TestMessagesCommand = new SimpleCommand(OnTestMessages); }