Example #1
0
        private void Create_RunBttn_Click(object sender, EventArgs e)
        {
            PropertyInfo[] properties = newBook.GetProperties();
            //Type t = newBook.MakeGenericType(newBook);
            int i = 0;

            if (properties.Length == 10)
            {
                book = new Encyclopedia();
                //+
                i = 2;
            }

            book.NameOfEdition = BooksDGV[1, i].Value.ToString();
            book.Title         = BooksDGV[1, i + 1].Value.ToString();
            book.Author        = BooksDGV[1, i + 2].Value.ToString();
            book.Genre         = BooksDGV[1, i + 3].Value.ToString();
            book.Language      = BooksDGV[1, i + 4].Value.ToString();
            book.AmountOfPages = Convert.ToInt32(BooksDGV[1, i + 5].Value.ToString());
            book.Year          = Convert.ToInt32(BooksDGV[1, i + 6].Value.ToString());
            book.Price         = Convert.ToInt32(BooksDGV[1, i + 7].Value.ToString());
            if (i > 0)
            {
                Encyclopedia enc = new Encyclopedia();
                enc = (Encyclopedia)book;
                enc.FieldOfStudy  = BooksDGV[1, 0].Value.ToString();
                enc.SubjectSearch = Convert.ToBoolean(BooksDGV[1, 1].Value.ToString());
                result            = enc;
            }
            else
            {
                result = book;
            }
            //Book nbook = (Book)Activator.CreateInstance(t);
        }
        private static void newTextbox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key != Key.Enter)
            {
                return;
            }
            using (var context = new Db1Entities())
            {
                var textBox = sender as TextBox;
                if (textBox != null)
                {
                    var encyclopedia = new Encyclopedia
                    {
                        Name = textBox.Text
                    };
                    context.Encyclopedia.Add(encyclopedia);
                }
                context.SaveChanges();
                var box = sender as TextBox;
                if (box != null)
                {
                    MessageBox.Show("The Encyclopedia '" + box.Text + "' has been added to the Database");
                }
            }
            var grid = ((TextBox)sender).Parent as Grid;

            (grid?.Parent as Window)?.Close();
        }
Example #3
0
        public void CrateCreation()
        {
            Random GetRand = new Random();
            int    typeID  = GetTypeId(Type);

            for (int i = 0; i < itens.FreeSlots; i++)
            {
                uint itemProcurado;
                do
                {
                    itemProcurado = (uint)GetRand.Next(Encyclopedia.encyclopedia.Count - 1);
                } while (Encyclopedia.SearchFor(itemProcurado) == null);

                if (typeID >= GetTypeId(Encyclopedia.SearchFor(itemProcurado).ItemCategory))
                {
                    if (Encyclopedia.SearchFor(itemProcurado).IsStackable)
                    {
                        itens.AddToBag(new Slot(itemProcurado, (uint)GetRand.Next(9) + 1));
                    }
                    else
                    {
                        itens.AddToBag(new Slot(itemProcurado, 1));
                    }
                }
            }
        }
Example #4
0
    void Start()
    {
        Book         bk = new Book();
        Encyclopedia EL = new Encyclopedia("大英百科全書");

        Debug.Log(bk.ShowPrice());
        Debug.Log(EL.ShowPrice());
    }
Example #5
0
 public CraftBox(uint ItemToCraft)
 {
     this.ItemToCraft = ItemToCraft;
     this.Content     = Encyclopedia.SearchFor(ItemToCraft).Name;
     Width            = 500;
     Height           = 50;
     Click           += CraftBoxClick;
 }
