In ASP.NET Core MVC it is possible to define a script section for a page like this:
@section scripts {
<script>
alert('hello');
</script>
}
Run Code Online (Sandbox Code Playgroud)
And if the the layout contains :
@RenderSection("Scripts", required: false)
Run Code Online (Sandbox Code Playgroud)
your script(s) will be rendered. This come in handy per example to guarantee that the scripts will be rendered after all javascript includes like jQuery.
But how to render a script in a partial view?
我正在使用 powershell 创建一个窗口任务,一切正常,但我找不到如何添加作者姓名。将ScheduledTask注册为描述的参数,但不适用于作者。
导出的 Windows 任务
<RegistrationInfo>
<Date>2016-05-17T16:45:54.3423362</Date>
<Author>NEED TO SET THIS</Author>
<URI>RunLauncherTask</URI>
</RegistrationInfo>
Run Code Online (Sandbox Code Playgroud)
ai 用于创建任务的代码
$principal = New-ScheduledTaskPrincipal -UserId (Get-CimInstance -ClassName Win32_ComputerSystem | Select-Object -expand UserName)
$allTasks = Get-ScheduledTask | Select TaskName
$action = New-ScheduledTaskAction -Execute "C:\Launcher.exe"
$trigger = New-ScheduledTaskTrigger -AtLogOn
$task = New-ScheduledTask -Action $action -Trigger $trigger -Principal $principal
$username = $principal.UserId
$taskName = 'RunLauncherTask' + $username.Replace('\','-')
$settings = New-ScheduledTaskSettingsSet -DontStopIfGoingOnBatteries -AllowStartIfOnBatteries
Register-ScheduledTask $taskName -Action $action -Settings $settings
Run Code Online (Sandbox Code Playgroud)
如何设置作者?
我已经在组件类型脚本文件中声明了一个枚举,它很好并且在该组件中工作得很好,但现在我想在另一个组件中使用它。
根据我读到的内容,我尝试了一些方法,但没有结果。
我可以在哪里声明全局枚举以便我可以在所有组件中使用它?
枚举示例:
enum AttendusTypeEnum {
Todo = 1,
Sent = 2,
Corrected = 3
};
Run Code Online (Sandbox Code Playgroud)
提前致谢。
.net-core ×1
angular ×1
asp.net-core ×1
asp.net-mvc ×1
c# ×1
electron ×1
enums ×1
powershell ×1
windows ×1