.net

ComboBox not losing focus

Hello, I've been having problems with the ComboBox control. I'm no expert in GUI, but I know this problem is related to the control's focus. For some reason, the ComboBox does not lose its focus when I click outside of it. Say for example: I click on the ComboBox to list its items. I select one item. This closes the ComboBox. I click...

TargetParameterCountException in Moq-based unit-test

Hi, We have repositories which have a "Save" method. They also throw a "Created" event whenever an entity is saved. We have been trying to use Moq to mock out the repository as such.... var IRepository = new Mock<IRepository>(); Request request = new Request(); IRepository.Setup(a => a.Save(request)).Raises(a => a.Created += null, Req...

How can I retrieve all the KeyValuePairs contained in a Dictonary<?,?> ?

I've got an object which is a Dictionary of an unknown type (ie I don't know the type for the key and the value) I want to retrieve all of its values so I can access those by index. So what I want to do is something like that : Dictionary<object, object> d = (Dictionary<object, object>)obj; // cast error l = new List<KeyValuePair<obje...

Generics Reflection

Good Day, I'm trying to write a custom method to populate a ListView control using Generics: private void BindDataToListView(List<T> containerItems) { this.View = View.Details; this.GridLines = true; this.FullRowSelect = true; if (this.Items.Count > 0) this.Items.Clear(); th...

WinForm fat client: Architecture decisions: Did I make the wrong ones?

I have a .NET Winform Click-Once-deployed fat client that talks to three databases, 2 SQL Server databases and a Oracle one. The first SQL Server database, I will call the Master. I wanted add more tables and columns to the Master database but I was told I would not be given rights to do so, that it was non negotiable. So, I decided to ...

Crop a picture in C# with the use of rectangle box

I want to crop a pic in c#. As in most photo editing softwares i want to use the rectangle box which can be resize and move with mouse(as in most image editing softwares). plz also tell that how it is possible that the pic inside the rectangle is bright while outside is darker. following pic give the some idea........ http://img3.im...

Why WCF doesn't automatically affect the To header on outgoing message with the ReplyTo of the incoming message ?

I have a service which send a message with the ReplyTo header set to a return address. I thought that : OperationContext.Current.GetCallbackChannel<IHelloCallback>().RespondHello("tomi"); will automatically invoke my client, but I receive this exception : For sending a message on server side composite duplex channels, the messag...

NHibernate ICriteria subqueries with ISet<T> properties: Is this correct?

Given a class A related to another class B in a one-to-many relationship, how can you create an NHibernate query (using the Criteria API--no HQL) to find all objects A who "have none" of the related objects B? Specifics follow, but I wanted to get the question out there first. I have two model classes, Sample and SampleDiagnosis. Sam...

C#: Detect if running with elevated privileges?

I have an application that needs to detect whether or not it is running with elevated privileges or not. I currently have code set up like this: private static bool _isAdministrator() { WindowsIdentity identity = WindowsIdentity.GetCurrent(); WindowsPrincipal principal = new WindowsPrincipal(identity); return principal.IsIn...

A .NET/WinForms chart control with drill-down support?

There's easily a few dozen chart controls out there, but I'd prefer not to download all of them to find one that has what I want. I'm just looking for one that can do drill-down. Something like this would be fabulous (click Pie): http://demo.quietlyscheming.com/drillDown/app.html Doesn't need to be quite so animated and flashy, of cours...

Silverlight 3 DataForm best practices

I have got a new project I am doing in Silverlight 3 which is a LOB application. It will have a fair number of data entry screens, some of which will be pretty complicated. Is the new DataForm control up to the task for anything other than simple generic forms or should I create custom forms? And if I create custom forms, are there any b...

c# .NET runtime object type

I need to create an instance of an object and the type of that object will be determined at run time. The type of the object is pulled from SQL and set to a string value. I also need to pass a number of parameters when instantiating it. The number/type of parameters will be the same every time (for now at least). What do I need to use to...

Can this be mocked with Moq?

I am working on mocking some external dependencies and am having trouble with one 3rd party class that takes in it's constructor an instance of another 3rd party class. Hopefully the SO community can give me some direction. I want to create a mock instance of SomeRelatedLibraryClass that takes in it's constructor a mock instance of Som...

Facebook Libraries for .NET

I'm trying to create my first application for facebook using MVC, but can't decide on the API library to use. I found this post, but its over a year old and I'm sure a lot has changes since then. how would you say all these projects stack-up? Facebook Developer Toolkit 2.1 .NET Facebook API Client Facebook.NET Facebook Developer T...

How to sign a .NET Assembly DLL file with a Strong Name?

I have an assembly which is not strong-named. I have no source code for it. I now need it to be signed. Is there a way to do this? ...

Automated Testing of Component Handlers in 3rd Party Javascript

I'm currently using WebAii and WatiN to try and automate some tests of a 3rd party web product, to see if some data migration will break the web portal. The problem I'm having is that they have used Component Handlers in their Javascript, and so invoking a Click on a web-part (SPAN, DIV etc) is not triggering the generic handler. /...

Databinding the color of a RadialGradient brush in silverlight 3

Hi, I am trying to databind the color of a RadialGradientBrush in silverlight 3 to a property, but just can't seem to get it to work. For example, in a sample test app all I have is <navigation:Page x:Class="SilverlightNavigator.HomePage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" x:Name="HomePageUC" x...

.net framework compatibility

Hi, .Net framework 3.5 has been installed in a PC. In that PC, I like to install the application which developed using .Net 1.1 framework. Should I install .Net 1.1? If I do that will it cause any problems? Thanks, P.Gopalakrishnan. ...

Visual studio extensibility allows us to put extra items in any menu?

I mean, I have an add-in that will be applied to a given project. I'd like to know if it's possible to add a menu item for my add-in to the context menu that appears when you right click any project in the solution explorer. ...

how to bind WCF service to IP address

Hello everyone, I am developing a WCF service hosted by IIS, using VSTS2008 + C# + .Net 3.5. I find when reference the service from a client by using Add Service Reference..., client has to be able to resolve the machine name to IP address, because WSDL reference some schema file by machine name. Here is an example of a part of WSDL fil...