Example #6
0
        public async void Start(Canvas Tela)
        {
            await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
            {
                //Debug.WriteLine("Criando HuD");
                // Interface
                interfaceManager = new InterfaceManager(Tela);
                //Debug.WriteLine("HuD Criada");

                // Carregando itens
                Encyclopedia.LoadEncyclopedia();
                QuestList.LoadQuests();

                // Criar o scenario e instanciar o player
                scene = new LevelScene(interfaceManager.CanvasChunck01);

                // Banco de dados
                //Debug.WriteLine("Carregando banco de dados");
                QuestList.LoadQuests();
                Encyclopedia.LoadNPC();
                CraftingEncyclopedia.LoadCraftings();
                // Quests
                player._Questmanager.ReceiveNewQuest(QuestList.allquests[1]);
                player._Questmanager.ReceiveNewQuest(QuestList.allquests[2]);
                player._Questmanager.actualQuest = player._Questmanager.allQuests[1];

                // Criando HuD
                interfaceManager.GenerateHUD();

                // Crafting
                CraftingStation = new Crafting();

                player._Inventory.AddToBag(new Slot(2, 90));
                player._Inventory.AddToBag(new Slot(13, 1));
                player._Inventory.AddToBag(new Slot(21, 1));
                player._Inventory.AddToBag(new Slot(22, 1));
                player._Inventory.AddToBag(new Slot(23, 1));
                player._Inventory.AddToBag(new Slot(24, 1));
                player._Inventory.AddToBag(new Slot(18, 2));

                foreach (Mob mob in mobs)
                {
                    mob.Start();
                }
                // Update
                TUpdate = new Task(Update);
                TUpdate.Start();
            });

            // Carrega interface



            // Draw
            //TDraw = new Task(Draw);
            //TDraw.Start();
        }
Example #7
0
        public void SavePlayerData(Player CustomPlayer)
        {
            string path = Path.GetTempPath() + @"Noelf";

            if (!File.Exists(path))
            {
                Directory.CreateDirectory(path);
            }

            string fileName   = "slot_" + selectedSlot;
            int    slotcount  = 0;
            int    skillcount = 0;
            int    Questcount = 0;

            path = Path.Combine(path, fileName);

            using (StreamWriter sw = File.CreateText(path))
            {
                sw.WriteLine("ID" + CustomPlayer.Id + "\n");
                sw.WriteLine("LEVEL " + CustomPlayer.level.actuallevel + "\n");
                sw.WriteLine("CON " + CustomPlayer.Con + "\n");
                sw.WriteLine("DEX " + CustomPlayer.Dex + "\n");
                sw.WriteLine("SPD " + CustomPlayer.Spd + "\n");
                sw.WriteLine("STR " + CustomPlayer.Str + "\n");
                sw.WriteLine("MND " + CustomPlayer.Mnd + "\n");
                sw.WriteLine("GOLD " + CustomPlayer._Inventory.Gold + "\n");
                sw.WriteLine("XP " + CustomPlayer.level.actualEXP + "\n");
                sw.WriteLine("WEAPON " + Encyclopedia.SearchFor(CustomPlayer.Equipamento.weapon) + "\n");
                for (int j = 0; j < 3; j++)
                {
                    sw.WriteLine("ARMADURA" + j + " " + Encyclopedia.SearchFor(CustomPlayer.Equipamento.armor[j]) + "\n");
                }
                sw.WriteLine("SKILLPOINTS " + CustomPlayer._SkillManager.SkillPoints + "\n");
                for (int j = 0; j < 4; j++)
                {
                    sw.WriteLine("SkillBAR" + j + " " + CustomPlayer._SkillManager.SkillBar[j].ID + "\n");
                    sw.WriteLine("SkillBARLVL" + j + " " + CustomPlayer._SkillManager.SkillBar[j].Lvl + "\n");
                }
                foreach (SkillGenerics skill in CustomPlayer._SkillManager.SkillList)
                {
                    sw.WriteLine("SKILL" + skillcount + " " + CustomPlayer._SkillManager.SkillList[skillcount].Lvl + "\n");
                    skillcount++;
                }
                sw.WriteLine("ATRIBUTOPOINTS " + CustomPlayer._Class.StatsPoints + "\n");
                sw.WriteLine("XI " + CustomPlayer.box.Xi + "\n");
                sw.WriteLine("YI " + CustomPlayer.box.Yi + "\n");
                foreach (Slot a in CustomPlayer._Inventory.Slots)
                {
                    sw.WriteLine("SLOT" + slotcount + " " + a.ItemID + " " + a.ItemAmount + "\n");
                    slotcount++;
                }
                foreach (Quest q in CustomPlayer._Questmanager.finishedQuests)
                {
                    sw.WriteLine("QUESTS" + Questcount + " " + CustomPlayer._Questmanager.finishedQuests[Questcount].QUEST_ID);
                }
            }
        }
