interop

How can I get the outlook contact's avatar image?

倾然丶 夕夏残阳落幕 提交于 2019-12-22 09:13:30
问题 I am trying to get the contact's avatar image. using Microsoft.Office.Interop.Outlook; public sealed class OutlookAvatarFetcher { private static void FetchAvatars() { var outlook = new Application(); var folder = outlook.GetNamespace("MAPI").GetDefaultFolder(OlDefaultFolders.olFolderContacts); var items = folder.Items; for (var i = 0; i < items.Count; ++i) { var contact = items[i + 1] as ContactItem; if (contact == null) continue; if (contact.HasPicture) { // TODO store the picture somehow. }

How to call Mono for Android class from within Android application?

这一生的挚爱 提交于 2019-12-22 08:10:41
问题 I have created a fairly simple Activity in Mono for Android project: [Activity(Label = "AndroidApplication1", MainLauncher = true, Icon = "@drawable/icon")] public class Activity1 : Activity { private string value = "intitial"; [Export] public string GetString() { return value; } [Export] public void SetString(string newValue) { value = newValue; } } The activity should only serve as a proof-of-concept, hence its simplicity. Now, I'd like to be able to call the method GetString() from the

How to call Mono for Android class from within Android application?

可紊 提交于 2019-12-22 08:09:04
问题 I have created a fairly simple Activity in Mono for Android project: [Activity(Label = "AndroidApplication1", MainLauncher = true, Icon = "@drawable/icon")] public class Activity1 : Activity { private string value = "intitial"; [Export] public string GetString() { return value; } [Export] public void SetString(string newValue) { value = newValue; } } The activity should only serve as a proof-of-concept, hence its simplicity. Now, I'd like to be able to call the method GetString() from the

Keep session in subsequent Java calls to Play 2.0's fakeRequest

我怕爱的太早我们不能终老 提交于 2019-12-22 06:53:16
问题 I'm looking for a way to preserve the session when using Play 2.0's fakeRequest in my Java tests, but my attempts fail while invoking methods in the Scala-based JARs. Based on a pull request mentioned in the Scala question Add values to Session during testing (FakeRequest, FakeApplication), I figured the following might work in Java: public Session getSession(Result result) { play.api.mvc.Cookies scalaCookies = play.api.test.Helpers.cookies(result.getWrappedResult()); play.api.mvc.Cookie

How to properly clean up interop objects in C#

元气小坏坏 提交于 2019-12-22 06:24:59
问题 This is a follow on question to How to properly clean up excel interop objects in c#. The gyst is that using a chaining calls together (eg. ExcelObject.Foo.Bar() ) within the Excel namespace prevents garbage collection for COM objects. Instead, one should explicitly create a reference to each COM object used, and explicitly release them using Marhsal.ReleaseComObject(). Is the behaviour of not releasing COM objects after a chained call specific to Excel COM objects only? Is it overkill to

How to properly clean up interop objects in C#

淺唱寂寞╮ 提交于 2019-12-22 06:24:39
问题 This is a follow on question to How to properly clean up excel interop objects in c#. The gyst is that using a chaining calls together (eg. ExcelObject.Foo.Bar() ) within the Excel namespace prevents garbage collection for COM objects. Instead, one should explicitly create a reference to each COM object used, and explicitly release them using Marhsal.ReleaseComObject(). Is the behaviour of not releasing COM objects after a chained call specific to Excel COM objects only? Is it overkill to

What is the actual function of the C# project setting “Allow unsafe code”

情到浓时终转凉″ 提交于 2019-12-22 05:51:16
问题 I was wondering if the C# project setting "Allow unsafe code" applies only to unsafe C# code in the project itself, or is it necessary to set this option when linking in a native C++ DLL? What about linking in a managed DLL that itself links to a native DLL? What does this option really do, under the hood? 回答1: It has to do with the "unsafe" keyword in C#. "unsafe" turns off all the checks that would normally happen and allow you to directly access the memory. it doesn't refer to calling

What is the actual function of the C# project setting “Allow unsafe code”

白昼怎懂夜的黑 提交于 2019-12-22 05:51:07
问题 I was wondering if the C# project setting "Allow unsafe code" applies only to unsafe C# code in the project itself, or is it necessary to set this option when linking in a native C++ DLL? What about linking in a managed DLL that itself links to a native DLL? What does this option really do, under the hood? 回答1: It has to do with the "unsafe" keyword in C#. "unsafe" turns off all the checks that would normally happen and allow you to directly access the memory. it doesn't refer to calling

Clojure deftype calling function in the same namespace throws “java.lang.IllegalStateException: Attempting to call unbound fn:”

南笙酒味 提交于 2019-12-22 04:55:15
问题 I'm placing Clojure into an existing Java project which heavily uses Jersey and Annotations. I'd like to be able to leverage the existing custom annotations, filters, etc of the previous work. So far I've been roughly using the deftype approach with javax.ws.rs annotations found in Chapter 9 of Clojure Programming. (ns my.namespace.TestResource (:use [clojure.data.json :only (json-str)]) (:import [javax.ws.rs DefaultValue QueryParam Path Produces GET] [javax.ws.rs.core Response])) ;;My

PresentationSource.FromVisual(this) returns null value in WPF

泪湿孤枕 提交于 2019-12-22 04:49:17
问题 I'm using the following code for my: protected override void OnSourceInitialized(EventArgs e) { ... .... HwndSource source = PresentationSource.FromVisual(this) as HwndSource; ... ... } In some systems the "source" value comes out to be null and i cant find the reason why... 回答1: I think you may have to wait until the UI is rendered until you try to assign the Hwnd. Try putting it in the event handler for Window.Loaded instead. This happened to me before, I had the Hwnd assignment after