.net

How can I turn DTE.ActiveWindow.Selection into the closest CodeElement in a VS2008 Macro?

I'm working with the Visual Studio 2008 object model as seen here: VS2008 Automation Object Model Chart. I want to act on a CodeElement in a VS2008 Marco, one that is chosen by the user's text selection in the current .cs document. While I don't really care how I get it, this is what I tried: The VS object model gives you DTE.ActiveWin...

Create Instance from assembly and its dependencies in C#

I have an app (let's just call it MyApp) that dynamically creates source code for a class and then compiles it. When it compiles the source code I also reference another DLL (that is the base class for this newly created class) that already exists in another folder. I do the following to compile and output the DLL: //Create a C# code pr...

process.WaitForExit() asynchronously

I want to wait for a process to finish, but process.WaitForExit() hangs my GUI. Is there an event-based way, or do I need to spawn a thread to block until exit, then delegate the event myself? ...

.NET XML: What is the .NET equivalent of XmlDocument.TransformNode?

In native programming the IXMLDOMDocument2 object had a tranformNode() method: public BSTR transformNode(IXMLDOMNode stylesheet); So in the end i could tranform an XML document using: public string TransformDocument(IXMLDOMDocument2 doc, IXMLDOMDocument2 stylesheet) { return doc.TransformNode(stylesheet); } i'm trying to find th...

.NET : How to validate XML file with DTD without DOCTYPE declaration

I have an XML file with no DOCTYPE declaration that I would like to validate with an external DTD upon reading. Dim x_set As Xml.XmlReaderSettings = New Xml.XmlReaderSettings() x_set.XmlResolver = Nothing x_set.CheckCharacters = False x_set.ProhibitDtd = False x = XmlTextReader.Create(sChemin, x_set) How do you set the path for that e...

Linq: how to select only the records with the highest date

I have a table 'lasttraces' with the following fields: Id, AccountId, Version, DownloadNo, Date The data looks like this: 28092|15240000|1.0.7.1782|2009040004731|2009-01-20 13:10:22.000 28094|61615000|1.0.7.1782|2009040007696|2009-01-20 13:11:38.000 28095|95317000|1.0.7.1782|2009040007695|2009-01-20 13:10:18.000 28101|15240000|1.0.7....

.net launching process with path and arguments

paths are relative to current directory. I've tried tens of combinations of quoting, not quoting, changing to parent directory and removing the .., but I always get a FileNotFound error. bridge_process = System.Diagnostics.Process.Start( @"../Tools/RunHidden", @"../My-Bridge.bat"); ...

Is there an existing delegate in the .NET Framework for comparison?

The .NET framework provides a few handy general-use delegates for common tasks, such as Predicate<T> and EventHandler<T>. Is there a built-in delegate for the equivalent of CompareTo()? The signature might be something like this: delegate int Comparison<T>(T x, T y); This is to implement sorting in such a way that I can provide a la...

How can I use the GPU as a second processor in .Net?

The question says it all really. I'm hoping that I don't have to write the code in a c++ .dll and then call it from managed code. ...

Need help with modifying PrintTickets through XML

Doing some work on controlling printing via the System.Printing framework (main classes are PrintQueue, PrintTicket and PrinterCapabilities). Like with most stuff I've been working on lately, there's damn little information about it. I'm hoping to compile some good information in this question to help flesh out this subject. PrintTick...

Treeview --> Parent node value

Hi, I am new in WPF world. I have treeView that contains Treeview Mandate --> Portfolio ---->portfolio1 Benchmarks Category ------>Name1 etc.. I would like to know how to get the parent node value in WPF ? For example, If I select the portfolio1 how to get the parent-parent value. In this case Mandat...

Linq DataContext doesn't recover after a caught exception?

I am using LINQ for the first time and I am running into some behavior I don't fully understand with the DataContext. Hopefully StackOverflow can help. Basically, it seems like once my DataContext encounters an exception, it either caches that exception or never fully recovers. In my specific case, once I try to pass a string that is to...

Crystal Enterprise, Scheduling a report.

I am in the process of creating a class that will query my local database and generate a series of scheduled reports on the Crystal Enterprise server (each with a different output file). I have done this in Java but would like to create a .net (VB or C#) class to do the same. Can someone point me in the right direction for sample code ...

XmlSerializer and InternalsVisibleTo attribute

Is it possible to make XmlSerializer serialize internal class members by using InternalsVisibleTo attribute? If it is, what assembly should I make my internals visible to. In other words, what assembly name and public key should I provide to the InternalsVisibleTo attribute. ...

WCF and Interface Inheritance - Is this a terrible thing to do?

My application has 2 "services", let's say one is a basic (integer) calculator, and one is a floating point calculator. I express these as interfaces like so: public interface IBasicCalculator { int Add( int a, int b ); } public interface IFloatingPointCalculator { double Add( double a, double b ); } I want to expose these via WCF....

ASP.NET MVC Reference problems?

In doing a MVC project I got the following 2 compile errors The type 'System.Web.Mvc.ViewPage' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The call is ambiguous between the following methods or properties: 'System.Web....

interface good practices

is it a good practice to have an interface that has no methods but just properties? ...

Winforms WPF Interop - WPF content fails to paint

I have a Winform that uses an ElementHost to display a WPF UserControl. Once every 50 times or so when the form loads the WPF content fails to paint. You can see through the Winform chrome to whatever is beneath. Resizing the window gets the WPF content to show up. Is this a known issue? Can anyone suggest a workaround? Thanks Scott ...

WinForms- Populating a FlowLayoutPanel with a large number of controls and painting thumbnails on demand

Hi, I'm trying to make an ImageListBox kind of control that will display large numbers of thumbnails, like the one that Picasa uses. This is my design: I have a FlowLayoutPanel that is populated with a LOT of UserControls, for example 4,000. Each UserControl is assigned a delegate for the Paint event. When the Paint event is called, i...

Using separate MSI build for config files for each environment

For one client, I have to deliver a build they use in QA and production. The checksum of the build file has to match - it cannot change at all between QA and production. The configuration for each environment is different, so I have a build that contains just the code and then a separate build for each environment that contains just th...