.net

How do I update the progress bar one step, every loop cycle? C#

Creating a .net application in C#, windows forms. How do I update the progress bar 1 step every cycle of a 100 cycle loop? (I’m processing an excel sheet in the loop.) The progress bar controls are in the UI class which connects to the controller class which connects to a custom class (MVC pattern). The loop is in the custom class. Do I...

WCF: Service calling service in same assembly

I have a WCF service (hosted in IIS 6) with two services, FileMonitorService ans JobService. In one of FileMonitorService's methods I want to call a method in JobService through WCF. This method in JobService is executed asynchronously (fire and forget). I suppose it'd be easy enough use a Thread Pool and signal when they are all done....

Ensures Unproven via property when implementing interface

I'm trying what, to me, seems like some fairly basic code contracts code. I've reduced it down to the following problem. The following fails the static analysis, with the message CodeContracts: ensures unproven: this.Frozen using System; using System.Diagnostics.Contracts; namespace PlayAreaCollection2010 { public class Stri...

.NET Profiles to follow on Twitter?

What profiles do you recommend following on twitter if you want to keep up with .NET? Here is a starting list: mosessaur damienguard shanselman ayende haacked jglozano ManzurRashid scottgu jonskeet elijahmanor ...

How to chain/nest XSL Transforms in .NET

Context: .NET Framework 3.5 I realize how I can perform a single XML transformation using XSLT, but didn't find any good examples on chaining XML transformations. Input: - XML document as XPathDocument. - File paths to multiple XSL files. Expected output: - preferably XPathDocument/IXPathNavigable, representing the XML with all transf...

Quickly detect removal of fixed IDE drive in Windows XP

The Problem Our company make specialized devices running Windows XP (Windows XPe, to be precise). One of the unbending legal requirements we face is that we must quickly detect when a fixed IDE drive is removed. Quickly as in within a few seconds. The drives in question are IDE drives. They are also software-protected from writes with ...

Curious Performance difference between returning a value or returning through an Action<T> parameter

I was curious to see what the performance differences between returning a value from a method, or returning it through an Action parameter. There is a somewhat related question to this http://stackoverflow.com/questions/2082735/performance-of-calling-delegates-vs-methods But for the life of me I can't explain why returning a value w...

Cannot load assemblies ( windows 7 visual studio 2010 )

I loaded some old assemblies in my project yesterday and now when i cannot load them, they appear with a yellow mark on them in the references. I have no idea what the hell i am doing wrong. I really need some help. ...

Consuming Ruby on Rails SOAP services in Silverlight 4

Hello, I don't know how it is possible but services provided by Rails are different consumed in WPF and Silverlight. When I seek for ****.com/api/wsdl/ (it is Rails SOAP service) WPF generates all the methods, events etc. When I seek for the same URI in Silverlight I have only: [System.CodeDom.Compiler.GeneratedCodeAttribute("System....

how to deploy sqlite with .Net

I got a report from a user that when they installed my .net 2.0 app they got a message that a reference to system.data.sqlite.dll could not be found. I use Inno to install it in the same folder as the executable and no problems from others. Does it make any difference what the copy local property is when I add the reference in VS? my und...

Possible memory leak in Asynchronous ASP.NET Call to a WebService?

I've created a small class library to asynchronously call a WebService(Fire and Forget. I don't need the result). In a Windows Form application, the XXXAsync() method works fine. But, in a Web Application, the process is locked until the XXXCompleted event is fire. My problem is: I tried to create a Delegate and use the Begin/EndInvok...

Component object-model tutorial?

Does anyone know of a good tutorial (C# preferred) for creating a component's hierarchical object-model for .NET 3.0 or later i.e making full use of generics? work with and expose an indefinite number of contained objects; prevent client applications from directly instantiating contained objects; allow the client code to use 'tunnellin...

API for adding Code Snippets Locations in visual studio

I'm currently creating a Visual Studio Add-In and require the ability to add a location for custom Code Snippets to the users Visual Studio Environment programatically. I'm aware of the DTE Command Tools.CodeSnippetsManager but don't know if there are command argurments which allow me to add these locations. ...

Unicode in CSV file?

I need to generate a CSV file. Maybe i am 'doing it wrong' because i am dumping the file with my own code instead of using a lib but anyways. It looks like i have everything right. Quotes, commas and everything seems to be escaped perfectly. It was rather easy. The problem is i am using unicode strings to test and they come out as ????....

Storing configuration data in sqllite

I have a fairly complex winforms application and I m contemplating storing my config data in a sqllite db file rather than the ususal regular app.config/ xml files. The reasons being - Data in a db is more resilient to accidental changes by administrators. I can easily conjure up a data entry form to manage configuration. The ...

Example of alternative to TransactionCompleted event?

From the MSDN entry for TransactionCompleted: You can register for this event instead of using a volatile enlistment to get outcome information for transactions. Caution Signing up for this event negatively affects the performance of the transaction it is attached to. Does anyone have an example, or even an explanation, of how...

how to recognize PDF format?

hello, given a stream of bytes, how can i tell if this stream contains a pdf document or something else? i am using .net and c# but it does not matter. thanks konstantin ...

.Net Application Settings - Property Binding OnPropertyChanged()

I have a property on a label bound to a Setting in my App Setting file. What I am wondering, Can I hook a OnPropertyChanged() up to this some how? I know there are other ways I may accomplish this but this got my curiosity up so I thought I'd ask. EDIT The reason I am asking is when the bound property of my label - Tag(bool) chan...

How do I replace the nth regex group with a new String in .net?

I have a pipe delimited string like this: blah|blah|blah|blah|blah|blah|blah|blah|blah|oldDate|blah|blah| I would like replace the content of the 10th section with a new Date. I am able to match the the old date with the the following code: 'create a group with the first 9 non-pipes followed by a pipe, a group with the old date follo...

Verify the number of times a protected method is called using Moq

In my unit-tests I'm mocking a protected method using Moq, and would like to assert that it is called a certain number of times. This question describes something similar for an earlier version of Moq: //expect that ChildMethod1() will be called once. (it's protected) testBaseMock.Protected().Expect("ChildMethod1") .AtMostOnce() .Ve...