Wrapping an Unmanaged C++ Class Library with C++/CLI

Note: This post represents Question #2 of my inquiry. The introduction block (all text until the numbers are reached) is repeated in both questions as it is background information that may be needed to answer the question. Introduction to Question I have an unmanaged C++ library that contains classes and functions that are common to and shared among several "higher level" libraries

用C ++ / CLI包装非托管C ++类库

注意:这篇文章代表了我询问的问题#2。 在两个问题中重复介绍块(所有文本直到达到数字),因为它是可能需要回答问题的背景信息。 问题介绍 我有一个非托管的C ++库,其中包含通用的类和函数,并在多个“更高级别”库中共享。 我现在需要提供对C#/ .Net应用程序的公共库。 为此,我将不得不使用C ++ / CLI包装类来包装公共库。 公共库中包含的类可以是包含嵌套类定义和其他类对象集合的成员变量的复杂类。 集合变量是

OpenXML SDK: Make Excel recalculate formula

I update some cells of an Excel spreadsheet through the Microsoft Office OpenXML SDK 2.0. Changing the values makes all cells containing formula that depend on the changed cells invalid. However, due to the cached values Excel does not recalculate the formular, even if the user clicks on "Calculate now". What is the best way to invalidate all dependent cells of the whole workbook th

OpenXML SDK:使Excel重新计算公式

我通过Microsoft Office OpenXML SDK 2.0更新Excel电子表格的某些单元格。 更改值会使包含取决于已更改单元格的公式的所有单元无效。 但是,由于缓存的值,Excel不会重新计算公式,即使用户单击“立即计算”。 通过SDK使整个工作簿的所有相关单元无效的最佳方法是什么? 到目前为止,我在http://cdonner.com/introduction-to-microsofts-open-xml-format-sdk-20-with-a-focus-on-excel-documents.htm上找到了以下代码片段: p

Not supported any more?

I've been trying to get some custom authentication code for my WCF service and found that one way to this would be through a RequestInterceptor in the REST Starter Kit. However, since the article was published, it seems that Microsoft has done some internal refactoring and Microsoft.ServiceModels.Web was moved to System.ServiceModels.Web. This namespace does not have a RequestInterceptor cl

不再支持?

我一直在尝试为我的WCF服务获取一些自定义身份验证代码,并发现通过REST入门工具包中的RequestInterceptor可以实现这一点。 但是,自文章发布以来,似乎微软已经完成了一些内部重构,而Microsoft.ServiceModels.Web已移至System.ServiceModels.Web。 该命名空间中没有RequestInterceptor类,我无法在文档中找到对它的任何引用。 有谁知道最好的做法是做什么? 我需要为我的API的一部分添加认证/授权。 谢谢, Teja公司

Overlay WriteableBitmap with color

I'm trying to overlay a WriteableBitmap with a certain color in Silverlight. I have a black and white base image, which I'm using to create smaller WriteableBitmap images for a new composite image and I want to overlay either the black or white part of the source image cut-out with a certain color before adding it to the composite image. What I'm doing now is: var cutOut = new Wri

用颜色覆盖WriteableBitmap

我试图在Silverlight中使用某种颜色覆盖WriteableBitmap。 我有一个黑色和白色的基本图像,我正在使用它为一个新的合成图像创建较小的WriteableBitmap图像,并且我希望在将其添加到某个颜色之前用某种颜色覆盖源图像的黑色或白色部分复合图像。 我现在在做的是: var cutOut = new WriteableBitmap(8, 14); /* cut out the image here */ cutOut.Render(sourceImage, transform); // sourceImage is the base image cutOu

ReportViewer 2010, IO.Exception\

I have an issue which I have concluded it is machine specific based, however I would like to know, how can solve it in case it comes up in another machine. I have developed I WPF project (.NET 4) , which I install using Installshield LE . prerequisites for the program is also ReportViewer 2010, which I install prior (if needed). I have made installations of the program to following machines:

ReportViewer 2010,IO.Exception \

我有一个问题,我认为它是基于机器的,但是我想知道,如果它在另一台机器上出现,怎么解决它。 我开发了我使用Installshield LE安装的WPF项目(.NET 4) 。 该计划的先决条件也是ReportViewer 2010,我之前安装(如果需要)。 我已经将该程序安装到以下机器上: Windows 7 64位SP1 Windows 7 32位 Windows XP SP3(案例1) Windows XP SP3(案例2) Windows XP SP3(案例3) 在所有上述机器中,我的报告运行良好

modal WPF dialog hosted in a Win32 app doesn't receive keyboard events

