コード例 #1
0
ファイル: ObjectChooser.cs プロジェクト: dd-dk/sims3tools
        public static ObjectChooser CreateObjectChooser(MainForm.DoWaitCallback doWaitCB, MainForm.StopWaitCallback stopWaitCB,
            MainForm.updateProgressCallback updateProgressCB, MainForm.listViewAddCallBack listViewAddCB, CatalogType resourceType,
            EventHandler<MainForm.SelectedIndexChangedEventArgs> selectedIndexChangedHandler,
            EventHandler<MainForm.ItemActivateEventArgs> itemActivateHandler)
        {
            ObjectChooser res;
            if (!objectChooserCache.ContainsKey(resourceType))
            {
                res = new ObjectChooser(doWaitCB, stopWaitCB, updateProgressCB, listViewAddCB, resourceType);
                res.SelectedIndexChanged += selectedIndexChangedHandler;
                res.ItemActivate += itemActivateHandler;
                return res;
            }

            res = objectChooserCache[resourceType];
            res.SelectedIndexChanged = null;
            res.SelectedItem = null;
            res.listView1.SelectedItems.Clear();
            res.SelectedIndexChanged += selectedIndexChangedHandler;

            res.ItemActivate = null;
            res.ItemActivate += itemActivateHandler;

            return res;
        }
コード例 #2
0
        public static ObjectChooser CreateObjectChooser(MainForm.DoWaitCallback doWaitCB, MainForm.StopWaitCallback stopWaitCB,
                                                        MainForm.updateProgressCallback updateProgressCB, MainForm.listViewAddCallBack listViewAddCB, CatalogType resourceType,
                                                        EventHandler <MainForm.SelectedIndexChangedEventArgs> selectedIndexChangedHandler,
                                                        EventHandler <MainForm.ItemActivateEventArgs> itemActivateHandler)
        {
            ObjectChooser res;

            if (!objectChooserCache.ContainsKey(resourceType))
            {
                res = new ObjectChooser(doWaitCB, stopWaitCB, updateProgressCB, listViewAddCB, resourceType);
                res.SelectedIndexChanged += selectedIndexChangedHandler;
                res.ItemActivate         += itemActivateHandler;
                return(res);
            }

            res = objectChooserCache[resourceType];
            res.SelectedIndexChanged = null;
            res.SelectedItem         = null;
            res.listView1.SelectedItems.Clear();
            res.SelectedIndexChanged += selectedIndexChangedHandler;

            res.ItemActivate  = null;
            res.ItemActivate += itemActivateHandler;

            return(res);
        }