.net

Web-based licensing solution for a desktop .NET product

Hi, Please advise, is there any web-based licensing solution, where I can generate registration codes, and validate them in the software by connecting to my licensing server? Thank you. ...

How do I change text color on the selected row inside a ListView/GridView? (using Expression Dark theme)

I'm using theExpression Dark WPF Theme(http://wpfthemes.codeplex.com/) with a ListView(view property set to a GridView) to display some user data like the following : <ListView Grid.Row="1" ItemsSource="{Binding RegisteredUsers}" SelectedItem="{Binding SelectedUser}" > <ListView.View> <GridView> ...

Detecting if a file is binary or plain text?

How can I detect if a file is binary or a plain text? Basically my .NET app is processing batch files and extracting data however I don't want to process binary files. As a solution I'm thinking about analysing first X bytes of the file and if there are more unprintable characters than printable characters it should be binary. Is thi...

Problem With WPF C# App Spawning Two Main Windows

I've been working on this app for the last few days and suddenly this super weird problem starting happening where 2 of my primary windows starting spawning during run time. I've searched for 3 hours and can't find where or why this is happening. If you want to show a stranger some love, can you help me find why this is happening? My pr...

Is there a way to edit a pdf with C#?

I would need to edit a pdf at runtime in C#.NET. Is this possible? Like copying things in the pdf, editing textfields, ...? ...

Undo button for System.Drawing?

Hi guys, I am making a image editor kinda for own enjoyment and was wondering how could I make a undo button to undo the last paints I did? I want to know how I would about this, a tutorial or sample code would be nice or at least something pointing me in the right direction. Thanks! ...

Non-modal WinForms FontDialog?

Is it possible to display the WinForms "font picker" dialog non-modally? Or is there another font picker other than the standard one that can be used non-modally? Our application has many windows, and users who frequently need to interrupt what they are doing and switch to another window to look at something. If they use a taskbar butto...

Detect Shift key at any point during the execution of a console app

I would like to have my console app that runs for a while to give some options to the user at the end if at anytime during the process the user pressed the shift key. Is this possible? ...

linq-to-xml and carriage returns

What is the best what to handle carriage returns in xml formatting with xml? <myxml> <mydata> </mydata> </myxml> <myxml><mydata></mydata></myxml> ...

Explicit Event add/remove, misunderstood?

I've been looking into memory management a lot recently and have been looking at how events are managed, now, I'm seeing the explicit add/remove syntax for the event subscription. I think it's pretty simple, add/remove just allows me to perform other logic when I subscribe and unsubscribe? Am I getting it, or is there more to it? Also...

Error handling strategies for Microsoft HPC tasks

I have a .NET app that will be spawning tasks to run on an MS HPC cluster. We're not using any of that fancy DryadLINQ stuff, just remotely executing an exe on the cluster and passing arguments via the command line. The task will be .NET code, and I'd like the calling app to get an actual Exception object when an error occurs on HPC. Wh...

Are .NET Web Service proxy classes safe to use as Singletons?

I am using a Visual Studio generated proxy class for communicating with a SOAP web service. The generated class derives from System.Web.Services.Protocols.SoapHttpClientProtocol. I find the class is expensive to instantiate, so I am considering modifying my factory method to return a Singleton instance of the class. According to the d...

trouble animating GridLengths with star-values

Hi all. I'm using a third-party GridLengthAnimation class which is built to animate just like a DoubleAnimation class. I've used it many times before and it has never failed me - until now. I am trying to use it to expand/collapse part of my form based on the user checking a +/- checkbox to expand/collapse it. You know the drill. Th...

Can I set the app.config 'useLegacyV2RuntimeActivationPolicy' attribute progamatically?

I had to migrate a .NET 3.5 to 4.0 but some dll's were not loading, after googling I found that creating an app.config would solve it: <?xml version="1.0" encoding="utf-8" ?> <configuration> <startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0" /> </startup> </configuration> I would like to setup...

Replicating Java's DecimalFormat in C#

I am trying to replicate a subset of Java's DecimalFormat class. Below is what I've come up with. Does this look right to everyone? public class DecimalFormat : NumberFormat { int _maximumFractionDigits; int _minimumFractionDigits; string _format; void RebuildFormat () { _format = "{0:0."; ...

Silverlight clipping a string on mac

hello, I am facing a very strange issue in my silverlight app on all browsers on mac but it is working perfectly in all windows browsers. in my silverlight app there is a scenario in which I create a very long text string and then pass it to a wcf service which then saves the string in a text file server. the issue is that in mac every...

Best ways to format LINQ queries.

Before you ignore / vote-to-close this question, I consider this a valid question to ask because code clarity is an important topic of discussion, it's essential to writing maintainable code and I would greatly appreciate answers from those who have come across this before. I've recently run into this problem, LINQ queries can get prett...

.Net Ramifications of changing Thread.CurrentPrincipal

I've got a simple WPF 4.0 app that currently has no concept of user security. I need to add some very simple username/password based security and access the credentials in just a couple of spots, and want to utilize Thread.CurrentPrincipal. I am wondering what the ramifications of simply changing this property are? Will it affect the .Ne...

organize using directives, re-run tests?

Before making a commit, I prefer to run all hundred-something unit tests in my C# Solution, since they only take a couple minutes to run. However, if I've already run them all, all is well, and then I decide to organize the using directives in my Solution, is it really necessary to re-run the unit tests? I have a macro that goes throug...

LINQ to SQL serialization issue with SOAP object

OK, so this is the strangest issue in .net programming I have ever seen. It seems that object fields are serialized in .net web services in order of field initialization. It all started with Flex not accepting SOAP response from .net web service. I have found out that it was due to the order of serialized fields was statisfying the orde...