private void MyCanvas_MouseUp(object sender, MouseButtonEventArgs e) { if (ClikOnCanvas) { ToolsBar.ToolNow.MouseUp(e.GetPosition(MyCanvas)); if (ToolsBar.ToolNow != ToolsBar.Transform["Allotment"] & ToolsBar.ToolNow != ToolsBar.Transform["ZoomRect"] & ToolsBar.ToolNow != ToolsBar.Transform["Hand"]) { ToolsBar.AddCondition(); gotoPastCondition.IsEnabled = true; gotoSecondCondition.IsEnabled = false; } if (ToolsBar.ToolNow == ToolsBar.Transform["ZoomRect"]) { MyCanvas.LayoutTransform = new ScaleTransform(ToolsBar.ScaleRateX, ToolsBar.ScaleRateY); ScrollViewerCanvas.ScrollToVerticalOffset(ToolsBar.DistanceToPointY * ToolsBar.ScaleRateY); ScrollViewerCanvas.ScrollToHorizontalOffset(ToolsBar.DistanceToPointX * ToolsBar.ScaleRateX); } if (ToolsBar.ToolNow == ToolsBar.HandTool) { ToolsBar.ToolNow = ToolsBar.Transform["Allotment"]; } ClikOnCanvas = false; Invalidate(); } }
public MainWindow() { InitializeComponent(); Instance = this; MyCanvas.Children.Add(ToolsBar.FigureHost); ButtonGeneration.Generation(); ToolsBar.AddCondition(); }
public void AnimateToolbar(bool showToolbar) { var hidePosition = new Thickness(0, -50, 0, 0); var visiblePosition = new Thickness(); var thickness = showToolbar ? visiblePosition : hidePosition; var pointAnimation = new ThicknessAnimation(thickness, TimeSpan.FromMilliseconds(300)); ToolsBar.BeginAnimation(Grid.MarginProperty, pointAnimation); }
private void gotoSecondCondition_Click(object sender, RoutedEventArgs e) { ToolsBar.gotoSecondCondition(); if (ToolsBar.ConditionNumber == ToolsBar.ConditionsCanvas.Count) { gotoSecondCondition.IsEnabled = false; } gotoPastCondition.IsEnabled = true; Invalidate(); }
public void CleanMyCanvas(object sender, RoutedEventArgs e) { ToolsBar.FigureHost.Children.Clear(); ToolsBar.Figures.Clear(); ToolsBar.ConditionNumber = 0; ToolsBar.ConditionsCanvas.Clear(); ToolsBar.AddCondition(); gotoPastCondition.IsEnabled = false; gotoSecondCondition.IsEnabled = false; }
/// <summary> /// Draws the build button to the window. /// </summary> private void DrawToolsBar() { if (_toolsBar == null) { _toolsBar = new ToolsBar(); _toolsBar.AppendButton(new BuildButton()); _toolsBar.AppendButton(new SettingsButton()); _toolsBar.AppendButton(new MLButton()); } _toolsBar.Draw(); }
public void ChangeDash(object sender, RoutedEventArgs e) { foreach (Figure figure in ToolsBar.Figures) { if (figure.Select == true) { figure.ChangePen(ToolsBar.TransformDashProp[(sender as Button).Content.ToString()], (sender as Button).Content.ToString()); } } ToolsBar.AddCondition(); gotoPastCondition.IsEnabled = true; gotoSecondCondition.IsEnabled = false; Invalidate(); }
public void ClearSelectedFigure(object sender, RoutedEventArgs e) { foreach (Figure figure in ToolsBar.Figures.ToArray()) { if (figure.Select == true) { ToolsBar.Figures.Remove(figure); } } PropToolBarPanel.Children.Clear(); ToolsBar.AddCondition(); gotoPastCondition.IsEnabled = true; gotoSecondCondition.IsEnabled = false; Invalidate(); }
private void LoadButton_Click(object sender, RoutedEventArgs e) { ToolsBar.Figures.Clear(); OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "Files(*.bin)|*.bin"; ofd.Title = "Открыть"; ofd.ShowDialog(); if (ofd.FileName != "") { Stream file = (FileStream)ofd.OpenFile(); BinaryFormatter deserializer = new BinaryFormatter(); ToolsBar.Figures = (List <Figure>)deserializer.Deserialize(file); file.Close(); Invalidate(); } ToolsBar.ConditionsCanvas.Clear(); ToolsBar.ConditionNumber = 0; ToolsBar.AddCondition(); gotoPastCondition.IsEnabled = false; gotoSecondCondition.IsEnabled = false; }
public void SldMouseUp(object sender, MouseButtonEventArgs e) { ToolsBar.AddCondition(); gotoPastCondition.IsEnabled = true; gotoSecondCondition.IsEnabled = false; }