コード例 #1
0
        /// <summary>
        /// Select Codes tab and open a specific problem
        /// </summary>
        /// <param name="pnum">Problem Number</param>
        public static void ShowCode(long pnum)
        {
            if (!LocalDatabase.HasProblem(pnum))
            {
                return;
            }

            codes.BeginInvoke((MethodInvoker) delegate
            {
                try
                {
                    codesBrowser.ShowCode(pnum);
                }
                catch (System.Exception ex)
                {
                    Logger.Add(ex.Message, "Interactivity|ShowCode()");
                }
            });

            mainForm.BeginInvoke((MethodInvoker) delegate
            {
                try
                {
                    mainForm.customTabControl1.SelectedTab = mainForm.codesTab;
                    mainForm.BringToFront();
                }
                catch (System.Exception ex)
                {
                    Logger.Add(ex.Message, "Interactivity|ShowCode()");
                }
            });
        }
コード例 #2
0
        /// <summary>
        /// Select Problems tab page and open a specific problem description
        /// </summary>
        /// <param name="pnum">Problem Number</param>
        public static void ShowProblem(long pnum)
        {
            try
            {
                if (!LocalDatabase.HasProblem(pnum))
                {
                    return;
                }

                problems.BeginInvoke((MethodInvoker) delegate
                {
                    ProblemInfo pinfo = LocalDatabase.GetProblem(pnum);
                    problems.ShowAllProblems();
                    problems.problemListView.SelectedObject = pinfo;
                    problems.problemListView.EnsureVisible(problems.problemListView.SelectedIndex);
                });

                mainForm.BeginInvoke((MethodInvoker) delegate
                {
                    mainForm.customTabControl1.SelectedTab = mainForm.problemTab;
                    mainForm.BringToFront();
                });
            }
            catch (System.Exception ex)
            {
                Logger.Add(ex.Message, "Interactivity|ShowProblem()");
            }
        }
コード例 #3
0
        private void DownloadNext()
        {
            while (remaining.Count > 0)
            {
                current = remaining[0];
                remaining.RemoveAt(0);

                if (!LocalDatabase.HasProblem(current))
                {
                    continue;
                }
                DownloadProblem();

                if (CurrentState != State.Running)
                {
                    return;
                }
                LastDownloadedProblem = current;
            }
        }