Esempio n. 1
0
        private async void NewPCBProject_Click(object sender, RoutedEventArgs e)
        {
            var pcbWindow = new PCBProject();
            var vm        = new PCBProjectViewModel(new EaglePCB.Models.PCBProject());
            await vm.LoadDefaultSettings();

            pcbWindow.DataContext           = vm;
            pcbWindow.IsNew                 = true;
            pcbWindow.Owner                 = this;
            pcbWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            pcbWindow.ShowDialog();
            if (pcbWindow.DialogResult.HasValue && pcbWindow.DialogResult.Value)
            {
                ViewModel.Project = vm.Project;
                ViewModel.AddProjectFileMRU(pcbWindow.PCBFilepath);
                if (!String.IsNullOrEmpty(vm.Project.EagleBRDFilePath))
                {
                    await ViewModel.Machine.PCBManager.OpenFileAsync(vm.Project.EagleBRDFilePath);
                }
                ViewModel.Machine.PCBManager.Project = vm.Project;
            }
        }
Esempio n. 2
0
        private void EditPCBProject_Click(object sender, RoutedEventArgs e)
        {
            if (ViewModel.Project == null)
            {
                MessageBox.Show("Please Open or Create a Project First.");
                return;
            }
            var clonedProject = ViewModel.Project.Clone();
            var vm            = new PCBProjectViewModel(clonedProject);

            var pcbWindow = new PCBProject();

            pcbWindow.DataContext           = vm;
            pcbWindow.IsNew                 = false;
            pcbWindow.Owner                 = this;
            pcbWindow.PCBFilepath           = ViewModel.Machine.PCBManager.ProjectFilePath;
            pcbWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            pcbWindow.ShowDialog();
            if (pcbWindow.DialogResult.HasValue && pcbWindow.DialogResult.Value)
            {
                ViewModel.Project = vm.Project;
            }
        }