Example #8
0
 //função para comprar itens do jogador
 public void BuyItem(Bag playerBag)
 {
     foreach (Slot sack in BuyingItems.Slots)
     {
         long valor = Encyclopedia.SearchFor(sack.ItemID).GoldValue;
         valor = valor * sack.ItemAmount;
         playerBag.AddGold((int)valor);
     }
     BuyingItems.Slots.Clear();
 }
Example #9
0
 public void UpdateImage()
 {
     if (MyEquip == null)
     {
         Source = null;
         return;
     }
     Source = Encyclopedia.encycloImages[Encyclopedia.SearchFor(MyEquip)];
     //Source = new BitmapImage(new Uri("ms-appx://" + MyEquip.PathImage));
 }
Example #10
0
        // função para vender itens ao jogador
        public void SellItem(Slot offer, Bag playerBag)
        {
            long valor = Encyclopedia.SearchFor(offer.ItemID).GoldValue *(long)offer.ItemAmount;

            if (playerBag.Gold >= valor)
            {
                playerBag.AddToBag(offer);
                playerBag.Gold -= (int)valor;
            }
        }
Example #11
0
        public override dynamic Create(GroupBox g)
        {
            Encyclopedia e = new Encyclopedia(base.Create(g));

            GroupBox encGroupBox         = ((Grid)g.Content).Children.OfType <GroupBox>().First(x => x.Name == "EncycloGroup");
            IEnumerable <TextBox> tbList = ((Grid)encGroupBox.Content).Children.OfType <TextBox>();

            e.Genre   = "Encyclopedia";
            e.Subject = tbList.First(x => x.Name == "InpEnSubject").Text;
            return(e);
        }
Example #12
0
 //List<NPC> npcs = new List<NPC>();
 private NPC CreateNPCPhase(int phase, uint number)
 {
     if (Encyclopedia.NonPlayerCharacters == null)
     {
         Encyclopedia.LoadNPC();
     }
     if (phase == 1)
     {
         return(Encyclopedia.NonPlayerCharacters[number]);
     }
     return(null);
 }
Example #13
0
    private void Awake()
    {
        Screen.sleepTimeout = SleepTimeout.NeverSleep;

        questManager       = FindObjectOfType <QuestManager>();
        userData           = FindObjectOfType <UserData>();
        colorPaletteHolder = FindObjectOfType <ColorPalleteHolder>();
        encyclopedia       = FindObjectOfType <Encyclopedia>();
        characterManager   = FindObjectOfType <CharacterManager>();
        dailyReward        = FindObjectOfType <DailyReward>();
        realTimeHandler    = FindObjectOfType <RealTimeHandler>();
    }
 private void LoadEncyclopedia()
 {
     using (var context = new Db1Entities())
     {
         _loadedEncyclopedia = (from c in context.Encyclopedia select c).FirstOrDefault();
         RefreshEncyclopedia(_loadedEncyclopedia);
     }
     //Type t = typeof(encycloPerson);
     //Type z = typeof(encycloFactions);
     //List < Type> typelist = new List<Type>();
     //typelist.Add(t);
     //typelist.Add(z);
     //ccMainCollection.NewItemTypes = typelist;
 }
