예제 #1
0
        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();
            }
        }
예제 #2
0
 public MainWindow()
 {
     InitializeComponent();
     Instance = this;
     MyCanvas.Children.Add(ToolsBar.FigureHost);
     ButtonGeneration.Generation();
     ToolsBar.AddCondition();
 }
예제 #3
0
        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);
        }
예제 #4
0
 private void gotoSecondCondition_Click(object sender, RoutedEventArgs e)
 {
     ToolsBar.gotoSecondCondition();
     if (ToolsBar.ConditionNumber == ToolsBar.ConditionsCanvas.Count)
     {
         gotoSecondCondition.IsEnabled = false;
     }
     gotoPastCondition.IsEnabled = true;
     Invalidate();
 }
예제 #5
0
 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;
 }
예제 #6
0
 /// <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();
 }
예제 #7
0
 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();
 }
예제 #8
0
 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();
 }
예제 #9
0
        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;
        }
예제 #10
0
 public void SldMouseUp(object sender, MouseButtonEventArgs e)
 {
     ToolsBar.AddCondition();
     gotoPastCondition.IsEnabled   = true;
     gotoSecondCondition.IsEnabled = false;
 }