首页 \ 问答 \ 关闭PowerState S4(Shutting down to PowerState S4)

关闭PowerState S4(Shutting down to PowerState S4)

我需要从我的WPF应用程序关闭,并确保机器进入与使用传统的Windows关闭对话框相同的电源状态。

我可以使用以下命令关闭到未知电源状态:

Process.Start("shutdown", "/s /t 0");

问题是使用此关闭过程,当通过按下电源按钮启动备份时,psu消耗的电流小于100毫安(通常在80和85之间),而使用对话框关闭后消耗的约为300毫安。

默认情况下,在Windows 8中使用“关闭”对话框关闭,根据系统电源状态枚举为S4。

我想关闭到相同的S4状态,而不强迫用户进行其他操作,单击“确定”关闭对话框等。

注意:

我可以通过运行以下VBScript来调用对话框,但是不想采用这种方法:

呼叫

Process.Start(@"C:\PathToScript\Shutdown.vbs");

VB脚本

dim objShell
set objShell = CreateObject("shell.application")
objshell.ShutdownWindows
set objShell = nothing

I need to shut down from my WPF application, and ensure the machine enters the same power state as using the traditional windows shutdown dialog.

I can shutdown to an unknown power state by using the following:

Process.Start("shutdown", "/s /t 0");

The problem is that using this shutdown process, when booting back up by pressing the power button, the psu draws less than 100 milliamps (usually between 80 and 85), as opposed to the ~300 milliamps drawn after using the dialog to shutdown.

Using the Shutdown dialog to shutdown, by default in windows 8, according the the System Power States enumeration is S4.

I would like to shutdown to that same S4 state, without forcing the user to make additional actions, clicking "ok" to shutdown on the dialog, etc.

Note:

I can call the dialog, by running the following VBScript, but would prefer not to take this route:

Call

Process.Start(@"C:\PathToScript\Shutdown.vbs");

VB Script

dim objShell
set objShell = CreateObject("shell.application")
objshell.ShutdownWindows
set objShell = nothing

原文:https://stackoverflow.com/questions/22081297
更新时间:2024-03-15 17:03

最满意答案

我猜测两种距离的节目的结果是不同的。 事实上,在欧几里得距离中,最接近的一对是(4,2)-(5,3)而在曼哈顿距离的情况下, (2,2)-(4,2)(4,2)-(5,3)是最接近的对。 根据你的程序,你只能按照外观顺序选取第一个,结果是(2,2)-(4,2) 。 如果你的程序会返回所有最接近的对,你会看到(4,2)-(5,3)

但总的来说,两个计划的结果没有任何理由相同。 例如,在您的示例中,将(5,3)更改为(5,3.1) 。 要具体了解这两个距离有多不同,可以使用规范来绘制“单位圆”,您会发现曼哈顿圆比方圆更平方。


I guess that the outcome of programs with both distances are different. Indeed, with the euclidian distance, the closest pair is (4,2)-(5,3) while with the Manhattan distance, both (2,2)-(4,2) and (4,2)-(5,3) are closest pairs. Given your program, you only pick up the first one in the order of appearance, and the outcome is (2,2)-(4,2). If your program would return all closest pairs, you would have seen (4,2)-(5,3).

But generally speaking, there is no reason for the outcome of both programs to be the same. For example, in your example, change (5,3) to (5,3.1). To have a concrete idea of how different both distances are, it may useful for you to plot the "unit circle" using for norms and you will see that the Manhattan circle is more square than round.

相关问答

更多
  • 如果中位数给出了10 ^ 9量级的间隔,则该间隔中的每个点都与其他任何点一样好。 因此,根据您稍后想要对这些点执行的操作,您可以返回范围或枚举该范围内的点。 没有办法绕过它.. 很显然,在两个维度中,你将得到一个Bouding矩形,三维的边界长方体等。 结果将始终是针对每个维度获得的范围的笛卡尔积,因此您可以返回这些范围的列表作为结果。 If the median gives you an interval of the order of 10^9 then each point in that inter ...
  • 我不认为我们可以在这里利用基于BLAS的矩阵乘法,因为这里没有涉及元素乘法。 但是,我们没有其他选择。 方法#1 我们可以使用具有曼哈顿距离的Scipy的cdist ,其可选的度量参数设置为'cityblock' - from scipy.spatial.distance import cdist out = cdist(A, B, metric='cityblock') 方法#2 - A. 我们也可以利用broadcasting ,但内存需求更多 - np.abs(A[:,None] - B).sum ...
  • 曼哈顿距离很少有用; 它主要是为了完整性。 如果您的评级实际上是离散值(如计数),并且它与编辑距离有一定关系,那么它可能很有用,因此如果项目是...字符串可能会有用。 但这可能不是推荐人的真实用例。 Manhattan distance is rarely useful; it's there mostly for completeness. It might be useful in cases where your ratings are really discrete values like coun ...
  • 你需要使用你的问题的距离,即1和0.5在你的情况。 当使用A *时,从起始点到当前节点的距离将是沿着到该点的实际路径的1秒和0.5秒的总和,并且估计到最后的剩余距离将是1秒和0.5秒之和'完美的路径',即没有障碍。 我希望能回答你的问题。 You need to use the distance of your problem, i.e. 1 and 0.5 in your case. When using A*, the distance from the start to the current nod ...
  • 第一个假设边界不能缠绕。 第二个假设是,如果你走到右边缘的右边,你会到达左边缘。 我不知道第三个人与曼哈顿距离有什么关系。 对你来说正确的那个取决于你想要解决的问题。 The first one is assuming that the borders cannot be wrapped around. The second is assuming that if you go to the right of the right edge, you get to the left edge. I have ...
  • 我猜测两种距离的节目的结果是不同的。 事实上,在欧几里得距离中,最接近的一对是(4,2)-(5,3)而在曼哈顿距离的情况下, (2,2)-(4,2)和(4,2)-(5,3)是最接近的对。 根据你的程序,你只能按照外观顺序选取第一个,结果是(2,2)-(4,2) 。 如果你的程序会返回所有最接近的对,你会看到(4,2)-(5,3) 。 但总的来说,两个计划的结果没有任何理由相同。 例如,在您的示例中,将(5,3)更改为(5,3.1) 。 要具体了解这两个距离有多不同,可以使用规范来绘制“单位圆”,您会发现曼哈 ...
  • 对于L左侧的每个点,右侧最多有6个点,距离小于d。 这6个点可以位于两个方位的六个角落。 再一次,可以找到距离小于d的一对。 然后用y坐标对L右侧的点进行排序。 找到在y轴上最接近P的6个点,这可能产生更近的距离。 For each point in the left part of L, there are at most 6 points in the right with which the distance is less than d. These 6 points can be position ...
  • 如果K不够大并且你需要找到一个整数坐标的点,你应该这样做,如另一个答案建议的那样 - 使用BFS计算网格上所有点的最小距离,一次从所有给定点开始。 更快的解决方案,对于大K,并且可能是唯一能够找到具有浮点坐标的点的解决方案,如下所示。 它的复杂度为O(n log n log k) 使用二分法搜索得到的最大距离。 您必须检查方形[0,k] X [0,k]内是否有任何点,它至少与给定集合中的所有点保持距离。 假设,你可以检查到任何距离足够快。 很明显,如果某个距离R存在这样的点,则所有较小距离r
  • 给定一个p1在(x1, y1)和p2在(x2, y2)的平面,它是,计算曼哈顿距离的公式是|x1 - x2| + |y1 - y2| |x1 - x2| + |y1 - y2| 。 (即纬度和经度之间的差异)。 所以,在你的情况下,它将是: |126.978 - 126.973| + |37.5613 - 37.5776| = 0.0213 编辑:正如你所说,这将给我们纬度 - 经度单位的差异。 基于此网页 ,我认为您必须将其转换为公制系统。 我没试过,所以我不知道它是否正确: 首先,我们得到纬度差异: ...
  • 您已经发布了正确工作的实现 closerPair ((x,y),(x1,y1)) ((x2,y2),(x3,y3)) | distance (x,y) (x1,y1) > distance (x2,y2) (x3,y3) = ((x2,y2),(x3,y3)) | otherwise = ((x,y),(x1,y1)) 但请注意,没有理由在这里实际模式匹配Point -coordinates:你只是放回x1,y1和x2,y2 ......无论如何。 因此,为什么不把它写成 closerPair ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)