在C#WinForms中,获取System.Windows.Forms.WebBrowser的后向/前向历史堆栈的正确方法是什么?
我们有一台特定的Vista x64机器,在运行我们的C#WinForms应用程序时,会显示以下错误:
System.EntryPointNotFoundException:无法在DLL"ComCtl32"中找到名为"TaskDialogIndirect"的入口点.
这个相同的代码在其他Vista机器上运行良好.出于某种原因,这台特殊的Vista机器总是抛出这个例外.
我们该如何解决这个问题?
我刚开始在一个现有的中型项目上尝试使用.NET 4中的CodeContracts,我很惊讶静态检查器给出了关于以下代码段的编译时警告:
public class Foo
{
private readonly List<string> strs = new List<string>();
public void DoSomething()
{
// Compiler warning from the static checker:
// "requires unproven: source != null"
strs.Add("hello");
}
}
Run Code Online (Sandbox Code Playgroud)
为什么CodeContracts静态检查器抱怨strs.Add(...)行?strs没有可能成为null的方法,对吗?难道我做错了什么?
我想用我的 WPF 应用程序替换 Windows 7 Shell(32 位和 64 位),它应该可以作为 Shell 工作。目标是 WPF 应用程序将启动我的 Kiosk 应用程序并提供少量服务。
我的问题是
如何用我的 WPF 应用程序替换 Windows 7 Shell?
我是否必须在我的 WPF 应用程序代码或所需的注册表更改中做一些特殊的事情才能将 WPF 应用程序作为 shell 执行?
谢谢。
我正在尝试在我的机器上实例化Windows Media Player COM对象:
Guid mediaPlayerClassId = new Guid("47ac3c2f-7033-4d47-ae81-9c94e566c4cc");
Type mediaPlayerType = Type.GetTypeFromCLSID(mediaPlayerClassId);
Activator.CreateInstance(mediaPlayerType); // <-- this line throws
Run Code Online (Sandbox Code Playgroud)
执行最后一行时,我收到以下错误:
System.IO.FileNotFoundException was caught
Message="Retrieving the COM class factory for component with CLSID {47AC3C2F-7033-4D47-AE81-9C94E566C4CC} failed due to the following error: 80070002."
Source="mscorlib"
StackTrace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at MyStuff.PreviewFile(String filePath) in F:\Trunk\PreviewHandlerHosting\PreviewHandlerHost.cs:line …Run Code Online (Sandbox Code Playgroud) 如何将类类型传递给C#中的函数?
当我进入db4o和C#时,我在阅读教程后编写了以下函数:
public static void PrintAllPilots("CLASS HERE", string pathToDb)
{
IObjectContainer db = Db4oFactory.OpenFile(pathToDb);
IObjectSet result = db.QueryByExample(typeof("CLASS HERE"));
db.Close();
ListResult(result);
}
Run Code Online (Sandbox Code Playgroud) 当涉及到表达树时,我是新手,所以我不确定如何提出这个问题或使用什么术语.这是我正在尝试做的过于简化的版本:
Bar bar = new Bar();
Zap(() => bar.Foo);
public static void Zap<T>(Expression<Func<T>> source)
{
// HELP HERE:
// I want to get the bar instance and call bar.Zim() or some other method.
}
Run Code Online (Sandbox Code Playgroud)
如何在Zap方法中使用bar?
您好我需要构建动态表,其中包含来自数组的列(标题)和来自其他数组的行,数组中的第一列必须是静态的.
<table>
<thead>
<tr>
<th>Static</th>
<th>Dynamic 1</th>
<th>Dynamic 2</th>
<th>Dynamic 3</th>
</tr>
</thead>
<tbody>
<tr>
<th>Nam1</th>
<th>value</th>
<th>value</th>
<th>value</th>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
我有下一个Knockout HTML模型allRoles这是带有动态标头的数组
<table>
<thead>
<tr data-bind="template: { name: 'tableHeader', foreach: allRoles, as: 'role',afterRender: addFirstColumn } ">
</tr>
</thead>
<tbody data-bind="foreach: {data: userRoles,as:'dep'}">
<tr>
<td>
<span data-bind="text: dep.name"></span>
</td>
<td data-bind="foreach: {data: dep.roles, as: 'role'}">
<span data-bind="text: role.id"></span>
</td>
</tr>
</tbody>
</table>
<script type="text/html" id="tableHeader">
<th data-bind="text: role.name">
</th>
</script>
Run Code Online (Sandbox Code Playgroud)
我怎么能添加静态?
在 Web 开发方面(虽然不是一般的编程),我主要是新手,所以请原谅任何不正确的术语。
我想构建一个脚本,当添加到 HTML 页面时,检测页面中的每个希伯来语单词并将该单词转换为 HTML 元素,例如转换为带有标题的超链接。
因此,以下内容:
<p>??? ?????</p>
Run Code Online (Sandbox Code Playgroud)
转化为:
<p><a title="word 1" href="#">?????</a> <a title="word 2" href="#">???</a></p>
Run Code Online (Sandbox Code Playgroud)
有道理?
因此,我认为首要任务是检测页面中的希伯来语单词。我该怎么做呢?除了浏览 jQuery 文档之外,我不知道从哪里开始。
我们遇到了Lucene.NET 2.3代码库的严重错误.我们正在升级到Lucene 2.9,希望修复bug.
升级到最新版本,我们看到MultiFieldQueryParser构造函数是[已废弃]:
[Obsolete("Use the ctor with Version param instead.")]
public MultiFieldQueryParser(string[] fields, Analyzer analyzer)
Run Code Online (Sandbox Code Playgroud)
相反,我们将使用带有Version参数的构造函数:
public MultiFieldQueryParser(Version version, string[] fields, Analyzer analyzer)
Run Code Online (Sandbox Code Playgroud)
问题是,我找不到任何关于版本参数是什么,它应该是什么,我应该在这里传递的文档.
任何人都可以对此有所启发吗?
c# ×6
.net ×2
javascript ×2
com ×1
com-interop ×1
db4o ×1
dom ×1
function ×1
hebrew ×1
interop ×1
knockout.js ×1
lambda ×1
lucene ×1
lucene.net ×1
navigation ×1
pinvoke ×1
shell ×1
winapi ×1
windows ×1
windows-7 ×1
winforms ×1
wpf ×1