public interface IWindowService
{
public void ShowWindow<T>(object dataContext) where T : Window, new();
}
public class WindowService : IWindowService
{
public void ShowWindow<T>(object dataContext) where T : Window, new()
{
var window = new T
{
DataContext = dataContext
};
window.Show();
}
}
// PS. ws = WindowService
public void ExecuteShowGraph(object parameter)
{
ws.ShowWindow<GraphWindow>(new GraphViewModel(Коллекция точек для графика));
}
public static Brush HatchBrush
{
get
{
var canvas = new Canvas();
canvas.Children.Add(new Path
{
Stroke = Brushes.Black,
StrokeThickness = 1,
Data = new LineGeometry(new Point(0, 0), new Point(40, 40))
});
var myHathBrush = new VisualBrush
{
TileMode = TileMode.Tile,
Viewport = new Rect(0, 0, 10, 10),
ViewportUnits = BrushMappingMode.Absolute,
Visual = canvas
};
return myHathBrush;
}
}