.net-3.5

How can I create a simple 2D NURBS using XAML?

I need to create a spline with two endpoints and 'n' control points. As far as I am aware, a Bezier curve allows for only one control point, and a Bezier spline allows for two control points. However, I need to be able to add as many control points as I see fit, not limited to one or two. Here is an example of what I want to achieve, wi...

C#: Remove duplicate values from dictionary?

How can I create a dictionary with no duplicate values from a dictionary that may have duplicate values? IDictionary<string, string> myDict = new Dictionary<string, string>(); myDict.Add("1", "blue"); myDict.Add("2", "blue"); myDict.Add("3", "red"); myDict.Add("4", "green"); uniqueValueDict = myDict.??? Edit: -I don't care which k...

Reading and writing an existing xml file c# 3.0 / .net3.5

hi to all, I have a xml-file which I want to read. How can I do it? I would not load whole xml file at runtime (XmlDocument _xd = XmlDocument.Load(path)) I want to do it with Readers, but I can not achieve with it. At the same time I want to add nodes to this xml-file with writers. How do these work with XDocument or at c# 3.5. K...

If Statement Hell, How to check if a date passed matches a date within 3 days but only if the date doesnt match the other conditions.

As the garbled question says I'm basically looking for a tidier way to do the following snip. (its used in a calendar for availability matching) //TODO: Optimize elseif Statement if (date.Year == now.Year && date.Month == now.Month && day == now.Day) { daysXhtml.Append("<td class=\"today\">" + day.ToS...

How to I find specific generic overload using reflection?

I am attempting to create an Expression that will invoke a specific generic overloaded method (Enumerable.Average in my first test case). The specific type bindings are not known until runtime however so I need to use Reflection to find and create the correct generic method (the Expression is being created from parsed text). So if I kno...

Can anyone tell me were I am making mistake in the snippet

public partial class Form1 : Form { [DllImport("coredll.dll")] static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); const int GWL_WNDPROC = -4; public delegate int WindProc(IntPtr hWnd, uint msg, long Wparam, long lparam); public Form1() { InitializeComponent(); WindProc SampleProc ...

C#: Canonical HTTP POST code?

I've seen so many implementations of sending an http post, and admittedly I don't fully understand the underlying details to know what's required. What is the succinct/correct/canonical code to send an HTTP POST in C# .NET 3.5? I want a generic method like public string SendPost(string url, string data) that can be added to a librar...

What might cause SHChangeNotifyRegister to fail on windows mobile?

SHChangeNotifyEntry changeentry = new SHChangeNotifyEntry(); changeentry.pIdl = GetPidlFromFolderID(this.Handle, CSIDL.CSIDL_DESKTOP); changeentry.Recursively = true; uint notifyid = SHChangeNotifyRegister( this.Handle, SHCNF.SHCNF_PATHA , SHCNE.SHCNE_ALLEVENTS, ...

Convert BitmapImage to grayscale, and keep alpha channel

I'm having an issue with converting a BitmapImage (WPF) to grayscale, whilst keeping the alpha channel. The source image is a PNG. The MSDN article here works fine, but it removes the alpha channel. Is there any quick and effective way of converting a BitmapImage to a grayscale? ...

My sample app is getting crash while registering to Filechangeinfo notification

public partial class Form1 : Form { [DllImport("coredll.dll")] static extern int SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong); [DllImport("coredll.dll")] static extern IntPtr CallWindowProc(IntPtr lpPrevWndFunc, IntPtr hWnd, int Msg, IntPtr wParam, IntPtr lParam); [DllImport("coredll.dll")] public static exte...

In click once deployment how does it support client profile?

I am making a click once installer. I checked in prerequisites the .NET 3.5 framework to be installed. Please tell me that if i install my installer in a virtual machine which does not have any .NET 3.5 framework installed then how will it proceed? I tried but when i paste the URL in the browser then it shows me the page cannot be displa...

Writing the results of a FOR XML query to a file with C#.NET

Hello, I'm trying to write the result of a FOR XML PATH query to a file. I can generate the file, but it doesn't contain the results of the query. Any one know where i'm going wrong? private static void GetChartData(string OC_Ttl1, string OC_Ttl2, string OC_OL31) { //Prepare Connection Variables SqlConnection conn_...

Regex for Comma Separated Number or Just Number

This is something of a follow up from a previous question. The requirements have changed, and I'm looking for some help with coming up with regex for either a comma separated number or a number with no commas. Sample input is below, along with some failed attempts. Any help is appreciated. Acceptable input: 1,234,567 1234567 Unaccep...

Window Service In C# (ServiceProcessInsaller) -- Error 5: Access is Denied.

Dear, I am using Visual Studio 2008 and .NetFramework 3.5. I developed one windows service application in c# using FileSystemWatcher. The main goal of this project is watch an Folder and need to write the modification status in a text file (FolderWatchLog.txt). That text file appeared on another folder. In ServiceInstaller I specified ...

SelectList Dropdowns in C# (Selected value)

Ok I have the following Code #region getDurationListDD private List<KeyValuePair<int, int>> getDurationListDD { get { List<KeyValuePair<int, int>> dDur = new List<KeyValuePair<int, int>>(); dDur.Add(new KeyValuePair<int, int>(2, 2)); dDur.Add(new KeyValuePair<int, int>(3, 3)...

Question about programmatically changing crystal reports

General info: C#, VS2008, .NET 3.5 I've got a form with a crystal report viewer inside it, and i'm wanting to use the one form to display all of my crystal reports. I've got it so that i can programmatically change the report, the only problem is that i have to a new method for each crystal report. I'm wanting to create a single method ...

Anyway to make a IList.Contains() act more like a wildcard contains?

Hi there, I am trying to parse thru a csv string, put the results into a IList collection and then trying to find a way to do a wildcard 'contains' based on what was passed in. Right now I have the following: public static IList<string> DBExclusionList { get { Regex splitRx = new Regex(@",\s*", Reg...

Linq to Entities and SQL Server 2008 hierarchy id

Does Visual Studio 2008 SP1 / .NET 3.5 support Linq to Entities (ADO.NET Entity Data Model / edmx) with SQL Server 2008 R2? Specifically, the hierarchy id type? If so, do you have a download link, if not is there a published date when this feature will become available? I experimented a bit today after installing GDR R2 to support Sql...

ASP.NET - Learning .NET Framework 3.0 / 3.5

I would like to learn ASP.NET (Complete .NET Framework 3.0 / 3.5) and not getting time to attend training classes in any training center. Kindly let me know if you know if there are any other good alternates/options to learn. Kindly provide the details too. ...

Securing WCF REST service for use with iPhone application

Hi all, I've a created a simple WCF REST service which I intend to consume from an iPhone application. The service works fine but now I'd like to secure it. In my test enviornment (IIS on Windows 7) I already setup a self signed certificate using makecert.exe. I also overridden the validate() method so I can use a custom username & pa...