public SettingsPage2(Form parent) { this.parent = parent; InitializeComponent(); btnAutoAlarm = new ALSButton(); alarm = new ALSAlarm(); goBack = new ALSButton(); int btnWidth = (Width - MainMenu.GAP * 8) / 7; btnAutoAlarm.Text = CVInterface.GetAutoAlarm() ? "Disable\nauto-alarm" : "Enable\nauto-alarm"; btnAutoAlarm.Size = new Size(btnWidth, btnWidth); btnToggleDecay = new ALSButton(); btnToggleDecay.Text = isDecay ? "Prevent\nDecay" : "Allow\nDecay"; btnToggleDecay.Size = new Size(btnWidth, btnWidth); btnToggleDecay.Click += btnDecay_Click; Controls.Add(btnToggleDecay); Controls.Add(btnAutoAlarm); Controls.Add(goBack); Controls.Add(alarm); goBack.Click += new System.EventHandler(this.GoBack_Click); goBack.Text = "Go Back"; Resize += this.Resize_SettingsScreen; btnAutoAlarm.Click += this.btAutoAlarm_Click; }
static void UnsafeFail() { try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); mainMenu = new MainMenu(); Application.Run(mainMenu); } catch (Exception e) { LogCrash(e); CVInterface.PleaseStop(); Application.Exit(); } }
private void SettingsForm_FormClosing(object sender, FormClosingEventArgs e) { try { // Create the XmlDocument XmlDocument doc = new XmlDocument(); doc.LoadXml("<item><name>Settings</name></item>"); // Add elements XmlElement keyboard = doc.CreateElement("keyboard"); keyboard.InnerText = isQwerty ? "Qwerty" : "Large Button"; doc.DocumentElement.AppendChild(keyboard); XmlElement decay = doc.CreateElement("decay"); decay.InnerText = isDecay ? "Decay" : "No Decay"; doc.DocumentElement.AppendChild(decay); XmlElement autoAlarm = doc.CreateElement("autoalarm"); autoAlarm.InnerText = CVInterface.GetAutoAlarm() ? "AAEnabled" : "AADisabled"; doc.DocumentElement.AppendChild(autoAlarm); XmlElement xmlDwellTime = doc.CreateElement("dwellTime"); xmlDwellTime.InnerText = dwellTime.ToString(); doc.DocumentElement.AppendChild(xmlDwellTime); XmlElement xmlKeyboardDwellTime = doc.CreateElement("keyboardDwellTime"); xmlKeyboardDwellTime.InnerText = keyboardDwellTime.ToString(); doc.DocumentElement.AppendChild(xmlKeyboardDwellTime); XmlElement xmlVoiceSpeed = doc.CreateElement("voiceSpeed"); xmlVoiceSpeed.InnerText = voiceSpeed.ToString(); doc.DocumentElement.AppendChild(xmlVoiceSpeed); XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; // Save the document to a file and auto-indent the output XmlWriter writer = XmlWriter.Create("settings.xml", settings); doc.Save(writer); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } Application.Exit(); }
private void yesBut_Click(object sender, EventArgs e) { CVInterface.PleaseStop(); Application.Exit(); }
public SettingsPage1() { InitializeComponent(); dwellTime = -1; keyboardDwellTime = -1; voiceSpeed = -1; try { XmlDataDocument doc = new XmlDataDocument(); FileStream fs = new FileStream("settings.xml", FileMode.Open, FileAccess.Read); doc.Load(fs); XmlNode xmlnode = doc.FirstChild; xmlnode = xmlnode.NextSibling; isQwerty = xmlnode["keyboard"].InnerText.Equals("Qwerty"); CVInterface.SetAutoAlarm(xmlnode["autoalarm"].InnerText.Equals("AAEnabled")); isDecay = xmlnode["decay"].InnerText.Equals("Decay"); dwellTime = Convert.ToInt32(xmlnode["dwellTime"].InnerText); keyboardDwellTime = Convert.ToInt32(xmlnode["keyboardDwellTime"].InnerText); voiceSpeed = Convert.ToInt32(xmlnode["voiceSpeed"].InnerText); } catch (Exception) { } nextPage = new SettingsPage2(this); btnAlarm.BackgroundImageLayout = ImageLayout.Zoom; btnAlarm.setFontSize(); btnBack.setFontSize(); btnResetCallouts.setFontSize(); btnLock = new ALSButton(); btnLock.BackgroundImage = Properties.Resources.Lock; btnLock.BackgroundImageLayout = ImageLayout.Zoom; btnLock.Click += _lock_Click; btnLock.Size = btnBack.Size; Controls.Add(btnLock); btnToggleKeyboard = new ALSButton(); btnToggleKeyboard.Text = isQwerty ? "Large\nButton\nKeyboard" : "Qwerty\nKeyboard"; btnToggleKeyboard.Size = btnBack.Size; btnToggleKeyboard.Click += ChangeKeyboard_Click; Controls.Add(btnToggleKeyboard); btnNext = new ALSButton(); btnNext.Text = "More\nSettings"; btnNext.Size = btnBack.Size; btnNext.Click += btnNext_Click; Controls.Add(btnNext); btnAbout = new ALSButton(); btnAbout.Text = "About"; btnAbout.Size = btnBack.Size; btnAbout.Click += BtnAbout_Click; Controls.Add(btnAbout); if (voiceSpeed != -1) { sldrDwellTime = new Slider("Dwell Time", dwellTime); sldrKeyboard = new Slider("Keyboard Dwell Time", keyboardDwellTime); sldrVoiceSpeed = new Slider("Voice Speed", voiceSpeed); } else { sldrDwellTime = new Slider("Dwell Time"); sldrKeyboard = new Slider("Keyboard Dwell Time"); sldrVoiceSpeed = new Slider("Voice Speed"); } Controls.Add(sldrDwellTime); Controls.Add(sldrKeyboard); Controls.Add(sldrVoiceSpeed); sldrDwellTime.BtnRight_Click += SldrDwellTime_Btn_Click; sldrDwellTime.BtnLeft_Click += SldrDwellTime_Btn_Click; sldrKeyboard.BtnLeft_Click += SldrKeyboard_Btn_Click; sldrKeyboard.BtnRight_Click += SldrKeyboard_Btn_Click; sldrVoiceSpeed.BtnRight_Click += SldrVoiceSpeed_Btn_Click; sldrVoiceSpeed.BtnLeft_Click += SldrVoiceSpeed_Btn_Click; frmAboutPage = new About(); frmAboutPage.VisibleChanged += FrmAboutPage_VisibleChanged; dwellTime = sldrDwellTime.value; keyboardDwellTime = sldrDwellTime.value; voiceSpeed = sldrVoiceSpeed.value; }
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); }
private void UI_FormClosed(object sender, FormClosedEventArgs e) { CVInterface.PleaseStop(); Application.Exit(); }
private void btAutoAlarm_Click(object sender, EventArgs e) { CVInterface.SetAutoAlarm(!CVInterface.GetAutoAlarm()); ((ALSButton)sender).Text = CVInterface.GetAutoAlarm() ? "Disable\nauto-alarm" : "Enable\nauto-alarm"; }