Example #15
0
        private static void Visitor()
        {
            Book earth = new Encyclopedia();

            earth.name         = "Big Earth!";
            earth.author       = "Jose S. Massey";
            earth.categoryName = "Encyclopedia";

            Book daily = new Magazine();

            daily.name         = "Daily Magazine";
            daily.author       = "Wayne D. Eakin";
            daily.categoryName = "Magazine";


            IBookExportVisitor xmlExportVisitor  = new XmlExportVisitor();
            IBookExportVisitor jsonExportVisitor = new JsonExportVisitor();

            earth.Accept(xmlExportVisitor);
            daily.Accept(jsonExportVisitor);
        }
        private static void RefreshEncyclopedia(Encyclopedia enc)
        {
            using (var context = new Db1Entities())
            {
                //Races
                var alienlist   = (from c in context.Aliens select c).ToList();
                var encyclorace = (from c in context.encycloRace select c).ToList();

                var result = alienlist.Where(p => encyclorace.All(p2 => p2.RaceName != p.Name)).ToList();
                foreach (var item in result)
                {
                    var insertRace = new encycloRace
                    {
                        EncyclopediaId  = enc.Id,
                        RaceName        = item.Name,
                        RaceDiscription = "Fill Me!!!"
                    };
                    context.encycloRace.Add(insertRace);
                    context.SaveChanges();
                }
            }
        }
