Exemple #1
0
 public void Initialise()
 {
     AnimaCentral.Initialise();
     Assert.IsFalse(AnimaCentral.SpeechEngine == null);
     Assert.IsFalse(AnimaCentral.Voice == null);
     Assert.IsFalse(AnimaCentral.Image == null);
 }
Exemple #2
0
        public void PositionSet()
        {
            AnimaCentral.Pos = new Position(0, 0);
            MainWindow MW = new MainWindow();

            AnimaCentral.SendUpdate();
            Assert.AreEqual(MW.Left, AnimaCentral.Pos.X);
            Assert.AreEqual(MW.Top, AnimaCentral.Pos.Y);
        }
Exemple #3
0
        public void UpdateCheck()
        {
            AnimaCentral.Initialise();
            bool EventFired = false;

            AnimaCentral.AnimaUpdate += delegate(object sender, AnimaEventArgs e) { EventFired = true; };
            AnimaCentral.SendUpdate();
            Assert.IsTrue(EventFired);
        }
Exemple #4
0
        public void SpeakAll()
        {
            AnimaCentral.Initialise();
            AnimaCentral.SpeechQueue.Enqueue(new System.Speech.Synthesis.Prompt("Test1"));
            AnimaCentral.SpeechQueue.Enqueue(new System.Speech.Synthesis.Prompt("Test2"));
            AnimaCentral.SpeechQueue.Enqueue(new System.Speech.Synthesis.Prompt("Test3"));
            AnimaCentral.SpeechQueue.Enqueue(new System.Speech.Synthesis.Prompt("Test4"));

            Assert.AreEqual(4, AnimaCentral.SpeechQueue.Count);
            AnimaCentral.SpeakAll();
            Assert.AreEqual(0, AnimaCentral.SpeechQueue.Count);
        }
        private void ClearExistingProgramCommands()
        {
            if (AllProgramCommands == null)
            {
                AllProgramCommands = new List <Command>(); return;
            }

            foreach (var c in AllProgramCommands)
            {
                AnimaCentral.UnregisterCommand(c);
            }

            AllProgramCommands = new List <Command>();
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            AnimaCentral.Initialise(this);
            AnimaCentral.AnimaUpdate += UpdateDisplay;
            AnimaCentral.Pos          = AnimaCentral.BottomRightMainScreen(this.Width, this.Height);

            Command BringTop = new Command("Could you be visible please?", Utilities.GiveReply("Hello, here I am", delegate() {
                this.Dispatcher.Invoke(() =>
                {
                    this.Topmost = true;
                });
            }));
            Command AllowDropBack = new Command("You can hide now", Utilities.GiveReply("Okay, I'll just hang back", delegate() {
                this.Dispatcher.Invoke(() =>
                {
                    this.Topmost = false;
                });
            }));

            AnimaCentral.RegisterCommand(BringTop, AllowDropBack);
        }
        private void ProgramOpenManager_Load(object sender, EventArgs e)
        {
            ClearExistingProgramCommands();
            ProgramListBox.Items.Clear();

            List <int> MissingFileIndexes = new List <int>();
            var        CustomOpens        = Properties.CoreSettings.Default.CustomProgramOpens;

            if (CustomOpens == null)
            {
                CustomOpens = new System.Collections.Specialized.StringCollection();
            }

            for (int i = 0; i < CustomOpens.Count; i++)
            {
                string pc = CustomOpens[i];

                List <string> Sections = pc.Split(new char[] { ';' }).ToList();
                if (Sections.Count < 3)
                {
                    MissingFileIndexes.Add(i); continue;
                }

                string Phrase = Sections[0];
                string path   = Sections[1];
                string Args   = Sections[2];
                string Reply  = Sections.Count > 3 ? Sections[3] : String.Empty;

                if (!File.Exists(path) && !Utilities.WebAddressExists(path))
                {
                    MissingFileIndexes.Add(i); continue;
                }

                var Arguments = ProduceArgs(Args);

                if (Arguments.Length == 0)
                {
                    Command c = new Command(Phrase, Utilities.OpenFile(path, Reply));
                    AnimaCentral.RegisterCommand(c);
                    AllProgramCommands.Add(c);
                }
                else
                {
                    Command c = new Command(Phrase, Utilities.OpenFile(path, Reply, Arguments), Args: Arguments);
                    AnimaCentral.RegisterCommand(c);
                    AllProgramCommands.Add(c);
                }


                ProgramListBox.Items.Add(pc);
            }

            MissingFileIndexes.Reverse(); //Due to removal Process

            foreach (int index in MissingFileIndexes)
            {
                CustomOpens.RemoveAt(index);
            }

            Properties.CoreSettings.Default.CustomProgramOpens = CustomOpens;
            Properties.CoreSettings.Default.Save();
        }