I've got a WPF dialog that I want to display in a Win32 app as a non-modal Window. Calling window.Show() correctly displays the window, and all mouse events are handled properly by it, but all keyboard event are handled by the parent Win32 window, so that even if a user has given focus to a textbox, any typed text shows up in the parent Win32 window! This seems to be a known problem in Win

在Win32应用程序中托管的模态WPF对话框不会收到键盘事件

我有一个WPF对话框,我想在Win32应用程序中显示为非模态窗口。 调用window.Show()可以正确显示窗口,并且所有的鼠标事件都可以正确处理,但是所有的键盘事件都是由父Win32窗口处理的,所以即使用户已经将焦点放到了文本框中,任何输入的文本也会显示在父Win32窗口中启动! 这似乎是WinForms / WPF互操作中的一个已知问题,并且在显示对话框之前通过调用ElementHost.EnableModelessKeyboardInterop进行修复。 这会导致将新

Can code contracts replace parameter validation?

Another guy asked a similar question but the answer isn't clear to me. We have a lot of parameter validation code in our project. They are mostly null parameter checks in public methods only: if (param == null) { throw new ArgumentNullException("param"); } Those checks aren't part of specification. Their main utility is to get saner stack dumps in case of a programming error. If

代码合同可以取代参数验证吗?

另一个人问了类似的问题,但答案并不明确。 我们的项目中有很多参数验证代码。 它们大多只在公共方法中为空参数检查: if (param == null) { throw new ArgumentNullException("param"); } 这些检查不是规范的一部分。 它们的主要用途是在编程错误的情况下获得更安全的堆栈转储。 如果这样一个简单的检查没有完成,你可以在一个其他库的中间随机选择一个NullReferenceException ,在栈中深入十个层次。 这使整个回溯到

childs save redundant sql update executed

I'm trying to save (insert) parent object with a collection of child objects, all objects are new. I prefer to manually specify what to saveupdate and when so I do not use any cascade saves in mappings and flush sessions by myself. So basically I save this object graph like: session.Save(Parent) foreach (var child in Parent.Childs) { session.Save(child); } session.Flush() I expect this c

childs保存执行的冗余sql更新

我试图用一组子对象保存(插入)父对象,所有对象都是新的。 我更喜欢手动指定保存 update的内容,并且在我自己的映射和刷新会话中不使用任何级联保存。 所以基本上我保存这个对象图如: session.Save(Parent) foreach (var child in Parent.Childs) { session.Save(child); } session.Flush() 我期望这段代码插入Parent行,然后插入每个子行,然而NHibernate执行这个SQL: INSERT INTO PARENT.... INSERT INTO CHILD ....

NHibernate ISession Flush: Where and when to use it, and why?

One of the things that get me thoroughly confused is the use of session.Flush ,in conjunction with session.Commit , and session.Close . Sometimes session.Close works, eg, it commits all the changes that I need. I know I need to use commit when I have a transaction, or a unit of work with several creates/updates/deletes, so that I can choose to rollback if an error occurs. But sometimes I rea

NHibernate ISession刷新:何时何地使用它,为什么?

让我彻底困惑的一件事是使用session.Flush ,与session.Commit和session.Close一起使用。 有时session.Close可以工作,例如,它会提交我需要的所有更改。 我知道当我有一个事务时需要使用提交,或者有多个创建/更新/删除的工作单元,以便在发生错误时选择回滚。 但有时我真的被session.Flush背后的逻辑所session.Flush 。 session.Flush 。 我已经看到你有一个session.SaveOrUpdate()例子session.SaveOrUpdate()后跟一个刷

Turn on MvcBuildViews using TeamCity if a view is changed

Scenario We have TeamCity 8.1.3 building every pull request. Build failures are reported in GitHub. This is great. However view errors are not picked up. This is bad. I could turn on MvcBuildViews across the board but I'd rather not as our solution is quite large and it roughly triples compile time. What I'd like to do is enable MvcBuildViews only if a view has been changed in a

如果视图更改,则使用TeamCity打开MvcBuildViews

脚本 我们有TeamCity 8.1.3构建每个拉取请求。 构建失败在GitHub中报告。 这很棒。 然而,视图错误不会被拾取。 这不好。 我可以在整个开发板上打开MvcBuildViews,但我宁愿不这样做,因为我们的解决方案非常庞大,并且大约可以缩短三倍编译时间。 我只想在PR中的提交中更改视图时启用MvcBuildViews。 例如,如果有人更改.cs文件,然后正常编译。 如果一个.cshtml文件被改变,启用MvcBuildViews并编译。 我试过的