Example #17
0
        public void LoadGameData(ref Player loadPlayer)
        {
            int    lvl, xp;
            string path = Path.Combine(Path.GetTempPath() + @"/Noelf/slot_");

            if (File.Exists(path))
            {
                using (StreamReader rw = File.OpenText(path))
                {
                    string r = "";
                    while ((r = rw.ReadLine()) != null)
                    {
                        var b = r.Split(" ");
                        if (b[0] == "ID")
                        {
                            loadPlayer.Id = b[1];
                        }
                        if (b[0] == "LEVEL")
                        {
                            int.TryParse(b[1], out lvl);
                            loadPlayer.level.actuallevel = lvl;
                        }
                        if (b[0] == "CON")
                        {
                            int.TryParse(b[1], out loadPlayer.Con);
                        }
                        if (b[0] == "DEX")
                        {
                            int.TryParse(b[1], out loadPlayer.Dex);
                        }
                        if (b[0] == "SPD")
                        {
                            int.TryParse(b[1], out loadPlayer.Spd);
                        }
                        if (b[0] == "STR")
                        {
                            int.TryParse(b[1], out loadPlayer.Str);
                        }
                        if (b[0] == "MND")
                        {
                            int.TryParse(b[1], out loadPlayer.Mnd);
                        }
                        if (b[0] == "XP")
                        {
                            int.TryParse(b[1], out xp);
                            loadPlayer.level.actualEXP = xp;
                        }
                        if (b[0] == "WEAPON")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer.Equipamento.weapon = (Weapon)Encyclopedia.SearchFor((uint)result);
                        }
                        if (b[0] == "ARMADURA0")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer.Equipamento.armor[0] = (Armor)Encyclopedia.SearchFor((uint)result);
                        }
                        if (b[0] == "ARMADURA1")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer.Equipamento.armor[1] = (Armor)Encyclopedia.SearchFor((uint)result);
                        }
                        if (b[0] == "ARMADURA2")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer.Equipamento.armor[2] = (Armor)Encyclopedia.SearchFor((uint)result);
                        }
                        if (b[0] == "SKILLPOINTS")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.SkillPoints = result;
                        }
                        if (b[0] == "SKILLBAR0")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.AddSkillToBar(loadPlayer._SkillManager.FindSkill(result), 0);
                        }
                        if (b[0] == "SKILLBAR1")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.AddSkillToBar(loadPlayer._SkillManager.FindSkill(result), 1);
                        }
                        if (b[0] == "SKILLBAR2")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.AddSkillToBar(loadPlayer._SkillManager.FindSkill(result), 2);
                        }
                        if (b[0] == "SKILLBAR3")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.AddSkillToBar(loadPlayer._SkillManager.FindSkill(result), 3);
                        }
                        if (b[0] == "SKILLBARLVL0")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.SkillBar[0].Lvl = result;
                        }
                        if (b[0] == "SKILLBARLVL1")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.SkillBar[1].Lvl = result;
                        }
                        if (b[0] == "SKILLBARLVL2")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.SkillBar[2].Lvl = result;
                        }
                        if (b[0] == "SKILLBARLVL3")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.SkillBar[3].Lvl = result;
                        }
                        if (b[0] == "SKILL0")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.SkillList[0].Lvl = result;
                        }
                        if (b[0] == "SKILL1")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.SkillList[1].Lvl = result;
                        }
                        if (b[0] == "SKILL2")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.SkillList[2].Lvl = result;
                        }
                        if (b[0] == "SKILL3")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.SkillList[3].Lvl = result;
                        }
                        if (b[0] == "SKILL4")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.SkillList[4].Lvl = result;
                        }
                        if (b[0] == "SKILL5")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.SkillList[5].Lvl = result;
                        }
                        if (b[0] == "SKILL6")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.SkillList[6].Lvl = result;
                        }
                        if (b[0] == "SKILL7")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.SkillList[7].Lvl = result;
                        }
                        if (b[0] == "SKILL8")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.SkillList[8].Lvl = result;
                        }
                        if (b[0] == "SKILL9")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.SkillList[9].Lvl = result;
                        }
                        if (b[0] == "SKILL10")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.SkillList[10].Lvl = result;
                        }
                        if (b[0] == "SKILL11")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.SkillList[11].Lvl = result;
                        }
                        if (b[0] == "SKILL12")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.SkillList[12].Lvl = result;
                        }
                        if (b[0] == "SKILL13")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.SkillList[13].Lvl = result;
                        }
                        if (b[0] == "SKILL14")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._SkillManager.SkillList[14].Lvl = result;
                        }
                        if (b[0] == "ATRIBUTOPOINTS")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer._Class.StatsPoints = result;
                        }
                        if (b[0] == "XI")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer.box.Xi = result;
                        }
                        if (b[0] == "YI")
                        {
                            int.TryParse(b[1], out int result);
                            loadPlayer.box.Yi = result;
                        }
                        for (int i = 0; i < 30 && b[0] == "SLOT" + i; i++)
                        {
                            int.TryParse(b[1], out int result);
                            int.TryParse(b[2], out int result2);
                            Slot slot = new Slot((uint)result, (uint)result2);
                            loadPlayer._Inventory.AddToBag(slot);
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Performs a JSON-to-Object conversion.
        /// </summary>
        /// <param name="reader">
        /// A JsonReader object.
        /// </param>
        /// <param name="objectType">
        /// The type of the object.
        /// </param>
        /// <param name="existingValue">
        /// The existing value.
        /// </param>
        /// <param name="serializer">
        /// A JsonSerializer object.
        /// </param>
        /// <returns>
        /// A converted object.
        /// </returns>
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            const string ITEM_TYPE_KEY     = "ItemType";
            const string ARGUMENT_EXCEPTON = "Invalid Or Missing ItemType";

            ContentItem contentItem = null;
            ItemType    itemType    = ItemType.Unknown;

            JObject jObject = JObject.Load(reader);
            JToken  jToken  = null;

            if (jObject.TryGetValue(ITEM_TYPE_KEY, StringComparison.CurrentCultureIgnoreCase, out jToken) && jToken != null && Enum.TryParse(jToken.Value <string>(), true, out itemType))
            {
                switch (itemType)
                {
                case ItemType.Unknown:
                    throw new ArgumentException(ARGUMENT_EXCEPTON);

                case ItemType.Book:
                    contentItem = new Book();
                    break;

                case ItemType.Chapter:
                    contentItem = new Chapter();
                    break;

                case ItemType.Journal:
                    contentItem = new Journal();
                    break;

                case ItemType.Magazine:
                    contentItem = new Magazine();
                    break;

                case ItemType.Newspaper:
                    contentItem = new Newspaper();
                    break;

                case ItemType.Webpage:
                    contentItem = new Webpage();
                    break;

                case ItemType.Encyclopedia:
                    contentItem = new Encyclopedia();
                    break;

                case ItemType.Graphic:
                    contentItem = new Graphic();
                    break;

                case ItemType.AudioRecording:
                    contentItem = new AudioRecording();
                    break;

                case ItemType.VideoRecording:
                    contentItem = new VideoRecording();
                    break;

                case ItemType.Broadcast:
                    contentItem = new Broadcast();
                    break;

                case ItemType.PersonalCommunication:
                    contentItem = new PersonalCommunication();
                    break;

                case ItemType.Interview:
                    contentItem = new Interview();
                    break;

                case ItemType.Presentation:
                    contentItem = new Presentation();
                    break;

                case ItemType.Map:
                    contentItem = new Map();
                    break;

                case ItemType.Bill:
                    contentItem = new Bill();
                    break;

                case ItemType.Legislation:
                    contentItem = new Legislation();
                    break;

                case ItemType.LegalCase:
                    contentItem = new LegalCase();
                    break;

                case ItemType.Report:
                    contentItem = new Report();
                    break;

                case ItemType.ConferencePaper:
                    contentItem = new ConferencePaper();
                    break;

                default:
                    throw new NotImplementedException();
                }
            }
            else
            {
                throw new ArgumentException(ARGUMENT_EXCEPTON);
            }

            if (serializer != null)
            {
                serializer.Populate(jObject.CreateReader(), contentItem);
            }
            return(contentItem);
        }
        // Decides how to search in websites based on query
        private void inputQueryToWebsites()
        {
            // Gets query for other uses.
            query = NewMessageTextBox.Text;

            // Strip query of punctuation
            query = CleanInput(query);

            // Get subject of query (topic of your knowledge base)
            if (set1.Contains(query))
            {
                if (query == kbName1)
                {
                    subject = " "; // don't add a subject if query is already subject word
                }
                else
                {
                    subject = kbName1;
                }
            }
            else if (set2.Contains(query))
            {
                if (query == kbName2)
                {
                    subject = " "; // don't add a subject if query is already subject word
                }
                else
                {
                    subject = kbName2;
                }
            }
            else if (set3.Contains(query))
            {
                if (query == kbName3)
                {
                    subject = " "; // don't add a subject if query is already subject word
                }
                else
                {
                    subject = kbName3;
                }
            }
            else // if no subject, then must be a LUIS default intent (Greeting, Cancel, Help, or None)
            {
                subject = "";
                query   = "";

                // Microsoft academic needs the root URL to render, rather than empty query/subject in URL
                MicrosoftAcademic.Navigate(new Uri("https://academic.microsoft.com/"));
            }

            // Set query into Encyclopedia, Microsoft Academics, and Bing Search
            Encyclopedia.Navigate(new Uri("https://en.wikipedia.org/wiki/" + query));
            NewsBlogs.Navigate(new Uri("https://www.bing.com/search?q=" + query + "%20" + subject + "&qs=n&form=QBRE&sp=-1&pq=" + query + "%20" + subject + "&sc=8-5&sk=&cvid=92D86BDF64C049B3AD2DC5444AB33E25"));

            if (subject != "" && query != "")
            {
                MicrosoftAcademic.Navigate(new Uri("https://academic.microsoft.com/#/search?iq=@" + query + "@&amp;q=" + query + "&filters=&from=0&sort=0"));
            }

            // Clears text for next query.
            NewMessageTextBox.Text = String.Empty;
        }
