.net

How to render a usercontrol loaded via LoadComponent to a bitmap/image in WPF?

I'm trying something along these lines. //Somewhere in my app System.Uri resourceLocater = new System.Uri("/MyApp;component/Users.xaml", System.UriKind.Relative); var obj = Application.LoadComponent(resourceLocater); //Invoke the renderxaml element var image=RenderXamlElement(obj as UserControl); //Then I may save this image to a fil...

How you use technique (described) to work with C structures and pointers from .Net?

How you use technique described here to work with C structures from .Net? Ofcourse I need a code example - on 3 parts: C declaring parts, C++ wrapping around C and C# acsessing. So what I wonder Is C structture A has as one of its params structure B which consists of at least 2 types one of which is pointer to some variable C which ...

How can I get an open source Voting System using C# for research purposes?

I am a reseacher in e-voting security, and I want to apply a security scheme on e-voting system using C#. Can anyone point me towards an open-source e-voting system that I can use? ...

Are multiple calls to string.Replace() less efficient than a single call to a Regex method in .NET?

I want to replace about 8 characters in a string. Would it be more efficient to use a Regex method or just use multiple calls to string.Replace() I'm replacing about 7 characters that may appear, all to be underscores instead. The characters could appear anywhere in the string, and not in a particular order etc. ...

WebBrowser DocumentCompleted event fired more than once

I've been researching this stuff and everyone seems to agree that the solution is to check the ReadyState of the WebBrowser until is set to Complete, but actually the event is sometimes fired with the ReadyState set to Complete several times. I don't think there is a solution with that crappy .NET WebBrowser, but there might be one if I ...

Sharing nHibernate and hibernate 2nd level cache

Is it possible to share the 2nd level cache between a hibernate and nhibernate solution? I have an environment where there are servers running .net and servers running java who both access the same database. there is some overlap in the data they access, so sharing a 2nd level cache would be desirable. Is it possible? If this is not ...

C# examples for hooking GDI (in particular TEXTOUT).

i'm looking for C# samples code for hooking GDI (in particular TEXTOUT). Probably similar to what thetextcapturex, textgrabsdk libraries are doing These libraries must be hooking something, but what, and how? Is there any way to do this in the .net world? ...

Any reason not to use XmlSerializer?

I just learned about the XmlSerializer class in .Net. Before I had always parsed and written my XML using the standard classes. Before I dive into this, I am wondering if there are any cases where it is not the right option. EDIT: By standard classes I mean XmlDocument, XmlElement, XmlAttribute...etc. ...

Sum TimeSpan array with a one-liner?

Is there a way to aggregate multiple aggregates to 1 time span? Dim times = { New TimeSpan(1, 0, 0), New TimeSpan(1, 10, 0), New TimeSpan(1, 50, 0), New TimeSpan(0, 20, 0), New TimeSpan(0, 10, 0) } Dim sum As New TimeSpan For Each ts In times sum = sum.Add(ts) Next 'That's what I desire: sum = times.Sum sum = times.Aggreg...

Reflector Not Decompiling 'System.Data.Entity.dll' .NET 4.0

When looking at the System.Data.Entity.dll for .NET 4.0, no methods are being decompiled. I only see the method stubs. I tried re-installing reflector but it still didn't work. I am able to decompile other .NET assemblies just fine. ...

C#, J# and VB.NET is it possible to write a class in each and make its variables interact in one application?

I was asked this question in an interview would appreciate your answers. Regards; Mohammad Mohsin ...

LINQ Strange Execution - Inconsistantly Consistant?

This IS a delayed execution problem. However, my issue stems from the fact that I cannot ascertain WHY this execution is delayed sometimes, and not other times. Code: IList<LineItem> freeFlatItems = new List<LineItem>(); if(QualifyFreeFlatShipping) freeFlatItems = lineItems.Where(l => l.FlatShippingRate != null).ToList(); decimal...

Finding duplicate objects in a collection using LINQ

Guys, I have a simple class representing an object. It has 5 properties (a date, 2 decimals, an integer and a string). I have a collection class, derived from CollectionBase, which is a container class for holding multiple objects from my first class. My question is, I want to remove duplicate objects (e.g. objects that have the same d...

NHibernate asks .NET to convert a string parameter to an integer, don't know why

(Edited to avoid leading down the wrong road) Before giving details, very short version: I have a SQL statement I need to get out of NHibernate, and I have Criteria API statements that give it to me. The NHibernate is trying to do something wrong with the statement it generates, and I'm trying to figure out why. I have the following m...

Reusing windows clock control from timedate.cpl?

hi everyone, I'm trying to reuse windows clock that exist in timedate.cpl which is a dll, I know how to communicate with it using SendMessage to get and set time. My problem is this control is a private window class so i tried to load the dll first then create a window with name ClockWndMain but it fails and the reason is window class n...

How do I pull data from a javascript populated table?

I am trying to pull data from my populated javascript table. How do I pull the value from a javascript row? I am using for (var i = 0; i < rowCount; i++) { var row = table.rows[i]; //This is where I am having trouble var chkboxIndicator = row.cells[0].childNodes[1]; ...

Sharing an enum from C#, C++/CLI, and C++

I have a library that consists of three parts. First is native C++, which provides the actual functionality. Second is a C++/CLI wrapper/adaptor for the C++ library, to simplify the C# to C++ transition. Finally I have a C# library, which invokes the C++ library through the C++/CLI adaptor. Right now there I have two sets of parallel...

Assembly Binding Log Viewer (fuslogvw) not logging any bindings.

Assembly Binding Log Viewer (fuslogvw) is not logging bindings for any version of the framework installed on my machine. I tried using a custom log location, the default log location, the default category, and the native images category. Assembly Binding Log Viewer worked a few months ago. I'm on a 64-bit machine and am running C:\Pro...

setlocale() is not affecting ConvertBSTRToString() but system-wide setting does?

Given: ASP.Net application which uses a legacy COM library legacy COM library which is built without Unicode (MBCS) Windows 2008 dev server on which it all runs Needed: support web app users in different locales Test: 1) I set the system locale on the server to Russian and tested Russian inputs. .NET treats them as UTF16, passes o...

How to pause execution yet keep webbrowser control loading in C#.

I'm trying to make a web browser that tells me when a specific video is done. I already know how to get the time in seconds of how long it takes. I just need to know how to wait to execute the next step without stopping the webbrowser control (which needs to play the flash video). Any ideas? I've been looking into the Timer class, but c...