コード例 #1
0
ファイル: DialogItems.cs プロジェクト: atariVCS/scriptex
        private void btnSearch_Click(object sender, EventArgs e)
        {
            foundItems.Clear();
            foundItems    = allItems.FindAll(x => x.ToString().StartsWith(txtSearchtext.Text, StringComparison.InvariantCultureIgnoreCase));
            selectedItem  = null;
            selectedItems = null;

            clbSelection.Items.Clear();

            if (foundItems != null && foundItems.Any())
            {
                foreach (ModelClasses.Item foundItem in foundItems)
                {
                    clbSelection.Items.Add(foundItem);
                }
            }
        }
コード例 #2
0
ファイル: DialogItems.cs プロジェクト: atariVCS/scriptex
        private void LoadItems()
        {
            FileStream fsFaction = null;
            FileStream fsItems   = null;

            selectedItem  = null;
            selectedItems = null;

            try
            {
                XmlSerializer factionSerializer = new XmlSerializer(typeof(ModelClasses.Factions));
                fsFaction = new FileStream(factionsFile, FileMode.Open);
                factions  = (ModelClasses.Factions)factionSerializer.Deserialize(fsFaction);
                fsFaction.Close();
            }
            catch (Exception excp)
            {
                if (fsFaction != null)
                {
                    fsFaction.Dispose();
                }
            }

            try
            {
                foundItems.Clear();
                XmlSerializer itemsSerializer = new XmlSerializer(typeof(ModelClasses.Items));
                fsItems  = new FileStream(itemsFile, FileMode.Open);
                allItems = (ModelClasses.Items)itemsSerializer.Deserialize(fsItems);
                fsItems.Close();

                foreach (ModelClasses.Item item in allItems)
                {
                    foundItems.Add(item);
                }
            }
            catch (Exception excp)
            {
                if (fsItems != null)
                {
                    fsItems.Dispose();
                }
            }
        }
コード例 #3
0
ファイル: DialogMinis.cs プロジェクト: atariVCS/scriptex
        private void LoadWargear()
        {
            FileStream fs = null;

            try
            {
                XmlSerializer serializer = new XmlSerializer(typeof(ModelClasses.Items));
                fs         = new FileStream(itemsFile, FileMode.Open);
                allWargear = (ModelClasses.Items)serializer.Deserialize(fs);
                fs.Close();
            }
            catch (Exception excp)
            {
                if (fs != null)
                {
                    fs.Dispose();
                }
            }
        }