예제 #1
0
        private void _saveButton_Click
        (
            object sender,
            EventArgs e
        )
        {
            if (ReferenceEquals(ControlCenter.Exemplars, null))
            {
                return;
            }

            if (ControlCenter.Exemplars.Count == 0)
            {
                return;
            }

            string fileName = ControlCenter.Exemplars[0].KsuNumber1
                              .ThrowIfNull("ksu not set")
                              .Replace('/', '-')
                              .Replace('\\', '-')
                              .Replace(':', '-')
                              .Replace('|', '-')
                              + ".json";

            _saveFileDialog.FileName = fileName;

            if (_saveFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                ControlCenter.SaveExemplars(_saveFileDialog.FileName);
            }
        }
예제 #2
0
 /// <summary>
 /// Write debug line.
 /// </summary>
 private static void WriteLine
 (
     [NotNull] string format,
     params object[] arguments
 )
 {
     ControlCenter.WriteLine(format, arguments);
 }
예제 #3
0
 private void toolStripButton1_Click
 (
     object sender,
     EventArgs e
 )
 {
     if (_openFileDialog.ShowDialog(this) == DialogResult.OK)
     {
         List <ExemplarInfo> exemplars = ControlCenter.ReadExemplars
                                         (
             _openFileDialog.FileName
                                         );
         SetExemplars(exemplars);
     }
 }
예제 #4
0
        private void LoadRegisters()
        {
            string year = _yearBox.Value.ToString
                          (
                "0",
                CultureInfo.InvariantCulture
                          );

            TermInfo[] terms = ControlCenter.GetTerms(year);
            WriteLine
            (
                "Year: {0}, registers: {1}",
                year,
                terms.Length
            );
            _ksuGrid.DataSource = terms;
        }
예제 #5
0
        private async void _newPartyBox_Click
        (
            object sender,
            EventArgs e
        )
        {
            DataGridViewRow currentRow = _ksuGrid.CurrentRow;

            if (ReferenceEquals(currentRow, null))
            {
                return;
            }

            TermInfo register = currentRow.DataBoundItem as TermInfo;

            if (ReferenceEquals(register, null))
            {
                return;
            }

            try
            {
                _busyStripe.Moving  = true;
                _busyStripe.Visible = true;

                string ksu = register.Text.ThrowIfNull("ksu");

                WriteLine("Партия: {0}", ksu);

                List <ExemplarInfo> exemplars = await Task.Run
                                                (
                    () => ControlCenter.GetExemplars(ksu)
                                                );

                SetExemplars(exemplars);
            }
            finally
            {
                _busyStripe.Visible = false;
                _busyStripe.Moving  = false;
            }
        }
예제 #6
0
        private void MainForm_Load
        (
            object sender,
            EventArgs e
        )
        {
            _ksuGrid.AutoGenerateColumns  = false;
            _bookGrid.AutoGenerateColumns = false;

            this.ShowVersionInfoInTitle();
            _logBox.Output.PrintSystemInformation();

            ControlCenter.Initialize();
            ControlCenter.Output = _logBox.Output;

            _yearBox.Value = DateTime.Today.Year;

            ControlCenter.WriteLine("Ready");
            ControlCenter.WriteLine(string.Empty);

            _barcodeBox.Focus();
        }
예제 #7
0
        private void _unmarkedButton_Click
        (
            object sender,
            EventArgs e
        )
        {
            List <ExemplarInfo> unmarked = ControlCenter.ListUnmarked();

            if (unmarked.Count == 0)
            {
                MessageBox.Show("Нет неподтвержденных");
                return;
            }

            StringBuilder builder = new StringBuilder();

            foreach (ExemplarInfo exemplar in unmarked)
            {
                builder.AppendLine
                (
                    string.Format
                    (
                        "{0}: {1}",
                        exemplar,
                        exemplar.Description
                    )
                );
            }

            string text = builder.ToString();

            using (PlainTextViewer viewer = new PlainTextViewer())
            {
                viewer.SetText(text);
                viewer.ShowDialog(this);
            }
        }