Beispiel #1
0
        private void Open_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();

            open.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            open.Filter           = "Path files (*.path)|*.path";
            bool success = open.ShowDialog() ?? false;

            if (success)
            {
                List <Path> paths = PathFileOperations.Read(open.FileName);
                //clear out everything we have. move the robot origin. Use Paths_ItemAdded
                DeleteAt(0);
                if (paths.Count() >= 1)
                {
                    originX.Value = paths[0].StartX;
                    originY.Value = paths[0].StartY;
                    foreach (Path p in paths)
                    {
                        Paths.Items.Add(p);
                        Paths_ItemAdded(p);
                    }
                }
            }
        }
Beispiel #2
0
        private void GranularityPopup_Closed(object sender, EventArgs e)
        {
            ChildWindow        popup  = sender as ChildWindow;
            DoubleUpDown       result = (DoubleUpDown)popup.Resources["value"];
            string             file   = (string)popup.Resources["file"];
            IEnumerable <Path> paths  = (IEnumerable <Path>)popup.Resources["paths"];
            bool success = (bool)(popup.Resources["success"] ?? false);

            if (success)
            {
                PathFileOperations.Export(file, paths, result.Value ?? 0);
                ShowMessageBox("Exported motion profile at " + file, "Success!", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Beispiel #3
0
 private void Save_Click(object sender, RoutedEventArgs e)
 {
     if (Paths.Items.Count > 0)
     {
         SaveFileDialog save = new SaveFileDialog();
         save.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
         save.Filter           = "Path files (*.path)|*.path";
         bool success = save.ShowDialog() ?? false;
         if (success)
         {
             PathFileOperations.Write(save.FileName, Paths.Items.Cast <Path>());
             ShowMessageBox("Saved path file at " + save.FileName, "Success!", MessageBoxButton.OK, MessageBoxImage.Information);
         }
     }
     else
     {
         ShowMessageBox("You don't have anything to save!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }