.net

Progress Monitor implementation in C#

Hi, In Eclipse I saw an implementation of IProgressMonitor - which is subsequently in SharpDevelop too but I'm not sure how this works. Is there an example of this elsewhere that might be a bit easier to understand? What I'm trying to achieve is a method of tracking the progress of a bunch of tasks (which vary greatly from 20mins to 5s...

API call to render the output of an App (win) to a image

Hello guys, I need a to build a application (.NET) that given the pid of another app continually makes printscreens of that app to make a video... I'm using the API call: new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb); the problem I've is speed.... Any ideas ? ...

Click-Once Alternative Icon Locations

Is there any features inside click-once to push multiple shortcuts? (Such as to desktop, Startup Menu, etc) In the past I've always done that as part of the form load event of my deployed application (installation triggers the application to launch--thus I can use form load to complete the setup process). I'm wondering however if that...

How do I list the requesting user's roles in a WCF service?

Hi Just started getting to grips with WCF security. How do I list a user's roles at the service? E.g. // Could use declarative security here, i.e. using PrincipalPermission attribute public string MyService() { // Would like some code that does something like: foreach( Role role in CurrentUser.Roles ) { } } Thanks ...

Relaying a request in asp.net (Forwarding a request)

I have a web application that communicates between two different web applications (one receiver and one sender, the sender communicates with my application, and my application communicates with both). A regular scenario is that the sender sends a HttpRequest to my application, and I receive it in an HttpHandler. This in turn sends the H...

String casts

Hi Why is there so may ways to convert to a string in .net? The ways I have seen are .ToString, Convert.ToString() and (string). What is the Difference. ...

Is there a way to create a second console to output to in .NET when writing a console application?

Is there a way to create a second console to output to in .NET when writing a console application? ...

Why 1.0f + 0.0000000171785715f returns 1f ?

After one hour of trying to find a bug in my code I've finally found the reason. I was trying to add a very small float to 1f, but nothing was happening. While trying to figure out why I found that adding that small float to 0f worked perfectly. Why is this happening? Does this have to do with 'orders of magnitude'? Is there any workar...

How to bind ASP.NET Treeview control to a datatable?

I have this table structure: - CategoryID - CategoryName - ParentID I want to load data from this table into a treeview control, to be able to edit/delete these records. How to do that? ...

What does a C# for loop do when all the expressions are missing. eg for(;;) {}

I can only assume it's an infinite loop. Can I leave out any of the three expressions in a for loop? Is there a default for each when omitted? ...

What is the best way to efficiently extract a small random subset of a large enumeration?

What is the best way to grab n items from an IEnumerable<T> in random order? I'm writing a store API and need to provide a small set of random items from a sometimes huge enumeration of items. The underlying enumerable is sometimes an array, and sometimes a lazy evaluated filter of said array. Since I'm just grabbing a proportionally ...

Linq To Sql Need Dynamic Where Clause over relational tables Help?

I need Help for dynamic where clause over relational tables (one to many) in LinqToSql. User select conditions from page. (there is 4 input that user select the clauses) For example CompanyName and CompanyTitle from Customer table and OrderDate and ShipCity From Order table. But user can select one ore many of them from page interfa...

in c# when returning a string from a function does the memory get freed?

This is what I mean: class mycalss { string myfunc() { string str="hello"; return str; } } ... static void main() { string str2; str2=myfunc(); ... ... } In this case is there a risk that the garbage collector might delete the contents of str2 because str went out of scope? ...

Connection string for a L2E web app

We have a class library (ProjA) which has L2E object context. This will be used in an Website (ProjB) and WCF Service (ProjC). How do I specify the connection string in the website (ProjB) web.config so that it uses the resource files from the class library project (ProjA). connectionString="metadata=res://*/db.csdl|res://*/db.ssdl|res:...

Who copies app.config to app.exe.config?

I'm writing a game development IDE that creates and compiles .NET projects (which I've been working on for the past few years) and am in the process of updating it to generate output not only for Windows/Visual Studio, but also for Linux/MonoDevelop (a thrillingly simple process for .NET, but still requiring some tweaks). As part of th...

How do I use the MS DIA SDK from C#?

I'm trying to use the Microsoft Debug Interface Access SDK from C#. This is installed with Visual Studio, but the docs don't seem to mention how you use this from C#. I've found example code on interweb but no information on how to link to the DIA SDK. I.e. I can't import it as an assembly. I don't think I have to include it into a mana...

How to interface with Windows Media Player in C#

I need to synchronize Windows Media Player with my application. I want to show the current song that WMP is playing in a ListBox in real time, with updates when WMP changes songs. How can I implement this? ...

Using .Net OnSerializingAttribute to alter variable names?

Hi, in order to obfuscate application code but still be able to use serialization to save application data, I want to map the names of all serialized members to custom serialization names. I know that I can achieve this by implementing the ISerizableInterface, but in the MSDN they suggest the use of OnDeserializedAttribute, OnSerializin...

Sys.InvalidOperationException: Handler must be a function.

I've a webpage which contains a TabContainer <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> ... .... <form id="form1" runat="server"> <asp:ScriptManager ID="sm1" runat="server"></asp:ScriptManager> <cc1:TabContainer runat="server" ID="tbcTabContainer" OnClientActiveTabChanged="Change...

Registering Types at Runtime

I'm trying to figure out how to register a type at run-time using unity. Any Suggestions? Basically I want to be able to do this: Container. RegisterType(Of IMyInterface)( Type.GetType("Fully Qualified Type Name")) ...