Ejemplo n.º 1
0
        public void Init()
        {
            _initialised = true;
            Controller.Init();

            // Some components require the controller to be initialized
            InitializeComponent();

            label_version.Text = EDDConfig.Options.VersionDisplayString;

            PopOuts = new PopOutControl(this);

            ToolStripManager.Renderer = theme.toolstripRenderer;
            theme.LoadThemes();                                         // default themes and ones on disk loaded
            themeok = theme.RestoreSettings();                          // theme, remember your saved settings

            trilaterationControl.InitControl(this);
            travelHistoryControl1.InitControl(this);
            imageHandler1.InitControl(this);
            settings.InitControl(this);
            journalViewControl1.InitControl(this, 0);
            routeControl1.InitControl(this);
            savedRouteExpeditionControl1.InitControl(this);
            exportControl1.InitControl(this);

            Map = new EDDiscovery._3DMap.MapManager(EDDConfig.Options.NoWindowReposition, this);

            this.TopMost = EDDConfig.KeepOnTop;

#if !__MonoCS__
            // Windows TTS (2000 and above). Speech *recognition* will be Version.Major >= 6 (Vista and above)
            if (Environment.OSVersion.Platform == PlatformID.Win32NT && Environment.OSVersion.Version.Major >= 5)
            {
                audiodriverwave   = new Audio.AudioDriverCSCore(EDDConfig.DefaultWaveDevice);
                audiodriverspeech = new Audio.AudioDriverCSCore(EDDConfig.DefaultVoiceDevice);
                speechsynth       = new Audio.SpeechSynthesizer(new Audio.WindowsSpeechEngine());
            }
            else
            {
                audiodriverwave   = new Audio.AudioDriverDummy();
                audiodriverspeech = new Audio.AudioDriverDummy();
                speechsynth       = new Audio.SpeechSynthesizer(new Audio.DummySpeechEngine());
            }
#else
            audiodriverwave   = new Audio.AudioDriverDummy();
            audiodriverspeech = new Audio.AudioDriverDummy();
            speechsynth       = new Audio.SpeechSynthesizer(new Audio.DummySpeechEngine());
#endif
            audioqueuewave   = new Audio.AudioQueue(audiodriverwave);
            audioqueuespeech = new Audio.AudioQueue(audiodriverspeech);

            actioncontroller = new Actions.ActionController(this, Controller);

            ApplyTheme();

            notifyIcon1.Visible = EDDConfig.UseNotifyIcon;
        }
Ejemplo n.º 2
0
        public void Init(AudioQueue qu, SpeechSynthesizer syn,
                         string title, string caption,
                         String text,             // if null, no text box or wait complete
                         bool waitcomplete, bool literal,
                         AudioQueue.Priority prio,
                         string startname, string endname,
                         string voicename,
                         string volume,
                         string rate,
                         ConditionVariables ef)        // effects can also contain other vars, it will ignore
        {
            comboBoxCustomPriority.Items.AddRange(Enum.GetNames(typeof(AudioQueue.Priority)));

            queue                  = qu;
            synth                  = syn;
            this.Text              = caption;
            Title.Text             = title;
            textBoxBorderTest.Text = "The quick brown fox jumped over the lazy dog";

            bool defaultmode = (text == null);

            if (defaultmode)
            {
                textBoxBorderText.Visible         = checkBoxCustomComplete.Visible = comboBoxCustomPriority.Visible = labelStartTrigger.Visible = labelEndTrigger.Visible =
                    checkBoxCustomLiteral.Visible = textBoxBorderStartTrigger.Visible = checkBoxCustomV.Visible = checkBoxCustomR.Visible = textBoxBorderEndTrigger.Visible = false;

                int offset = comboBoxCustomVoice.Top - textBoxBorderText.Top;
                foreach (Control c in panelOuter.Controls)
                {
                    if (!c.Name.Equals("Title"))
                    {
                        c.Location = new Point(c.Left, c.Top - offset);
                    }
                }

                this.Height -= offset;
            }
            else
            {
                textBoxBorderText.Text              = text;
                checkBoxCustomComplete.Checked      = waitcomplete;
                checkBoxCustomLiteral.Checked       = literal;
                comboBoxCustomPriority.SelectedItem = prio.ToString();
                textBoxBorderStartTrigger.Text      = startname;
                textBoxBorderEndTrigger.Text        = endname;
                buttonExtDevice.Visible             = false;
            }

            comboBoxCustomVoice.Items.Add("Default");
            comboBoxCustomVoice.Items.Add("Female");
            comboBoxCustomVoice.Items.Add("Male");
            comboBoxCustomVoice.Items.AddRange(synth.GetVoiceNames());
            comboBoxCustomVoice.SelectedItem = voicename;

            int i;

            if (!defaultmode && volume.Equals("Default", StringComparison.InvariantCultureIgnoreCase))
            {
                checkBoxCustomV.Checked = false;
                trackBarVolume.Enabled  = false;
            }
            else
            {
                checkBoxCustomV.Checked = true;
                if (volume.InvariantParse(out i))
                {
                    trackBarVolume.Value = i;
                }
            }

            if (!defaultmode && rate.Equals("Default", StringComparison.InvariantCultureIgnoreCase))
            {
                checkBoxCustomR.Checked = false;
                trackBarRate.Enabled    = false;
            }
            else
            {
                checkBoxCustomR.Checked = true;
                if (rate.InvariantParse(out i))
                {
                    trackBarRate.Value = i;
                }
            }

            effects = ef;

            EDDiscovery.EDDTheme.Instance.ApplyToForm(this, System.Drawing.SystemFonts.DefaultFont);
        }