.net

Deploying unsafe code in Azure cloud

Has anyone tried deploying unsafe code in Azure? I'm working with code containing unsafe blocks dealing with pointers and all that fun stuff. And I'm wondering if that has something to do with errors I'm getting trying to deploy/upgrade the web project in Azure. Also, is there actually a way to view specific errors that are breaking...

WPF button press on Windows 7 mulit-touch

I am developing a WPF kiosk like client that will be deployed on an HP TouchSmart Windows 7 machine with multi-touch enabled. My problem is that with Windows 7 multi-touch, the application does not recognize a finger 'tap' as a button press event, and therefore the button press Trigger to change color is never fired. The Windows 7 an...

ObjectListView appears disabled but not when Form is being resized

I'm using a number of ObjectListView controls on a form in my current project. Today I migrated the project from Visual Studio 2008 to Visual Studio 2010. Now when the form is displayed all the OLV controls look as if they are disabled yet they are not. I have no problem scrolling the lists, or selecting items in the list. In addition, t...

How to create Nullable fields/variables from WSDL instead of extra fields/variables

I am using wsdl.exe to convert a WSDL file and Types.xsd file into a C# file. The wsdl file specifies optional variables (minOccurs="0" maxOccurs="1"), and the generated .NET type handles this by created two fields - one for the variable (e.g. status) and one to let you know if it's specified (statusSpecified). Is there a way to use the...

What's the right pattern for waiting on a file lock to be released?

I need to open a file but if it's currently not available I need to wait until it's ready. What's the best approach to take? SCENARIO I'm using files as a persistent caching mechanism for application data. This data needs to be read and deserialized often (written only once, and deleted occasionally). I have a cleanup process that runs...

Use C# to create html

Working on a scrolling picture slider and need to dynamically create hyperlinks and divs in a specific div on the page so that I can then control it with JQuery. <div id="scroller"><!-- here is where I want the html to be created and what needs to be created --><a href="#" class="scrollimage"><img src="images/image10.jpg"/> </a></div> ...

casting COM objects in VBA

I have a base abstract class MyClass, and it has an interface IMyClass. I have 2 other classes (MyClassA, and MyClassB) that inherit from MyClass and include the IMyClass Interface. I have a fourth class (MyList) that inherits from List<IMyClass> and it has an interface that has a method Add(IMyClass value); All classes have been ...

Backgroundworker runworkercompleted not firing

I have a really weird problem with background worker. Code is too complicated so will try and explain the problem just want to know if anyone has seen something similar. We have the UI thread spinning off a background thread The background thread does some printing to a pdf printer in the background When finished it just dies as in the t...

MVVM WPF save and load user settings design pattern

I am looking for a good tutorial / explanation that shows where and how to implement settings in a MVVM WPF application. I understand .net has built-in support for settings but is this typically used for medium to larger size applications? What are the alternatives? I am thinking of storing many user settings such as window size, grid...

.NET 4 Serial Port ObjectDisposedException on Windows 7 Only

This is a problem I used to have all the time with the serial port class in .NET 2.0. It was suggested that upgrading to .NET 4 would fix the problem... and it did in almost all cases. If I am using the serial port class built-in to .NET to communicate with a USB-to-serial adapter, and the adapter is unexpectedly unplugged while the po...

ASP.Net class loading questions

1) In a standard .Net application, are classes loaded as they are required? (e.g. If I have a class with a static constructor, is that static constructor only run the first time that class is needed?) 2) In an ASP.Net MVC (or web forms) application, is the static constructor invoked on every request that uses it? Or is it only for the f...

Ajax long-polling on IIS

I am looking into making a real-time chat website, but have ran into a few questions before starting. First off, we want to be able to have multiple people in one conversation and multiple conversations going on at the same time. After doing some research, a lot of people suggested long-polling. Scalability sounds like a problem thoug...

Is ConditionalAttribute supposed to strip out entire lines, or just method calls?

According to the documentation on the ConditionalAttribute class: Applying ConditionalAttribute to a method indicates to compilers that a call to the method should not be compiled into Microsoft intermediate language (MSIL) unless the conditional compilation symbol that is associated with ConditionalAttribute is defined. ...

What data structures in .NET do O(1) on Contains() calls?

I'm drawing a blank here; I can't find it, unless I'm really overlooking something under my nose. I'm trying to store a list of ints in a data structure. But after I add them, I will later in code check if an int exists in the list already. The generic List<int> does an O(n) operation with its Contains(). I want something that works ...

state machines in .net

can any on explain me what are state machines in .net ...

C# - Creating a color tiff file

Hi All, I need to create a colored tiff file from a docx file, as a partial fulfilment for my apllication using C#. I'm using MODI to handle this. What im doing is creating a mdi file first using Microsoft Word API (mdi is color) then save it as a tiff file. But this process associates may I/O operations. Does anyone know a way of u...

Why is the namespace reference being lost when copying XML nodes?

I have an XML document (an InfoPath form) that looks similar to this: <my:ClientMaintenance xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-07-06T07:04:54"&gt; <my:Payments> </my:Payments> <my:Payment> <my:Amount></my:Amount> <!-- Several other nodes --> </my:Payment> </my:ClientMai...

Silverlight 4 screen capture function

Hello everyone, I am wondering whether Silverlight 4 is able to capture screen as image or capture screen operations as video? Or both? Is there an online Demo to experience the effect? I am using C# + .Net 4.0 + VSTS 2010 + ASP.Net + III 7.5. thanks in advance, George ...

ICombinable .NET Interface

I'm finding myself in need of "combining" several instances of the same type. This type has several IList properties on it. I want to take each instance and combine the values of those IList properties across the instances, so my code only needs one of those instances. I'm thinking of creating an ICombinable interface, but I'm wonder if...

Java equivalent of the following static readonly C# code?

So, in C# one of my favorite things to do is the following: public class Foo { public static readonly Bar1 = new Foo() { SomeProperty = 5, AnotherProperty = 7 }; public int SomeProperty { get; set; } public int AnotherProperty { get; set; } } Ho...