.net

Compelling Reasons to Use Marker Interfaces Instead of Attributes

It's been discussed before on Stack Overflow that we should prefer attributes to marker interfaces (interfaces without any members). Interface Design article on MSDN asserts this recommendation too: Avoid using marker interfaces (interfaces with no members). Custom attributes provide a way to mark a type. For more information ab...

Reading XML with XDocument problem.

I have a following XML (part of a .rdl report): <Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition"&gt; <DataSources> <DataSource Name="TMSSharepointDataSource"> <DataSourceReference>TMSSharepointDataSource</DataS...

How can I prevent other apps from stealing the focus?

I have a fullscreen window with the Topmost property set to true. Whenever an application changes its WindowState property, my window is automatically minimized even though it has the active focus. For example, the code below exemplifies the problem. 3 seconds after the window is deactivated, it changes from Minimized to Normal, minimizi...

ASP.NET Configuration page

when I try to access the ASP.NET Configuration page from Visual Studio 2008, I fail . I get an error : "An error was encountered. Please return to the previous page and try again.". This is the message I get after clicking on Help : "Tool Has Timed Out . As a security measure, the Web Site Administration Tool times out after a period o...

Progress 4GL and .Net

I'm trying to get data out of a Progress 4GL database, into SQL Server. Ideally, I'd like to do this directly and within .NET, rather than through an ODBC driver since the ODBC driver gateway in Progress doesn't support multiple-cores (at least on the version we have). Do you know how to connect to a Progress 4GL database from .NET (id...

Is it good practice to use Entity Framework in unit tests?

I'm writing NUnit tests for a service. I've decided to do this by sending direct SQL statements to the database instead of using the Entity Framework model so that I could be certain of the results, i.e. I am testing what is in the database and not what the Entity Framework tells me is in the database (e.g. it could be reporting a cache...

Free/Open source Application Skinning Solutions for .Net?

What are the open source alternatives available for skinning/Theming an application in .Net Winforms I've read about using UXTheme library (i have no idea as to how to to da that :) ), but is that valid for Win XP to Win7 ...

Handling multiple languages across multiple applications and shared libraries (.net)

We are developing products that will be used in the following way: Various shared libraries which may be used by multiple products. I anticipate these libraries will mostly need to access string resources that contain error messages/exceptions. Various end-user based applications, designed to run as standalone apps on a PC. They will ...

Bind to a method in code behind

I have a custom control template for a listview that puts an extra line in for each record, thats defined something like this in Window.Resources... <ControlTemplate TargetType="ListBoxItem"> <Border> <StackPanel> <GridViewRowPresenter> <TextBlock Name="myTextBlock" /> </StackPanel> </Bor...

working with Ajax popup

ok i need a pop up box to select date and time... but im having some trouble... i used first modal popup (ajax) for the popup... that is working but not looking neat... then i put a textbox in it with the calender extender... the problem here is when i click on textbox calender pops up but it does not seem to work because nothing is...

Extract icon from executable that's in memory

Does anyone know an API function to extract an icon resource from an executable file that's in RAM (inside, say, a MemoryStream)? All of the icon-extracting functions I've seen so far depend on the executable file being present on disk. I'd like to extract the icon without having to write the exe to a temp file, and then loading the re...

Delete a matching substring ignore whitespaces

Hi , I need to delete a matching substring when found in string 1 ignoring whitespaces and charcters like -. The example I have is: string 1="The LawyerWhat happened to A&O's first female partner?The LawyerWhen Clare Maurice was made up at Allen & Overy (A&O) in 1985 she was the sole female partner at the firm. Twenty-five years later...

Anybody able to get the Java Access Bridge working in C#?

I'm trying to get JAB working so I can scrape some text out of a java window, but its failing horribly. The odd thing is that while it doesn't work on my machine it does work on other machines. My machine: 7, 64bit Works on: 7 32bit (2 boxes tested), XP 32bit The common thing appears that if you don't install the JAB setup applicati...

Reporting Services add-in to Sharepoint: how to change report's data source programmatically?

We are using Reporting Services add-in for Sharepoint Technologies. We keep our report files in a document library list on Sharepoint. Then with some code we copy these reports to a different document library. The problem is that after copying, the report cannot be displayed because it has invalid Data Source. You have to go to "Manage D...

How do you keep your Domain Logic seperate from DB/Persistence Logic with Linq-2-Sql?

I'm trying to get at the best way to seperate the concerns of my domain logic and my persistence logic. I'm using Linq-2-Sql for the data access and I've been following the NerdDinner tutorial. If you look at page 40, you can see they are using partial classes to business rules to their Linq generated classes. To me, that feels wrong (is...

Finding out Unicode character name in .Net

Is there a way in .Net to find out, what Unicode name certain character has? If not, is there a library that can do this? ...

MVVM Madness: Commands

I like MVVM. I don't love it, but like it. Most of it makes sense. But, I keep reading articles that encourage you to write a lot of code so that you can write XAML and don't have to write any code in the code-behind. Let me give you an example. Recently I wanted to hookup a command in my ViewModel to a ListView MouseDoubleClickEvent. ...

Registering an Object that has a string array as a parameter using Castle Windsor Fluent Registration API

I have a hopefully simple question... I am trying to change over from the XML registration to the Fluent Registration API, but am having one problem with registering objects that require an array as a constructor parameter. For example <component id="Example" lifestyle="transient" service="Test, Example.Test" type="Test, E...

c# HttpListener behind router

I have a web sever embebed in an application, very similar to this. But i have problems with i try access behind a router. I think code is right because if i change host file, all is working. Can anybody explain what is the problem? ...

Background Process (periodic "service") in WinForm Application

What is the best practice for setting up a background process that runs every 10 minutes in a WinForm project? Is it to use a backgroundworker off of the form? Or is there a more generic way that would apply to many more project styles? Maybe some code I should call right before the line: Application.Run(new Form1()); ...