Example #20
0
 public Encyclopedia(Encyclopedia e) : base(e)
 {
     this.Subject = e.Subject;
 }
Example #21
0
 public Encyclopedia ProcessAndValidate(Encyclopedia instance, out List <Exception> exceptions, out bool shouldSuppressProcessing)
 {
     ProcessAndValidateCommon(instance, out exceptions, out shouldSuppressProcessing);
     return(instance);
 }
Example #22
0
        // Decides how to search in websites based on query
        private async void InputQueryToWebsites()
        {
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                if (query == "" || query == null)
                {
                    // Gets query for other uses.
                    query = NewMessageTextBox.Text;
                }

                // Strip query of punctuation & make lowercase
                query = CleanInput(query);

                // Get subject of query (topic of your knowledge base)
                if (set1.Contains(query))
                {
                    if (query == kbName1)
                    {
                        subject = " ";                         // don't add a subject if query is already subject word
                    }
                    else
                    {
                        subject = kbName1;
                    }
                }
                else if (set2.Contains(query))
                {
                    if (query == kbName2)
                    {
                        subject = "";                         // don't add a subject if query is already subject word
                    }
                    else
                    {
                        subject = kbName2;
                    }
                }
                else if (set3.Contains(query))
                {
                    if (query == kbName3)
                    {
                        subject = "";                         // don't add a subject if query is already subject word
                    }
                    else
                    {
                        subject = kbName3;
                    }
                }
                else                 // if no subject, then must be a LUIS default intent (Greeting, Cancel, Help, or None)
                {
                    subject = "";
                    query   = "";

                    // Sites need the root URLs to render, rather than empty query/subject in URL
                    Encyclopedia.Navigate(new Uri("https://en.wikipedia.org/"));
                    MicrosoftAcademic.Navigate(new Uri("https://academic.microsoft.com/"));
                    NewsBlogs.Navigate(new Uri("https://www.bing.com/"));
                    return;
                }

                // Set query into Encyclopedia, Microsoft Academics, and Bing Search
                Encyclopedia.Navigate(new Uri("https://en.wikipedia.org/w/index.php?search=" + query + "+" + subject + "&title=Special%3ASearch&go=Go"));
                NewsBlogs.Navigate(new Uri("https://www.bing.com/search?q=" + query + "+" + subject));
                MicrosoftAcademic.Navigate(new Uri("https://academic.microsoft.com/#/search?iq=%40" + query + "%20" + subject + "%40&q=" + query + "%20" + subject));
            });

            // Clears text for next query.
            await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                NewMessageTextBox.Text = String.Empty;
            });

            query = "";
        }
