public SettingsWindow(Persistance persistance, MasterControl control)
        {
            _control = control;
            _persistance = persistance;

            InitializeComponent();
        }
        public void Initialise(Persistance persistance)
        {
            InitialiseMicrophoneListener();

            _persistance = persistance;
            _workingDir = persistance.RootDirectory;

            _finder.Initialise(this, _voice.Speak, _voice.AsyncStop, OnCommandLog);

            _activator.OnError += _voice.Speak;

            persistance.DataChanged += _finder.DataChanged;
            persistance.DataChanged += persistance_DataChanged;

            _voice.Initialise();

            _recognizer.PhoneticRequested += _recognizer_PhoneticRequested;
            _recognizer.FunctionRequested += (func) => RunFunction(func);
            _recognizer.LogText += OnCommandLog;

            _recognizer.Initialise(persistance.RootDirectory);

            persistance.TriggerChange();

            _voice.Speak("Ready To Air Guitar");
        }
Exemple #3
0
        public static Persistance Load()
        {
            String path = Path.Combine(Environment.CurrentDirectory, FILE_NAME);

            Persistance creation;
            if (!InternalLoad(path, out creation))
            {
                creation = new Persistance();
                creation.InitialiseDefaults();
            }

            return creation;
        }
        protected override void OnInitialized(EventArgs e)
        {
            Visibility = System.Windows.Visibility.Hidden;

            _mc.Spoke += _output.AddText;
            _mc.Spoke += _mc_Spoke;

            _mc.LogText += _output.AddText;
            _mc.LogText += _mc_Spoke;

            _persistance = Persistance.Load();
            _mc.Initialise(_persistance);

            _trayIcon.Icon = Properties.Resources.PoudyIcon;
            _trayIcon.Visible = true;

            CreateContextMenu();

            InitialiseOutputWindow(null, null);

            base.OnInitialized(e);
        }
Exemple #5
0
        static bool InternalLoad(String path, out Persistance persistance)
        {
            try
            {
                XmlSerializer serializer = new XmlSerializer(typeof(Persistance));

                object result = null;
                using (Stream stream = File.OpenRead(path))
                {
                    result = serializer.Deserialize(stream);
                }

                persistance = result as Persistance;
            }
            catch
            {
                persistance = null;
                return false;
            }

            return true;
        }