コード例 #1
0
        public static T GetEntry <T>(Window owner, IMEPackage pcc, string directionsText = null, Predicate <T> predicate = null) where T : class, IEntry
        {
            SupportedTypes supportedInputTypes = SupportedTypes.ExportsAndImports;

            if (typeof(T) == typeof(ExportEntry))
            {
                supportedInputTypes = SupportedTypes.Exports;
            }
            else if (typeof(T) == typeof(ImportEntry))
            {
                supportedInputTypes = SupportedTypes.Imports;
            }

            Predicate <IEntry> entryPredicate = null;

            if (predicate != null)
            {
                entryPredicate = entry => predicate((T)entry);
            }
            using var dlg = new EntrySelector(owner, pcc, supportedInputTypes, directionsText, entryPredicate);
            if (dlg.ShowDialog() == true)
            {
                return(dlg.ChosenEntry as T);
            }

            return(null);
        }
コード例 #2
0
        public static IEntry GetEntry(Window owner, IMEPackage pcc, SupportedTypes supportedInputTypes, string directionsText = null)
        {
            var dlg = new EntrySelector(owner, pcc, supportedInputTypes, directionsText);

            return(dlg.ShowDialog() == true ? dlg.ChosenEntry : null);
        }