.net

Can I register my types in modules in Unity like I can in Autofac?

I am fairly familiar with Autofac and one feature that I really love about Autofac is the registering of modules. Does anyone know how I can do this with Unity? I'm having a hard time finding which terms to use in Google to come up with the unity equivalent if there is one. public class Global : HttpApplication, IContainerProviderAc...

Windows requires a click to activate a window before a second click will select a button. How can I change this?

My application is a C# Windows Forms Application and .Net somehow makes the default behavior of my main menu bar and tool strip buttons to be that you have to first click on my app's window (anywhere), before it will let you click the menu or tool strip button. How can I change this? Old apps like Notepad and WordPad don't behave this w...

are there tutorials on how to name variables?

as you can probably tell from my previous posts i have horrific naming conventions. do you know of any tutorials dealing with how to name stuff? ...

List data from a webservice in datagrid WPF

Hi all, i am trying to list data from a webservice in a datagrid (wpf), but i dont know what i doing wrong, or gives me errors or dont list anything. This is how i have right now. WINDOWS.XAML <Window x:Class="IssueAddinOutlook.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.mi...

Should app developer have to explicitely allow enabling tracing via the app.config file?

Let's have a class, which is able to log it's operations to a trace file. This trace file might include sensitive data (like usernames or hostnames). Tracing can be enabled in code like this: MyClass instance = new MyClass(); // turn on tracing for this instance instance.LogWriter = new FileLogWriter("path_to_trace_file"); It should ...

Does dynamic GroupBy work together with dynamic Where in dynamic LINQ ?

I use this dynamic LINQ library together with Linq-to-Entities. I build query and after that iterate it with foreach(object e in query){} query=db.Table1.Where("it.FieldA>10").Select("it.FieldB"); works. query=db.Table1.Where(e=>e.FieldA>10).GroupBy("it.FieldB", "it").Select("key") works. But query=db.Table1.Where("it.FieldA>10").Grou...

XML Digital Signature in .NET

I would Like to know which type of certificate do I need to get from a Certification Authority to Sign an XML Document in .NET ? We have a xml eletronic invoice that we need to sign using a Digital Certificate. Any thoughts? ...

FluentNHibernate mapping settings - file storage in SQL Server database

Hello, I've read various things but I didn't see something specific, so I'm reposting. Sorry if I missed one and duplicate posted. I am storing files in a database; previously, with ADO.NET Entity Framework, I would use image type and it streams it as byte[] array. Is that the approach to do it in NHibernate with FluentNHibernate map...

When to use THIS keyword when working with controls on form in C#

I am still far away from mastering C# but child in me pushing me to programming day by day. When I making WinForm application I want to change and use lot of controls pragmatically. What I do not understand is, When I need to set this.control keyword and when I should use just control. Sample: If I want to cgange text of my label I can w...

folderbrowserdialog on C# winforms

I am using folderBrowserDialog in my winform. I need the default or initial path to be a network location. for eg: folderBrowserDialog1.SelectedPath = @"\\server1\foo\bar\"; This does not work. My system is on the right network and I am able to access the directory thru my browser and run command. Is this a non-feature? or is there...

Trying to load a list into a DataGridView Cell

I'm trying to display an object into a DataGridView using Reflection so far everything works smootly but the problem is that some of the object's properties are Lists. How can I adapt my DataGridView to show a list? public void SetDataSource(PluginBase plugin) { dgvProperties.Rows.Clear(); List<DataGridViewRow> rows = new List<...

Building a reversible StackPanel in WPF

I'd like to build a custom StackPanel with a ReverseOrder property that I can declaratively set to true to have the elements in the StackPanel appear in the opposite order of normal (e.g. bottom to top or right to left). It needs to be reversible on the fly. I'm thinking of deriving a new class from StackPanel, but I need to know what m...

Make nested for loop algorithm - dynamic

I have an algorithm that goes something like this: for m = 1 to 2 initialize(work_item(m)) for l = 1 to 2 initialize(work_item(l)) for k = 1 to 2 initialize(work_item(k)) for j = 1 to 2 initialize(work_item(j)) for i = 1 to 2 initialize(work_item(i)) doSomething(work_item(i)) ...

generate WSDL from java WS

Given a public SOAP web service and no WSDL, I need to build a .NET client that can communicate with this service. I'm a .NET dev looking for a simple way to generate a WSDL file given this url? I'd prefer to do this with some tool directly from my windows development machine but the only thing I've found is the javatowsdl tool in Ap...

.NET 4 function : Function argument question

I'm following a tutorial on MVC on the .NET 4 framework. The tutorial created a function like this... using System.Web; using System.Web.Mvc; namespace vohministries.Helpers { public static class HtmlHelpers { public static string Truncate(this HtmlHelper helper, string input, int length) { if (inpu...

Creating a Stack<T> with anonymous type

Hi people, I have the a class Foo like this: class Foo { public int id{get;set;} public IEnumerable<Foo> Childs; //some other properties } Now I want to process some business logic on a Foo-Object and all it's children like this: public void DoSomeWorkWith(Foo x) { var firstItem = new {level = 0, item = x}; var s ...

C# .NET Application Settings and Upgrading

I use Settings.Default.MySettingName & Settings.Default.Save to save and load settings. When I change my version number how am I able to get the settings from the old version and apply to them my new version? I just can't quite figure it out. ...

Highlight gridview row in update panel without posting back

Hi I have a gridview in an update panel with the following code to select a row, this in turn updates another updatepanel with details from the form record. protected void gvMainGrid_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //Make the enti...

creating hidden files using .NET

How can I create or mark a file as hidden using .NET? ...

Accessing a variable in one .NET program, from another separate .NET program

I have several WinForms .NET programs that are started using ClickOnce. The user logs into one application and is given a logon ID. I need to be able to get a copy of this ID from the other programs. Could anyone tell me how to do this using remoting, reflection or something! If you could point me at an example that would be great. The ...