示例#1
0
        private void updateModStoreItems()
        {
            List <ModStoreItem> itemsToUpdate = new List <ModStoreItem>();

            //For each installed item find the matching repo entry
            foreach (var item in config.InstalledItems)
            {
                ModStoreItem storeItem = null;
                foreach (var rItem in config.AvailableItems)
                {
                    if (rItem.Id == item.Id)
                    {
                        storeItem = rItem;
                        break;
                    }
                }
                if (storeItem != null && storeItem.Version != item.Version)
                {
                    itemsToUpdate.Add(storeItem);
                }
            }
            if (itemsToUpdate.Count != 0)
            {
                var updateMsgBox = MessageBox.Show("Do you want to update all out of date mod store items?", "Update Items", MessageBoxButtons.YesNo);
                if (updateMsgBox == DialogResult.Yes)
                {
                    for (int i = 0; i < itemsToUpdate.Count; ++i)
                    {
                        config.DownloadItem(itemsToUpdate[i]);
                    }
                    MessageBox.Show(this, "Finished updating items.");
                }
            }
        }
示例#2
0
 private void moduleListView_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (moduleListView.SelectedItems.Count != 0 && currentItem != moduleListView.SelectedItems[0].Tag)
     {
         currentItem = (ModStoreItem)moduleListView.SelectedItems[0].Tag;
         loadModuleDescription();
     }
 }
示例#3
0
        private void moduleListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            int index = moduleListBox.SelectedIndex;

            if (index != -1)
            {
                if (currentItem != itemList[index])
                {
                    currentItem = itemList[index];
                    loadModuleDescription();
                }
            }
            else
            {
                currentItem = null;
            }
        }
示例#4
0
        private void loadModuleList()
        {
            currentItem = null;
            moduleListView.Groups.Clear();
            moduleListView.Items.Clear();
            moduleListView.Sorting = (manager.SortAlphabetically) ? SortOrder.Ascending : SortOrder.None;
            switch (Category)
            {
            case "game":
                foreach (var item in manager.AvailableItems)
                {
                    if (item is ModStoreGame)
                    {
                        var i = new ListViewItem(item.Name);
                        i.Tag = item;
                        moduleListView.Items.Add(i);
                    }
                }
                moduleDownloadInstallButton.Enabled = false;
                moduleDownloadInstallButton.Visible = false;
                break;

            case "retroarch_cores":
                //Store System Groups
                var systems = new Dictionary <string, ListViewGroup>();

                //Create list item for each core and assign core to system group
                foreach (var item in manager.AvailableItems)
                {
                    if (item is RACoreModule)
                    {
                        var i = new ListViewItem(item.Name);
                        i.Tag = item;

                        //Create system group, if it doesn't exist
                        string System = ((RACoreModule)item).System;
                        if (!systems.ContainsKey(System))
                        {
                            systems[System] = new ListViewGroup(System);
                        }

                        i.Group = systems[System];
                    }
                }

                //Sort System Groups by name
                var systemNames = new string[systems.Count];
                systems.Keys.CopyTo(systemNames, 0);
                Array.Sort(systemNames);

                //Add each group and its items to the listview
                foreach (var key in systemNames)
                {
                    var group = systems[key];
                    if (manager.SortAlphabetically && group.Items.Count > 1)
                    {
                        //Sort items as array then add back to group
                        var items = new ListViewItem[group.Items.Count];
                        group.Items.CopyTo(items, 0);
                        group.Items.Clear();
                        Array.Sort(items, (ListViewItem a, ListViewItem b) => { return(a.Text.CompareTo(b.Text)); });
                        group.Items.AddRange(items);
                    }
                    moduleListView.Items.AddRange(group.Items);
                    moduleListView.Groups.Add(group);
                }
                break;

            default:
                foreach (var item in manager.AvailableItems)
                {
                    if (item is Module && (item as Module).Categories.Contains(Category))
                    {
                        var i = new ListViewItem(item.Name);
                        i.Tag = item;
                        moduleListView.Items.Add(i);
                    }
                }
                break;
            }

            if (moduleListView.Groups.Count != 0 && moduleListView.Items.Count != 0)
            {
                moduleListView.Groups[0].Items[0].Selected = true;
            }
            else if (moduleListView.Items.Count != 0)
            {
                moduleListView.Items[0].Selected = true;
            }
            moduleListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
        }