.net

WPF - jerky animations caused by closing windows

I've got an animation running on the main window (only window) of my WPF application. Problem is that this animation isn't running smoothly. This animation was constructed in a separate, empty project and worked perfectly (nice and smooth) until I transferred it to my main application. Now you're probably thinking what is the applicatio...

Is there a standard simple message/error reporting mechanism?

The other day, a co-worker created a simple interface to report errors/messages public interface IErrorReporter { void ReportError(string title, string message, string detail); } The goal is to keep lower-level "business logic" code free of UI such as MessageBox.Show(). My reaction is there has to be something already "out there...

Why I get Access denied when try to read file from ProgramFiles/MyApp?

Hi, I am trying to read from a config file in ProgramFiles/MyApp but in Windows 7 it throws an exception for Access denied, it is the same and for a file in ProgrammData/MyApp: fileStream = new FileStream(this.StorageName, FileMode.Open, FileAccess.Read); Is not it allowed to read only from these folders? ...

Have a Log4Net RollingFileAppender set to roll weekly

The DatePattern string needs to be something that the SimpleDateFormatter will accept. Unfortunately this means that, out of the box, this doesn't include being able to set the boundary to be a week number. There are ways of getting this value in C#, but it's not obvious that we can extend the SimpleDateFormatter or provide a different...

How to prevent a WPF app from loading?

I want that the WPF application starts only in certain conditions. I tried the following with no success: public partial class App : Application { protected override void OnStartup(StartupEventArgs e) { if (ConditionIsMet) // pseudo-code { base.OnStartup(e); } } } But the app runs normal...

Getting current Windows system input language and notifications when the language changes.

I am writing on screen keyboard application. The keyboard is running in separate process and the application window is topmost and does not get focus. When I switch between applications, the language is changed. How can I get the current selected language on toolbar and how can I be notified when it is changed? InputLanguageManager and ...

Create a designer-aware UserControl collection to be used runtime

I have a Panel I want to fill with some UserControl(s) at runtime. These controls are complex and may be interdependent, so I'd like them: to be editable with Visual Studio designer; to be in the same context (= defined in the same class); Both of the requirements are a must-have. Considering UserControl is itself an indexed collect...

How do I obtain a list of all schemas in a Sql Server database

Hi, I want to retrieve a list of all schemas in a given Sql Server database. Using the ADO.NET schema retrieval API I get a list of all collections but there is no collection for 'Schemas'. I could traverse the 'Tables', 'Procedures' collections (and others if required) and obtain a list of unique schema names but isn't there a easier/s...

help with reducing the number of connections to the database

I have a list of strings that are just invoice numbers. I am enumerating through this list to get the details of each invoice from the database. This list can easily be 700 to 1000 in size. the way I am doing it now results in 700-1000 connections to the database. this is taking too long to complete is there a better way to do this tha...

A couple of questions regarding TeamCity

I've wanted to install a CI server for a big project for quite some time, but didn't have the time needed, nor the people above me cared too much about it, they just said "that's interesting, and it could save us some time" but never made anything for it... I alreayd had some experience with CC.NET, but just in small projects, and for t...

How to read from terminal stream in java GUI application?

I have a hardware system that will be writing to the terminal stream. I need to be able to monitor that stream for updates (writes) from my java application. How can I do this? I've only ever interacted with the terminal in a pure console application. I could also write my application in .Net languages, so I'll accept answers for .NE...

How to check if a class implements an interface without navigating through its inheritance tree?

If I want to know if a class inherits IDisposable I have to Go To Definition in each of its parent classes and interfaces? Isn't there an easier way? ...

Can a .NET update/hotfix pull the rug from under my program's feet?

Say I deploy a .NET application, and Microsoft issues an update or a hotfix that changes the behavior of the .NET layer. Could this affect the predictability of my code, causing it to behave in an unintended manner, if my code is relying on some specific output or side effect of a given .NET method or component? And can I force my code ...

How to deal with circular references?

If I have those two projects: MyCompany.ERP.Billing MyCompany.ERP.Financial Billing asks/sends information to Financial and vice-versa. Both are too big so I don't want to put them in a single project. Visual Studio doesn't allow circular references. How would you deal with that? ...

Copy a file on a network path without transfering it to my own machine

If my .NET client uses System.IO.File.Copy to copy a file from \server1\share1\file1.txt to \sever1\share2\file2.txt, the file's data get read down to the client and then written back up to the server. Is there an easy way to speed up things a bit by putting a process on the network-machine that realy does the copying? I dont look for ...

Parallelizing GDI+ Image Resizing .net

I've tried to parallelize the resizing of jpegs using .Net. All my tries failed, because the Graphics.DrawImage-func seems to lock while active. Try the following snipped: Sub Main() Dim files As String() = IO.Directory.GetFiles("D:\TEMP") Dim imgs(25) As Image For i As Integer = 0 To 25 imgs(i) = Image.FromFile(files(...

Serializer that sees private data, has parsable output, supports generic collections, and supports custom serialization

I need a very specific kind of .NET serializer. My requirements: shouldn't skip private data output should be human-readable (or at least, easily parsable), preferably XML should support generic collections (no need to be easy, but it should be possible) should support custom-implemented serialization for specific classes. I need (2...

Read-only projects in Visual Studio?

Would there be any reason that VS would prohibit you to "Add existing file" to lets say a folder inside an assembly? Is it protected somehow? If so how and where is this done and how can I see if this is the case? There are some missing .cs class files in one of these folders that should be included in this project and I try adding ...

Windows Service won't automatically start after reboot

My automatically starting windows service fails to start only on reboot. I have a windows service created in C# and installed via a Wix created installer. The service is set up to start automatically. The service is installed and run under the NT AUTHORITY\NETWORK SERVICE. When the service is started, it first makes an external web ser...

Repository Pattern, POCO, and Business Entities

I know there are a lot of threads here already on the repository pattern but somehow I feel my question is a little different. May be because yesterday was the first time I heard of the word POCO. My question is this--usually, I have add and save methods in my business entities. Say I am writing a Q/A site, and I have the following e...