添加项目文件。
This commit is contained in:
35
QuickModeling/README.md
Normal file
35
QuickModeling/README.md
Normal file
@@ -0,0 +1,35 @@
|
||||
```csharp
|
||||
//在命令中调用
|
||||
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
|
||||
try
|
||||
{
|
||||
|
||||
ConfigurationPropsAttachView attachView = new ConfigurationPropsAttachView();
|
||||
//让窗口始终在应用程序顶部
|
||||
attachView.Owner = Application.Current.MainWindow;
|
||||
attachView.DataContext = new ConfigurationPropsAttachViewModel();
|
||||
attachView.Show();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve;
|
||||
}
|
||||
```
|
||||
|
||||
```csharp
|
||||
//解决程序集加载问题
|
||||
private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
|
||||
{
|
||||
var assemblyName = new AssemblyName(args.Name).Name;
|
||||
var assemblyPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), $"{assemblyName}.dll");
|
||||
if (File.Exists(assemblyPath))
|
||||
{
|
||||
return Assembly.LoadFrom(assemblyPath);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user