.net-3.5

Read-only Run elements in a WPF RichTextBox?

放肆的年华 提交于 2020-01-12 07:00:24
问题 I may be completely imagining this, but I could have sworn there was a way to make individual Run (or Parapgraph) elements in a RichTextBox read-only. I also could have sworn I tried a method for doing this out myself a few weeks ago and was satisfied with the results - I vaguely remember it looked something like this: <RichTextBox x:Name="richTextBox" AcceptsTab="True" AcceptsReturn="True" FontFamily="Courier New" FontSize="14"> <FlowDocument> <Paragraph> <Run IsReadOnly="True">I wish this

Abstract class or Interface for IoC service?

帅比萌擦擦* 提交于 2020-01-12 05:24:41
问题 I am currently using IoC for providing concrete implemenations of repositories in a project. All of the examples that I have read use an interface as the definition of the service. However, having read recommendations from Microsoft it is recommended to prefer abstract classes over interfaces. I have found this useful in conjuntion with the template pattern to reduce repetition. For example give a Product class with a property IsActive I could use an interface for the repository such as:

Running .NET 3.5 built Mixed mode assemblies in .NET 4 using app config requires Framework 3.5 as well

戏子无情 提交于 2020-01-11 09:28:11
问题 This is similar to already created thread here: Mixed mode assembly in .NET 4 Using the app config, I was able to force the assemblies to run on .NET 4. On an XP Machine, I installed just the .NET 4 (without .NET 3.5 or 2.0) and tried to run the built application. It fails to load the mixed mode assembly built in 3.5 framework in .NET 4 without the .NET 3.5 framework on the machine. Why should it depend on .NET 3.5 when I am forcing the application to run on .NET 4 using App config? 回答1: You

How are partial methods used in C# 3.0?

╄→尐↘猪︶ㄣ 提交于 2020-01-10 12:37:09
问题 I have read about partial methods in the latest C# language specification, so I understand the principles, but I'm wondering how people are actually using them. Is there a particular design pattern that benefits from partial methods? 回答1: Partial methods have been introduced for similar reasons to why partial classes were in .Net 2. A partial class is one that can be split across multiple files - the compiler builds them all into one file as it runs. The advantage for this is that Visual

Using a ComboBox, UserControl and some forms to change language (for entire project)

一个人想着一个人 提交于 2020-01-10 05:50:33
问题 Before I begin, I have researched and can't seem to find anything. Note I am very new to UserControl so this might be why it's proven difficult. I have a combobox in Form1 which when selected allows the user to change between a choice of 21 languages. I have created a UserControl that contains labels, buttons and checkboxes - adds to a form called Print. If a user selected French, how would I then implement the UserControl to change language for ALL forms in my project? UserControl: I have

How to get IE version info in Winform? [duplicate]

半世苍凉 提交于 2020-01-10 01:40:10
问题 This question already has answers here : Detect IE version from a WinForms application (5 answers) Closed 6 years ago . I am developing an winform application in .NET framework 3.5, using C#. In the application I need to display the IE version number, installed on the machine on which it runs. How can I do that, can anybody tell me? 回答1: You can read the version from the registry: var ieVersion = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Internet Explorer").GetValue("Version");

Function Imports in Entity Model with a non-Entity Return Type

橙三吉。 提交于 2020-01-09 11:07:51
问题 I have a stored procedure in my Entity Data Model and added it to the function imports. Problem is... Visual Studio generates the function code in the model's code-behind if and only if I specify the return to be an entity type. Scalar and null return types do not work. Visual Studio does not generate the function code when I choose them. Is there something I am missing, or is this a bug? Any work-arounds? Using Visual Studio 2008 v9.0.30729.1 SP (Service Pack 1) 回答1: It's not so much a bug

How to make .exe file programmatically set to run as admin always in vista?

爷,独闯天下 提交于 2020-01-07 08:20:30
问题 I have written a winform application in C#. When I run the program for some functionality it required admin permission. After Installation If I set the .exe file to run as admin manually (by clicking right mouse button on .exe file) then my program run perfectly. Now I need user not to set the run as admin property after installation by clicking right mouse button. I need to set this programaticaly somewhere in the code that user no need to bother about this. This specific problem is only

Combine And/Or with PredicateBuilder?

╄→гoц情女王★ 提交于 2020-01-07 03:39:09
问题 I have a list of Ids and I only want to do an AND on the first one and and OR on the subsequent ones. In the past, I have kept a counter variable and when the counter is 1, I do the And , but after that I do an OR , but I was curious if there was an easier way: foreach(string id in Ids) { predicate.And(x=> id.Contains(x.id)); //I want to do an And only on the first id. } This is what I have done in the past, but is there a more concise way: int counter = 1; foreach (var Id in Ids) { string i

Comparing 2 CSV files in C# advice?

六月ゝ 毕业季﹏ 提交于 2020-01-07 02:02:32
问题 I need to develop an application where two csv files are compared. The first file has a list of email addresses. The second list also has email addresses, but includes name and address info. The first list contains email addresses that need to be removed from the second list. I have the Fast CSV reader from the CodeProject site which works pretty well. The application will not have access to a database server. A new file wil be generated with data that is considered verified. Meaning, it will