コード例 #1
0
        public static Action <RecognitionResult> OpenForm(Form F, string Reply = null)
        {
            Action <RecognitionResult> Outcome;

            if (F != null)
            {
                if (!String.IsNullOrEmpty(Reply))
                {
                    Outcome = delegate(RecognitionResult r)
                    {
                        AnimaEventArgs e = new AnimaEventArgs(F);
                        AnimaCentral.SendUpdate(e);
                        Anima.Core.AnimaCentral.Speak(Reply);
                    };
                }
                else
                {
                    Outcome = delegate(RecognitionResult r)
                    {
                        AnimaEventArgs e = new AnimaEventArgs(F);
                        AnimaCentral.SendUpdate(e);
                    };
                }
                return(Outcome);
            }

            throw new Exception("Error creating Command");
        }
コード例 #2
0
        public void SortLoadOrder()
        {
            EnableModules  = new List <IModule>();
            DisableModules = new List <IModule>();

            SeparateModules();

            foreach (IModule module in EnableModules)
            {
                module.ModuleStart();
            }

            AnimaCentral.Reinitialise();
        }
コード例 #3
0
        public PluginManager()
        {
            string PluginDirectory = new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName + @"\Plugins";


            if (!Directory.Exists(PluginDirectory))
            {
                if (!Utilities.IsRunAsAdmin())
                {
                    AnimaCentral.Speak("There's a problem creating the plugin folder.", "Either create your own or run me with Administrative privileges once");
                    // Launch itself as administrator
                    ProcessStartInfo proc = new ProcessStartInfo();
                    proc.UseShellExecute  = true;
                    proc.WorkingDirectory = Environment.CurrentDirectory;
                    proc.FileName         = Application.ExecutablePath;
                    proc.Verb             = "runas";

                    try
                    {
                        Process.Start(proc);
                    }
                    catch
                    {
                        // The user refused the elevation.
                        // Do nothing and return directly ...
                        return;
                    }

                    Application.Exit();  // Quit itself
                }
                Directory.CreateDirectory(PluginDirectory);
            }



            Compose(PluginDirectory);
            SeparateModules();

            foreach (IModule module in EnableModules)
            {
                module.ModuleStart();
            }

            TickTimer           = new System.Timers.Timer(Properties.CoreSettings.Default.TickInterval);
            TickTimer.AutoReset = true;
            TickTimer.Elapsed  += TickTimer_Elapsed;
            TickTimer.Start();
        }
コード例 #4
0
        public void ModuleStart()
        {
            Command LoadOrderOpen      = new Command("I would like to change the Load Order", Utilities.OpenForm(new LoadOrderManager(), "Of Course"));
            Command VoiceSelectOpen    = new Command("I would like to change your voice", Utilities.OpenForm(new Forms.VoiceSelection(), "Of Course"));
            Command ProgramOpenManager = new Command("I would like to change my program opens", Utilities.OpenForm(POM, "Of Course"));
            Command ShowCommandList    = new Command("Show the Command List", Utilities.OpenForm(new Forms.Command_List(), "Here's the commands"));

            GrammarBuilder gb = new GrammarBuilder(GooglePhrase);

            gb.AppendDictation();
            Grammar googlegrammar = new Grammar(gb);
            Command Google        = new Command(GooglePhrase + "...", googlegrammar, this.Google, 0.8);

            Command Reply = new Command("I wish to hear your voice", Utilities.GiveReply("Of course, This is my voice, The Quick Brown Fox Jumped Over The Lazy Dog"));

            AnimaCentral.RegisterCommand(LoadOrderOpen, VoiceSelectOpen, ProgramOpenManager, ShowCommandList, Google, Reply);

            //Registers existing custom Programs
            AnimaCentral.SendUpdate(new AnimaEventArgs(POM));
            POM.Show();
            POM.Hide();
        }