예제 #1
0
        public void CleanUp()
        {
            if (m_FactorizationControl != null)
            {
                m_FactorizationControl.Dispose();
            }
            if (m_GraphControl != null)
            {
                m_GraphControl.Dispose();
            }
            if (m_PrimetestControl != null)
            {
                m_PrimetestControl.Dispose();
            }
            if (m_PrimespiralControl != null)
            {
                m_PrimespiralControl.Dispose();
            }
            if (m_PrimesgenerationControl != null)
            {
                m_PrimesgenerationControl.Dispose();
            }
            if (m_PrimesInNaturalNumbersControl != null)
            {
                m_PrimesInNaturalNumbersControl.Dispose();
            }
            if (m_NumberTheoryControl != null)
            {
                m_NumberTheoryControl.Dispose();
            }
            if (m_SieveOfAtkinControl != null)
            {
                m_SieveOfAtkinControl.Dispose();
            }

            m_FactorizationControl          = null;
            m_GraphControl                  = null;
            m_StartControl                  = null;
            m_PrimetestControl              = null;
            m_PrimespiralControl            = null;
            m_PrimesgenerationControl       = null;
            m_PrimesInNaturalNumbersControl = null;
            m_NumberTheoryControl           = null;
            m_SieveOfAtkinControl           = null;

            OnlineHelp.OnlineHelpAccess.HelpWindowClosed();
        }
예제 #2
0
        private void Navigate(NavigationCommandType type, bool incHistory)
        {
            if (m_ActualControl != null)
            {
                m_ActualControl.Dispose();
            }

            SetTitle(type);

            switch (type)
            {
            case NavigationCommandType.Start:
                if (m_StartControl == null)
                {
                    m_StartControl = new StartControl();
                }
                SetUserControl(m_StartControl);
                break;

            case NavigationCommandType.Factor_Bf:
                if (m_FactorizationControl == null)
                {
                    m_FactorizationControl = new FactorizationControl();
                }
                SetUserControl(m_FactorizationControl, 0);
                break;

            case NavigationCommandType.Factor_QS:
                if (m_FactorizationControl == null)
                {
                    m_FactorizationControl = new FactorizationControl();
                }
                SetUserControl(m_FactorizationControl, 2);
                break;

            case NavigationCommandType.Primetest_Miller:
                if (m_PrimetestControl == null)
                {
                    m_PrimetestControl = new PrimetestControl(NavigateHistory);
                }
                SetUserControl(m_PrimetestControl, 2);
                break;

            case NavigationCommandType.Primetest_Sieve:
                if (m_PrimetestControl == null)
                {
                    m_PrimetestControl = new PrimetestControl(NavigateHistory);
                }
                SetUserControl(m_PrimetestControl, 0);
                break;

            case NavigationCommandType.SieveOfAtkin:
                if (m_PrimetestControl == null)
                {
                    m_PrimetestControl = new PrimetestControl(NavigateHistory);
                }
                SetUserControl(m_PrimetestControl, 3);
                break;

            case NavigationCommandType.PrimeDistrib_Numberline:
                if (m_PrimesInNaturalNumbersControl == null)
                {
                    m_PrimesInNaturalNumbersControl = new PrimesInNaturalNumbersControl();
                }
                SetUserControl(m_PrimesInNaturalNumbersControl, 0);
                break;

            case NavigationCommandType.PrimeDistrib_Numberrec:
                if (m_PrimesInNaturalNumbersControl == null)
                {
                    m_PrimesInNaturalNumbersControl = new PrimesInNaturalNumbersControl();
                }
                SetUserControl(m_PrimesInNaturalNumbersControl, 1);
                break;

            case NavigationCommandType.Graph:
                if (m_GraphControl == null)
                {
                    m_GraphControl = new GraphControl();
                }
                if (m_PrimesInNaturalNumbersControl == null)
                {
                    m_PrimesInNaturalNumbersControl = new PrimesInNaturalNumbersControl();
                }
                SetUserControl(m_PrimesInNaturalNumbersControl, 2);
                break;

            case NavigationCommandType.PrimeDistrib_Ulam:
                if (m_PrimesInNaturalNumbersControl == null)
                {
                    m_PrimesInNaturalNumbersControl = new PrimesInNaturalNumbersControl();
                }
                SetUserControl(m_PrimesInNaturalNumbersControl, 3);
                break;

            case NavigationCommandType.Numberline:
                if (m_PrimesInNaturalNumbersControl == null)
                {
                    m_PrimesInNaturalNumbersControl = new PrimesInNaturalNumbersControl();
                }
                SetUserControl(m_PrimesInNaturalNumbersControl);
                break;

            case NavigationCommandType.Primespirals:
                if (m_PrimespiralControl == null)
                {
                    m_PrimespiralControl = new PrimesprialControl();
                }
                SetUserControl(m_PrimespiralControl);
                break;

            case NavigationCommandType.Primesgeneration:
                if (m_PrimesgenerationControl == null)
                {
                    m_PrimesgenerationControl = new PrimesgenerationControl();
                }
                SetUserControl(m_PrimesgenerationControl);
                break;

            case NavigationCommandType.PowerMod:
                if (m_NumberTheoryControl == null)
                {
                    m_NumberTheoryControl = new NumberTheoryControl();
                }
                SetUserControl(m_NumberTheoryControl, 0);
                break;

            case NavigationCommandType.NumberTheoryFunctions:
                if (m_NumberTheoryControl == null)
                {
                    m_NumberTheoryControl = new NumberTheoryControl();
                }
                SetUserControl(m_NumberTheoryControl, 1);
                break;

            case NavigationCommandType.PrimitivRoot:
                if (m_NumberTheoryControl == null)
                {
                    m_NumberTheoryControl = new NumberTheoryControl();
                }
                SetUserControl(m_NumberTheoryControl, 2);
                break;

            case NavigationCommandType.PrimeDistrib_Goldbach:
                if (m_NumberTheoryControl == null)
                {
                    m_NumberTheoryControl = new NumberTheoryControl();
                }
                SetUserControl(m_NumberTheoryControl, 3);
                break;
            }

            if (incHistory)
            {
                NavigateHistory(type);
            }

            SetHistoryButtons();
        }