public MainWindow() { InitializeComponent(); _grView = new graph_view(canvas, true); _grViewCS = new graph_viewCS(canvasCS, false); PanelsHidden(); }
public edge_view(graph_view _graph, node_view from_node, node_view to_node, string weight) { this._graph = _graph; if (from_node != to_node) { Line = new Line(); Line.MouseEnter += new MouseEventHandler(Line_MouseEnter); Line.MouseLeave += new MouseEventHandler(Line_MouseLeave); Line.MouseLeftButtonDown += new MouseButtonEventHandler(Line_MouseLeftButtonDown); Line.Stroke = Brushes.Black; Line.StrokeThickness = 1; ((Line)Line).X1 = 0; ((Line)Line).Y1 = 0; LeftLine = new Line(); RightLine = new Line(); RightLine.Stroke = LeftLine.Stroke = Brushes.Black; RightLine.StrokeThickness = LeftLine.StrokeThickness = 6; _graph.GRCanvas.Children.Add(LeftLine); _graph.GRCanvas.Children.Add(RightLine); if (Lines == null) { Lines = new List <Shape>(); Lines.Add(Line); Lines.Add(LeftLine); Lines.Add(RightLine); } textBox1 = new TextBox(); textBox1.Width = 50; br = new SolidColorBrush(Colors.Transparent); textBox1.BorderBrush = br; textBox1.VerticalContentAlignment = VerticalAlignment.Center; textBox1.HorizontalContentAlignment = HorizontalAlignment.Center; textBox1.FontSize = 14; TxtBox1_TextChanged(null, null); textBox1.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(TxtBox1_PreviewMouseLeftButtonDown); textBox1.TextChanged += new TextChangedEventHandler(TxtBox1_TextChanged); textBox1.Text = weight; edge_weight = int.Parse(textBox1.Text); opaqueBrush = new SolidColorBrush(Colors.Black); opaqueBrush.Opacity = 0; textBox1.Background = opaqueBrush; _graph.GRCanvas.Children.Add(textBox1); _graph.GRCanvas.Children.Add(Line); Canvas.SetZIndex(Line, 0); Canvas.SetZIndex(textBox1, 2); this.from_node = from_node; this.to_node = to_node; to_node.pointPositionChange += new graph_view.PointPositionChanged(OnPointPositionChanged); from_node.pointPositionChange += new graph_view.PointPositionChanged(OnPointPositionChanged); OnPointPositionChanged(to_node); OnPointPositionChanged(from_node); } else { MessageBox.Show("Граф задачі має бути ациклічним!"); } }
public DestinationAlgorithms(Canvas canvas, graph_view _graph_view, graph_viewCS _graph_viewCS) { this.canvas = canvas; this._graph_view = _graph_view; this._graph_viewCS = _graph_viewCS; countCS = _graph_viewCS.TopList.Count; matrixCS = new int[countCS, countCS]; stopWatch.Start(); }
public edge_view(graph_view _graph, node_view from_node, node_view to_node, string weight) { this._graph = _graph; if (from_node != to_node) { Line = new Line(); Line.MouseEnter += new MouseEventHandler(Line_MouseEnter); Line.MouseLeave += new MouseEventHandler(Line_MouseLeave); Line.MouseLeftButtonDown += new MouseButtonEventHandler(Line_MouseLeftButtonDown); Line.Stroke = Brushes.Black; Line.StrokeThickness = 1; ((Line)Line).X1 = 0; ((Line)Line).Y1 = 0; LeftLine = new Line(); RightLine = new Line(); RightLine.Stroke = LeftLine.Stroke = Brushes.Black; RightLine.StrokeThickness = LeftLine.StrokeThickness = 6; _graph.GRCanvas.Children.Add(LeftLine); _graph.GRCanvas.Children.Add(RightLine); if (Lines == null) { Lines = new List<Shape>(); Lines.Add(Line); Lines.Add(LeftLine); Lines.Add(RightLine); } textBox1 = new TextBox(); textBox1.Width = 50; br = new SolidColorBrush(Colors.Transparent); textBox1.BorderBrush = br; textBox1.VerticalContentAlignment = VerticalAlignment.Center; textBox1.HorizontalContentAlignment = HorizontalAlignment.Center; textBox1.FontSize = 14; TxtBox1_TextChanged(null, null); textBox1.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(TxtBox1_PreviewMouseLeftButtonDown); textBox1.TextChanged += new TextChangedEventHandler(TxtBox1_TextChanged); textBox1.Text = weight; edge_weight = int.Parse(textBox1.Text); opaqueBrush = new SolidColorBrush(Colors.Black); opaqueBrush.Opacity = 0; textBox1.Background = opaqueBrush; _graph.GRCanvas.Children.Add(textBox1); _graph.GRCanvas.Children.Add(Line); Canvas.SetZIndex(Line, 0); Canvas.SetZIndex(textBox1, 2); this.from_node = from_node; this.to_node = to_node; to_node.pointPositionChange += new graph_view.PointPositionChanged(OnPointPositionChanged); from_node.pointPositionChange += new graph_view.PointPositionChanged(OnPointPositionChanged); OnPointPositionChanged(to_node); OnPointPositionChanged(from_node); } else MessageBox.Show("Граф задачі має бути ациклічним!"); }
public MainWindow() { InitializeComponent(); _grView = new graph_view(canvas, true); _grViewCS = new graph_viewCS(canvasCS, false); // _grView.LoadGraph(_grView.OpenGraphFrom("C:\\Users\\Annet\\Documents\\Visual Studio 2012\\Projects\\labs\\labs\\bin\\Debug\\Граф задачі\\GraphTask0.txt")); // _grViewCS.LoadGraph(_grViewCS.OpenGraphFrom("C:\\Users\\Annet\\Documents\\Visual Studio 2012\\Projects\\labs\\labs\\bin\\Debug\\Граф КС\\GraphCSKP.txt")); PanelsHidden(); }
public Window1(graph_view _grView, graph_viewCS _grViewCS, DestinationAlgorithms _destin_alg, double propuskChannels, double proizvodProcessors, bool isDuplex, int countLinks, Canvas canvas) { InitializeComponent(); this.proizvodProcessors = proizvodProcessors; this.propuskChannels = propuskChannels; this.isDuplex = isDuplex; this.countLinks = countLinks; this.canvas = canvas; this._grView = _grView; this._grViewCS = _grViewCS; this._destin_alg = _destin_alg; }
public node_view(graph_view _graph_view) { this._graph_view = _graph_view; _graph_view.TopList.Add(this); _grNode = new graphNode(this); _grNode.txtWeight_node.Text = "5"; _grNode.lblId_node.Content = _grNode.txtId_node.Text = (_graph_view.maxTopID() + 1).ToString(); id = int.Parse(_grNode.txtId_node.Text); weight = int.Parse(_grNode.txtWeight_node.Text); _graph_view.GRCanvas.Children.Add(_grNode); pointPositionChange += _graph_view.OnPointPositionChanged; IsValid = false; }
public DestinationAlgorithms(Canvas canvas, graph_view _graph_view, graph_viewCS _graph_viewCS, double propuskChannels, double proizvodProcessors, bool isDuplex, int countLinks) { this.canvas = canvas; this._graph_view = _graph_view; this._graph_viewCS = _graph_viewCS; this.propuskChannels = propuskChannels; this.proizvodProcessors = proizvodProcessors; this.isDuplex = isDuplex; this.countLinks = countLinks; countCS = _graph_viewCS.TopList.Count; matrixCS = new int[countCS, countCS]; stopWatch.Start(); }