Esempio n. 1
0
        private void UpdateCodeBox()
        {
            CodeBox.Clear();
            int index = PassesListBox.SelectedIndex;

            if (index == -1)
            {
                return;
            }
            TextSection section = (TextSection)PassesListBox.SelectedItem;
            TextSection prior   = index == 0 ? null : PassesListBox.Items[index - 1] as TextSection;

            if (prior == null || section.Text == prior.Text || RightButton.Checked)
            {
                CodeBox.Text = section.Text;
            }
            else if (LeftButton.Checked)
            {
                CodeBox.Text = (prior == null) ? "(no prior text)" : prior.Text;
            }
            else
            {
                TextSection.RunDiff(prior, section, CodeBox);
            }
            CodeBox.Modified = false;
            InvalidateApplyChanges();
        }
Esempio n. 2
0
        private void Button_Submit(object sender, RoutedEventArgs e)
        {
            if (!(MyProblemList.SelectedItem is Problem x))
            {
                MessageBox.Show("请选择题目", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }
            var type = string.Empty;

            foreach (var i in LangBox.Items)
            {
                if (i is RadioButton t)
                {
                    if (t.IsChecked ?? false)
                    {
                        type = t.Content.ToString();
                    }
                }
            }
            if (!string.IsNullOrEmpty(CodeBox.Text) && !string.IsNullOrEmpty(type))
            {
                Connection.UpdateMainPage.Invoke($"{DateTime.Now:yyyy/MM/dd HH:mm:ss} 提交代码,题目:{x.ProblemName}");
                Connection.SendData("SubmitCodeForCompetition",
                                    x.ProblemId + Connection.Divpar + _competition.CompetitionId + Connection.Divpar + type +
                                    Connection.Divpar + CodeBox.Text);
                CodeBox.Clear();
            }
            else
            {
                if (string.IsNullOrEmpty(type))
                {
                    MessageBox.Show("请选择语言", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
        }
Esempio n. 3
0
 private void New()
 {
     if (!AskForSave())
     {
         return;
     }
     path = null;
     CodeBox.Clear();
     // 清空撤销栈
     CodeBox.IsUndoEnabled = false;
     CodeBox.IsUndoEnabled = true;
 }
Esempio n. 4
0
        void CodeBox_DragDrop(object sender, DragEventArgs e)
        {
            object filename = e.Data.GetData("FileDrop");

            if (filename != null)
            {
                var list = filename as string[];

                if (list != null && list[0] != null)
                {
                    CodeBox.Clear();
                    string a = FileIO.OpenFile((string)list[0]);
                    CodeBox.Text   = a;
                    GlobalFileName = (string)list[0];
                }
            }
        }
Esempio n. 5
0
 private void BtnClear_Click(object sender, RoutedEventArgs e)
 {
     CodeBox.Clear();
     OutputBox.Clear();
 }
Esempio n. 6
0
 private void ButtonCancel_Click(object sender, RoutedEventArgs e)
 {
     CodeBox.Clear();
 }