コード例 #1
0
ファイル: Screen.cs プロジェクト: teddy9264/KSP_MOCR
        public void SetScreen(int id)
        {
            // Stop screen update
            screenTimer.Stop();

            // Dispose of old elements
            if (activeScreen != null)
            {
                activeScreen.destroy();
            }

            // Destroy old screen
            activeScreen = null;

            // Get Screen
            Helper.setForm(this);
            activeScreen = MocrScreen.Create(id, this);

            // If Screen exists: Make Elementes and resize
            if (activeScreen != null)
            {
                screenType = id;
                activeScreen.resizeForm();
                activeScreen.makeElements();

                // Set focus to input 0
                activeScreen.screenInputs[0].Focus();

                // Start the update process
                screenTimer.Start();

                this.Resize += activeScreen.resize;
            }
            else
            {
                MessageBox.Show("Screen " + id.ToString() + " not found", "INFORMATION", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
        }