.net

How to make a Win Service run Long Term with Threading.

I have a win service hosting a few workflows (a WorkflowApplication and a WorkflowServiceHost) that I need to keep long running. Because OnStart() requires that it completes and returns to the OS, I have a main method that fires on another thread in a threadpool. My Onstart() mainly looks like this protected override void OnStart(string...

Binding String Collection to ListView, Windows Forms

I have a StringCollection that I want to One Way Bind to a ListView. As in, the ListView should display the contents of the StringCollection. I will be removing items from the collection programatically so they don't need to interact with it through the ListView. I have a Form with a Property, like so --> public DRIUploadForm() {...

C# How to implement databinding for custom control?

Basically, I am confused about how to implement databinding on the control side. I am trying to write a custom list control in C#, which implements databinding. I want it to end up having similar functionality to the ListView, but with an interface similar to ListBox. I have a private nested class called "ListRow" which handles render...

Which .NET version is my Powershell script using?

I'd like to use .NET in some PowerShell scripts I'm about to write -- how do I know/declare which version of .NET I'm dealing with when these scripts run? EDIT: And is it possible to choose against which version of .NET my script will run? ...

Declare and create variable in code behind

Here are 3 scenarios: namespace NS { public partial class A: System.Web.UI.UserControl private Variable v; protected void Page_Load(object sender, EventArgs e){ if (!Page.IsPostBack) v= new Variable(); .... } } namespace NS { public partial class A: System.Web.UI.UserControl private Variable v = ...

OCR engines designed for screen-reading

Are there any OCR engines designed for identifying text in screen-captured images rather than scanned text? I have a project where I need to retrieve and identify text in an application, and none of the OCR engines I've tried so far have faired well with screenshots. Ideally the engine should work well with color and with background noi...

SSL/TLS/HTTPS sites are very slow in a C#/.NET WebBrowser control, but fine in Internet Explorer

Background I'm modifying AutoWikiBrowser to work with a MediaWiki site hosted on a secure server. I allow the user to login manually via a WebBrowser control in a C# application, and then save the stored cookies for use in HttpWebRequest's. The Problem The problem I'm having is that any site which uses SSL/TLS (https:// urls) takes an...

Rx extensions/parallel task library in .net compact/xna3.1 for xbox360?

Is there any way I can use the .net task parallel library that was included in the Rx extensions for .net 3.5 SP1 in xna 3.1 for xbox 360? Or, alternatively, to use the Rx extensions themselves? The assemblies installed by .net 3.5 SP1 Rx extensions installer do not appear to be compatible with the .net compact framework. Or, if not pos...

.NET Parameterize Queries Injection

Are Parametrize Queries in .NET safe from SQL Inject? That is, does .NET automatically escape dangerous characters when you use Parameters? ...

MVVM and DI - How to handle Model objects?

I'm using Caliburn and C#, but I feel like this is a generic MVVM/DI question. Let's say I have a view model, NoteViewModel, that is passed a model object called Note. Here is some code: class NoteViewModel : PropertyChangedBase { private readonly Note _note; public NoteViewModel(Note note) { _note = note; } public str...

Fixing gaps in streamed USB data

We have a hardware system with some FPGA's and an FTDI USB controller. The hardware streams data over USB bulk transfer to the PC at around 5MB/s and the software is tasked with staying in sync, checking the CRC and writing the data to file. The FTDI chip has a 'busy' pin which goes high while its waiting for the PC to do its business. ...

XSL Transformation through code does not result in the same output as XSL transformation done through a tool.

I am transforming my XML file to another XML file using the XslCompiledTransform classes available in the .NET framework 3.5 Here's my code. private static void transformUtil(string sXmlPath, string sXslPath, string outputFileName) { try { XPathDocument myXPathDoc = new XPathDocument(sXmlPath); ...

How to specify a min but no max decimal using the range data annotation attribute?

I would like to specify that a decimal field for a price must be >= 0 but I don't really want to impose a max value. Here's what I have so far...I'm not sure what the correct way to do this is. [Range(typeof(decimal), "0", "??"] public decimal Price { get; set; } ...

How to bind a WPF control value to a method?

Imagine I have a TextBox that it's Text should be equal to the number of running processes in the machine. How to make it to update without using timers? Is there a way using Dependency Property or Bindings? ...

Only Search for Text Within XAML Files using Visual Studio 2010

Many times I find that I want to search my entire Visual Studio project for a text string, but I only want to search the XAML files in the project and not the code-behind (.cs) files. Does anyone know if there is a way to do this in Visual Studio or if there is an add-in I can download to accomplish this? Thanks. ...

How can I generalize the use of these different data structures?

I have an application that reads times from a file. These times can be in three different formats, based on flag bits elsewhere in the file, as shown below: [StructLayout(LayoutKind.Sequential, Pack = 1] public struct IntraPacketTime_RTC { public UInt64 RTC; } [StructLayout(LayoutKind.Sequential, Pack = 1] public struct IntraPacke...

.net mvc & ajax forms - how to handle session expired

I have a customer filter attribute to check for expired session in my .Net MVC application which works fine on a standard html form. However, when I apply the attribute to an action that is called by an Ajax form and the session is expired, it reloads the login page (where the filter attribute redirects the context) into the ajax update ...

Need help with a 'No persister for:' exception with Fluent Nhibernate Automapping

Hello I'm having some problems with applying NHibernate Fluent Automapping. It worked great in a test project. But now.. Test method [PROJECTNAME].SubscriptionTest.SubscriptionConstructorTest threw exception: NHibernate.MappingException: No persister for: [PROJECTLIB].SubscriptionManagerRP The class (then again, the same exception a...

Is WCF the right choice for me?

From the little that I know about WCF it seems to be the right solution to a particular problem I have but I'd like to get some input on it. Problem Description: Clients sequentially access domain objects from a list roughly once ever 1-10 minutes (average is 2 mins), but no 2 clients should ever access the same object. Certain orderin...

Applications manifest file causing problems on Win 7 environment

My app has been upgraded along the way from .net 1.1 to 3.5. On win 7 64 bit environment I have o manually remove the app.exe.manifest file as otherwise it crashes when it launches. I use a visual studio deploy & setup project to install. In the exe's application settings itself i've tried all the options in the dropdown relating to wha...