Example #23
0
        public void UseEquip(uint ID)// function that makes the equipment be equipped by the player.
        {
            Item item = Encyclopedia.encyclopedia[ID];

            if (item is Armor)
            {
                Slot arm = player._Inventory.GetSlot(ID);
                if (arm != null)
                {
                    switch ((item as Armor).PositArmor) //swtich to know where the armor is
                    {
                    case PositionArmor.Elm:
                        if (armor[0] != null)
                        {
                            DesEquip(Encyclopedia.SearchFor(armor[0]));
                        }
                        armor[0] = Encyclopedia.SearchFor(ID) as Armor;
                        player._Inventory.RemoveFromBag(ID, 1);    //equip elm
                        break;

                    case PositionArmor.Armor:
                        if (armor[1] != null)
                        {
                            DesEquip(Encyclopedia.SearchFor(armor[1]));
                        }
                        armor[1] = Encyclopedia.SearchFor(ID) as Armor;
                        player._Inventory.RemoveFromBag(ID, 1);    //equip armor
                        break;

                    case PositionArmor.Legs:
                        if (armor[2] != null)
                        {
                            DesEquip(Encyclopedia.SearchFor(armor[2]));
                        }
                        armor[2] = Encyclopedia.SearchFor(ID) as Armor;
                        player._Inventory.RemoveFromBag(ID, 1);    //equip legs
                        break;

                    case PositionArmor.Boots:
                        if (armor[3] != null)
                        {
                            DesEquip(Encyclopedia.SearchFor(armor[3]));
                        }
                        armor[3] = Encyclopedia.SearchFor(ID) as Armor;
                        player._Inventory.RemoveFromBag(ID, 1);    //equip boots
                        break;
                    }
                    //UpdateEquip();
                }
            }
            else if (item is Weapon)
            {
                Slot weap = player._Inventory.GetSlot(ID);
                if (weap != null)
                {
                    if (weapon != null)
                    {
                        DesEquip(Encyclopedia.SearchFor(weapon));
                    }
                    weapon = Encyclopedia.SearchFor(weap.ItemID) as Weapon;
                    player._Inventory.RemoveFromBag(ID, 1);// equip weapon
                    //UpdateEquip();
                }
            }
        }