コード例 #1
0
        private void CreateNewProblem_Click(object sender, RoutedEventArgs e)
        {
            Solvedproblem sproblem = new Solvedproblem();
            Chachong      cc       = new Chachong();

            if (cc.Chazhao(nametextbox.Text, sp.Solvedproblem))
            {
                MessageBox.Show("此工作空间下已有此题");
                return;
            }
            sproblem.Name   = nametextbox.Text;
            sproblem.Tiku   = tikutextbox.Text;
            sproblem.Parent = sp;
            sproblem.Path   = sp.Path + "\\" + sproblem.Name;
            System.IO.Directory.CreateDirectory(sproblem.Path);
            sp.Solvedproblem.Add(sproblem);
            this.Close();
        }
コード例 #2
0
        private void CreateNewClass_Click(object sender, RoutedEventArgs e)
        {
            Classfile cf = new Classfile();
            Reference rf = new Reference();
            Chachong  cc = new Chachong();

            if (cc.Chazhao(createclasstextbox.Text, sl.Classfile))
            {
                MessageBox.Show("当前解题方法中已有此类");
                return;
            }
            rf.Name   = "引用";
            cf.Parent = sl;
            cf.Reference.Add(rf);
            cf.Name = createclasstextbox.Text + ".cs";
            cf.Path = sl.Path + "\\" + cf.Name;
            using (File.Create(cf.Path))
            {
            }
            sl.Classfile.Add(cf);
            this.Close();
        }
コード例 #3
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (st == null && newsolution == "")
     {
         MessageBox.Show("请选择");
     }
     else
     {
         ClickOrNot = true;
         if (st == null)
         {
             if (newsolution != "")
             {
                 newsolution = newsolutiontext.Text;
                 Chachong cc = new Chachong();
                 if (cc.Chazhao(newsolution, sp.Solution))
                 {
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show("该解题方法已存在");
                 }
             }
             else
             {
                 this.Close();
             }
         }
         else
         {
             Console.WriteLine("打开解决方案");
             this.Close();
         }
     }
 }
コード例 #4
0
 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("请选择解题空间");
     }
 }