예제 #1
0
        public newMessageFrm(string jid, string domain)
        {
            InitializeComponent();
            CheckForIllegalCrossThreadCalls = false;
            jidFrom = jid;
            newMessageWindow.Text = "Chat with: " + jid;
            serverName            = domain;
            this.Text             = "Chat with: " + jid; lk.Learning += new EventHandler <LearningEventArgs>(SynBot_Learning);
            Thread hdcx = new Thread(pxj);

            hdcx.Start();

            lk.Memorizing += new EventHandler <MemorizingEventArgs>(synBot_Memorizing);
            lk.Configuration.StoreVocabulary = true;
            lk.Configuration.StoreExamples   = true;
            //Load brain files(siml) here...
            var simlPackage = File.ReadAllText("know.simlpk");

            lk.PackageManager.LoadFromString(simlPackage);
            try
            {
                var fileLearn = File.ReadAllText(Path.Combine(Directory.GetCurrentDirectory(), "package\\Learned.siml"));
                lk.AddSiml(fileLearn);
                Console.WriteLine("Loaded learning file...");
            }
            catch { Console.WriteLine("NO learn..."); }
            try
            {
                int yh        = 0;
                var fileLearn = Directory.GetFiles(Path.Combine("siml", "*.siml"));
                foreach (string fk in fileLearn)
                {
                    yh++;
                    lk.AddSiml(fk);
                    Console.WriteLine("Loaded learning file..." + yh.ToString());
                }
            }
            catch { Console.WriteLine("NO learn..."); }
        }
        public MainWindow()
        {
            InitializeComponent();
            Bot             = new SimlBot();
            DatabaseUtility = new DatabaseUtility();
            DatabaseUtility.Initialize();
            UpdateDataGrid("SELECT * From Employees");
            Bot.Sets.Add(new NameSet(DatabaseUtility));
            Bot.Sets.Add(new JobSet(DatabaseUtility));
            Bot.Sets.Add(new SalarySet(DatabaseUtility));
            Bot.Sets.Add(new AgeSet(DatabaseUtility));
            Bot.Sets.Add(new IdSet(DatabaseUtility));
            Bot.Adapters.Add(new SqlAdapter(this));
            var simlFiles = Directory.GetFiles(Path.Combine(Directory.GetCurrentDirectory(), "SIML"), "*.siml", SearchOption.AllDirectories);

            foreach (var simlDocument in simlFiles.Select(XDocument.Load))
            {
                Bot.AddSiml(simlDocument);
            }
            ExamplesBox.Text = Properties.Resources.Examples;
        }