public ChooseSolvespace(Object ob, Object od, Object oc, Object num, Object tiku) { sp = (Solvespace)ob; ss = (ObservableCollection <Solvespace>)od; problems = (List <Problem>)oc; currentproblem = (int)num; currenttiku = (string)tiku; InitializeComponent(); if (sp == null) { rc.Content = "当前未选定工作空间"; rc.IsEnabled = false; } else { rc.Content = sp.Name; } cb.ItemsSource = ss; cb.IsEnabled = false; }
private void Click_ok(object sender, RoutedEventArgs e) { if (rc.IsChecked == true) { string proname = problems[currentproblem].Title; Chachong cc = new Chachong(); if (cc.Chazhao(proname, sp.Solvedproblem)) { MessageBox.Show("此题已在解决空间中创立"); return; } Solvedproblem spro = new Solvedproblem(); spro.Name = proname; string name = spro.Name.Replace(" ", "_"); spro.Parent = sp; spro.Tiku = currenttiku; spro.Path = sp.Path + "\\" + name + "_" + spro.Tiku; System.IO.Directory.CreateDirectory(spro.Path); sp.Solvedproblem.Add(spro); string text = "第1个解决方案"; CreateNewSolution cns = new CreateNewSolution(spro, text); cns.ShowDialog(); Classfile cf = new Classfile(); cf.Name = "Main.cs"; cf.Parent = spro.Solution[0]; cf.Path = spro.Solution[0].Path + "\\" + cf.Name; File.Create(cf.Path); spro.Solution[0].Classfile.Add(cf); Reference rf = new Reference(); rf.Name = "引用"; rf.Parent = cf; cf.Reference.Add(rf); cff = cf; this.Close(); } else if (rcc.IsChecked == true) { Solvespace spp = (Solvespace)cb.SelectedItem; string proname = problems[currentproblem].Title; Chachong cc = new Chachong(); if (cc.Chazhao(proname, spp.Solvedproblem)) { MessageBox.Show("此题已在解决空间中创立"); return; } Solvedproblem spro = new Solvedproblem(); spro.Name = proname; string name = spro.Name.Replace(" ", "_"); spro.Parent = spp; spro.Tiku = currenttiku; spro.Path = spp.Path + "\\" + name + "_" + spro.Tiku; System.IO.Directory.CreateDirectory(spro.Path); spp.Solvedproblem.Add(spro); string text = "第1个解决方案"; CreateNewSolution cns = new CreateNewSolution(spro, text); cns.ShowDialog(); Classfile cf = new Classfile(); cf.Name = "Main.cs"; cf.Parent = spro.Solution[0]; cf.Path = spro.Solution[0].Path + "\\" + cf.Name; File.Create(cf.Path); spro.Solution[0].Classfile.Add(cf); Reference rf = new Reference(); rf.Name = "引用"; rf.Parent = cf; cf.Reference.Add(rf); cff = cf; this.Close(); } else { MessageBox.Show("请选择解题空间"); } }
public CreateNewProblem(Object ob) { sp = (Solvespace)ob; InitializeComponent(); }