private void ApplyColor(object obj) { ColorsWindow colorsWindow = (ColorsWindow)obj; colorsWindow.DialogResult = true; colorsWindow.Close(); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.ColorsWindowName = ((WPF_Ellipse.ColorsWindow)(target)); return; } this._contentLoaded = true; }
private void DrawClick(object obj) { if (MousePosition != default(Point)) { return; } Point mousePoint = Mouse.GetPosition((IInputElement)obj); Point prev = PrevPoint; PrevPoint = mousePoint; ++CountEdges; if (CountEdges == 2) { ColorsWindow colorWin = new ColorsWindow(this); double width = Math.Abs(prev.X - PrevPoint.X); double height = Math.Abs(prev.Y - PrevPoint.Y); double left = Math.Min(prev.X, PrevPoint.X); double top = Math.Min(prev.Y, PrevPoint.Y); CurrentEllipse.Width = width; CurrentEllipse.Height = height; CurrentEllipse.Stroke = new SolidColorBrush(Colors.Black); CurrentEllipse.Margin = new Thickness(left, top, 0, 0); if (colorWin.ShowDialog() == true) { CurrentEllipse.Fill = new SolidColorBrush(CurrentColor); } CurrentEllipse.Name = String.Format("Ellipse_{0}", Ellipses.Count + 1); Ellipses.Add(CurrentEllipse); CurrentEllipse = new Ellipse(); OnPropertyChanged("Ellipses"); CountEdges = 0; } }