.net

Using a WPF controls own properties in Command Binding

I have a ToggleButton. I'm using a command binding, and I want to pass the value of its IsChecked property as a parameter. How can I do this without naming the ToggleButton and using its name to address itself? Currently I'm solving this by naming the control, but I assume this can be done a better way? <ToggleButton x:Name="_myToggl...

.NET data-based application architecture suggestions, opinions, good practices

Hello, I'd like ask a question about building applications in .NET that use data from a database. There are many technologies and patterns and I'm trying to connect it all. I'm building a desktop application with local database, so I choose SQLServer CE + WinForms, but I'd like to keep this as general as possible. I'm not into other tec...

c# richtext editor with smarttags

I'm looking for a richtextbox control which preferably has support for custom smart tags. The standard rich text editor in .net is a bit limited, so I'm just wondering if someone has a control to recommend. Some features I'm looking for is - being able to represent links with a different text than the link itself - being able to add a c...

How to get the first element of IEnumerable

Is there a better way getting the first element of IEnumerable type of this: foreach (Image image in imgList) { picture.Width = (short)image.Columns; picture.Height = (short)image.Rows; break; } This is the exact declaration of the type: public class ImageList : IEnumerable, IDisposable ...

Windows7 Installer takes priority how to move it back during installation using C#?

I've a custom Action on Deployment project of .NET Applicaiton, which contains custom dialogbox to enter certain parameters, on invalid parameters I've shown MessageBox.Show - but its being hide by installer window, I tried windows forms too with Activate, TopMost, Focus,bring2front, etc serveral options but it comes by default behind th...

Good Libraries for generating .net proxies

I am on the look out for a library that can generate .net proxies for me.... I came through Castle Dynamic Proxy and it looks a good one..... Any other libraries which i can give a shot.... ...

How can I read image from Stream with ImageMagick.Net library

I have a stream that has a picture. I need to write this picture to disk with a name in the format: "width x height". The problem that I'm getting the picture dimensions with ImageMagick. but ImageMagick cannot read files from the memory, but only from the disk. Is the only solution is to create a temp file, read it, and write another ...

Creating Micorosft Office Outlook message programmatically

I want to create the Microsoft Office Outlook message programmatically... i.e. the .msg file Is it feasible? If yes, how? I know about System.Net.Mail namespace and can create an object of MailMessage class. But how can I create a .msg file using this object? ...

Call remote dll

Hi! Which is the best way to call remote dll? Where can i find examples for this? Thanks! ...

How to send email using microsoft publisher in body using c#

Hi I have a new requirement. How can I send a newsletter in the body content in a mail . The newsletter is made from Microsoft Publisher application. Kindly let me know if you need more info. Thanks ...

Why we use .class file in ASP.NET ?

Why we use .class files ASP.net? Cant we use multiple classes as inline in the default.aspx.cs (codebehind) ? haha..yea i dont have any idea..so question is we do not use in ASP.net ? then where we will use? ...

Are ASP.NET Cache values scoped equally or more narrowly than a static variable?

In order to synchronise access to a Dictionary object in the ASP.NET cache, it is recommended that a synchroniser object be used. Dino Esposito recommends a static variable as the target for locking (See http://www.drdobbs.com/cpp/184406369). However, this will only work if the ASP.NET Cache values have the same scope (or narrower scope...

Run an exe when machine starts

I have created an SMS application in .NET. I wanted that the application should run when the computer starts, even before the user logs in. Just like the SQL Server. ...

FileSystemWatcher

Hi, I need to write some code that will copy file from directory when the file will change. I know C/C++ (little bit :]) but I never used .net. Am I thinkig good? First I create new thread with FSW and then when change will occur create next thread that will copy file? ...

NHibernate query problem

Hi all, these are my entities (simplified): public class IdentificationRequest { private int id; private ICollection<IdentificationRequestStateHistoryItem> stateHistoryItems; public virtual string Id { get { return id; } private set { id = value; } } ...

Binding WPF Canvas Children to an ObservableCollection

In my WPF application I have a Canvas in which I do some drawing. Earlier I handled the drawing in the code behind, but now I've factored everything out to a ViewModel. This gives me some challenges.. I have a few InkPresenter objects holding Strokes. Earier I added them as children to the Canvas in the code behind - like this: // Bu...

How to add help to winform c# application.

I want to know that how can I add help support to my winform app. How do I create chm file for help and how do I integrate it with the application. I want help for almost every control in my application. ...

Are IDisposable objects meant to be created and disposed just once?

I'm using a huge binary tree like structure whose nodes may or may not make use of unmanaged resources. Some of these resources may take up a lot of memory, but only a few of them will be in use at a time. The initial state of the tree can be seen as 'dormant'. Whenever a node is accessed, that specific node and its children will 'wake ...

How to assign separate thread for each File System Watcher?

I am developing a database file system.It includes a multi-directory watcher which is a windows service and which uses the file system watcher class from .net. I want to run each watcher class on separate thread.Thread can not be extended in .net because as it is "Sealed". What I want is, run all the methods of my watcher class in the r...

Can I remove items from a ConcurrentDictionary from within an enumeration loop of that dictionary?

So for example: ConcurrentDictionary<string,Payload> itemCache = GetItems(); foreach(KeyValuePair<string,Payload> kvPair in itemCache) { if(TestItemExpiry(kvPair.Value)) { // Remove expired item. Payload removedItem; itemCache.TryRemove(kvPair.Key, out removedItem); } } Obviously with an ordinary Diction...