Пример #1
0
        public MainMenu()
        {
            InitializeComponent();
            this.self = this;
            btnAlarm.Click += new System.EventHandler(alarmBut_Click);
            lockScreen = new LockScreen();

            //Temp code
            tobiiInt = new CVInterface();
            eyeTrackingThread = new Thread(tobiiInt.StartEyeTracking);
            eyeTrackingThread.Name = "Eye Tracking Thread";
            eyeTrackingThread.Start();

            voice = new SpeechSynthesizer();

            voice.SetOutputToDefaultAudioDevice();
            voice.Volume = 100;
            voice.SelectVoiceByHints(VoiceGender.Male);

            factory = new Factory();

            texttospeech = factory.Texttospeech;
            notebook = factory.Notebook;
            callout = factory.Callout;
            quitScreen = factory.QuitScreen;
            browser = factory.Browser;
            email = factory.Email;
            //Settings must be created last to update all of the other application's properties
            settingsScreen = factory.SettingsScreen;

            texttospeech.Visible = false;
            notebook.Visible = false;
            callout.Visible = false;
            settingsScreen.Visible = false;
            browser.Visible = false;
            email.Visible = false;

            texttospeech.MainMenu_Click += MainMenu_Show;
            notebook.MainMenu_Click += MainMenu_Show;
            callout.MainMenu_Click += MainMenu_Show;
            settingsScreen.MainMenu_Click += MainMenu_Show;
            quitScreen.MainMenu_Click += MainMenu_Show;
            browser.MainMenu_Click += MainMenu_Show;
            email.MainMenu_Click += MainMenu_Show;
            texttospeech.GetBtnCallout().Click += new System.EventHandler(this.openCallouts);

            texttospeech.Callouts_Click += Callouts_Show;
            callout.TextToSpeech_Click += TextToSpeech_Show;

            settingsScreen.SetKeyboard += SettingsScreen_SetKeyboard;

            this.VisibleChanged += UI_VisibleChanged;

            settingsScreen.btnResetCallouts.Click += new System.EventHandler(this.resetCallouts);

            foreach (ALSButton btn in callout.getMenuBtns())
            {
                if (btn.Text == "Main Menu" || btn.Text == "Text to Speech")
                {
                    btn.Click += new System.EventHandler(this.closeCallouts);
                }
            }

            Rectangle resolution = Screen.PrimaryScreen.Bounds;
            if (resolution.Width < 840 || resolution.Height < 580)
            {
                MessageBox.Show("You are using a computer with a screen resolution less than recommended. Undesired results may incur.");
            }

            settingsScreen.ApplySettings();

            //listen for close
            closeTimer = new Timer();
            closeTimer.Enabled = true;
            closeTimer.Interval = 1000;
            closeTimer.Tick += new EventHandler(closeTimeEvent);
        }
Пример #2
0
 public void createAllObjects()
 {
     Texttospeech = new TextToSpeech(true);
     Notebook = new Notebook(true);
     Callout = new Callout(true);
     QuitScreen = new QuitForm();
     Browser = new Browser();
     Email = new Email(true);
     //Settings must be created last to update all of the other application's properties
     SettingsScreen = new SettingsPage1();
 }