Esempio n. 1
0
        /// <summary>
        /// 选择 Dll 路径
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnSelectDll_OnClick(object sender, RoutedEventArgs e)
        {
            var dllPathRefer = new DllPathRefer(dllPathSelTreeView =>
            {
                DllPath   = dllPathSelTreeView.FullPath.Remove(0, Config.DevPlatformPath.Length);
                var types = Assembly.LoadFile(dllPathSelTreeView.FullPath).GetTypes();

                var id   = 1;
                var list = types.Select(a =>
                {
                    var dllEntry = new DgDllEntryClass {
                        Id = id++, FullName = a.FullName
                    };
                    dllEntry.CheckChanged += DllEntry_CheckChanged;
                    return(dllEntry);
                }).ToList();

                DataGridMain.ItemsSource = list;
            })
            {
                Owner = _metroWindow
            };

            dllPathRefer.ShowDialog();
        }
        private void BtnSelectDll_OnClick(object sender, RoutedEventArgs e)
        {
            var dllPathRefer = new DllPathRefer(dllPathSelTreeView =>
            {
                _bannerManagerViewModel.DllPath = dllPathSelTreeView.FullPath.Remove(0, Config.DevPlatformPath.Length);
                var types = Assembly.LoadFile(dllPathSelTreeView.FullPath).GetTypes();

                var id = 1;
                types.ForEach(a =>
                {
                    var dllEntry = new DgDllEntryClass {
                        Id = id++, FullName = a.FullName
                    };
                    dllEntry.CheckChanged += DllEntry_CheckChanged;
                    _bannerManagerViewModel.DgDllEntries.Add(dllEntry);
                });
            })
            {
                Owner = _metroWindow
            };

            dllPathRefer.ShowDialog();
        }