.net-3.5

How can I make sure only one WPF Window is open at a time?

百般思念 提交于 2019-12-30 10:26:21
问题 I have a WPF window that I am launching from inside of a winform app. I only want to allow once instance of that WPF window to be open at a time, and not warn that user if they try to open it again. I am having a problem however trying to search for that WPF window being open because the window is being launched from a winform. What I normaly do is when searching for a winform, I search for any instances of that winform existing in the Application.Current.OpenForms , and when in WPF I search

Wrong App.config being loaded

断了今生、忘了曾经 提交于 2019-12-30 09:57:06
问题 I have a .NET 3.5 class library I built that reads an App.config file for values it needs. It can pull the config values just fine when I test it in Visual Studio. To test it, I just change the project to a console application and execute a method call. I have the need to call this class library from many other .NET programs, and I want the class library to be self sufficient (I should be able to call it from any other program, and it should use its own config file, not know about any calling

C# 3.0 compatibility on .Net 2.0

心不动则不痛 提交于 2019-12-30 09:53:19
问题 What are the C# 3.0 language features we can use in an application that targets .Net 2.0 framework ? PS:I know few like Lambda expressions and var keyword 回答1: Please see here: Using C# 3.0 (.Net 3.5) syntax in a .Net 2.0 application For a complete run down of what you can and can't do when targeting the .NET 2.0 Framework and using C# 3.0. In summary: You can't use the new 3.5 assemblies (System.Data.Linq, System.Xml.Linq, System.Core). You can't use Linq/Query Extensions or Extension

How to bootstrap .NET 3.5 SP1 with msbuild? following found instructions doesn't work

巧了我就是萌 提交于 2019-12-30 09:07:41
问题 I'm trying to use msbuild GenerateBootstrapper task to distribute a .net application with the framework, without the need of internet connection to install it. I've found many posts that all lead to the same instructions in here: Enable Samesite for the .NET Framework 3.5 SP1 bootstrapper After following the instructions, I still cannot generate the bootstrapper. The more obvious issue I can see is that extracting the files from dotNetFx35.exe does not extract the same list of files and

How to remove yourself from an event handler?

一曲冷凌霜 提交于 2019-12-30 08:33:28
问题 What I want to do is basically remove a function from an event, without knowing the function's name. I have a FileSystemWatcher . If a file is created/renamed it checks its name. If it matches, it then moves it to a specific location. However, if the file is locked, it makes a lambda that attaches to a timer's tick event, waiting until the file is not locked. When it isn't, it moves the file and then removes itself from the event handler. I've seen lots of ways to do this, like keeping the

Threadsafe FIFO Queue/Buffer

别说谁变了你拦得住时间么 提交于 2019-12-30 06:18:49
问题 I need to implement a sort of task buffer. Basic requirements are: Process tasks in a single background thread Receive tasks from multiple threads Process ALL received tasks i.e. make sure buffer is drained of buffered tasks after a stop signal is received Order of tasks received per thread must be maintained I was thinking of implementing it using a Queue like below. Would appreciate feedback on the implementation. Are there any other brighter ideas to implement such a thing? public class

XmlSerializer changes in .NET 3.5 SP1

本小妞迷上赌 提交于 2019-12-30 05:03:44
问题 I've seen quite a few posts on changes in .NET 3.5 SP1, but stumbled into one that I've yet to see documentation for yesterday. I had code working just fine on my machine, from VS, msbuild command line, everything, but it failed on the build server (running .NET 3.5 RTM). [XmlRoot("foo")] public class Foo { static void Main() { XmlSerializer serializer = new XmlSerializer(typeof(Foo)); string xml = @"<foo name='ack' />"; using (StringReader sr = new StringReader(xml)) { Foo foo = serializer

XmlSerializer changes in .NET 3.5 SP1

我只是一个虾纸丫 提交于 2019-12-30 05:03:16
问题 I've seen quite a few posts on changes in .NET 3.5 SP1, but stumbled into one that I've yet to see documentation for yesterday. I had code working just fine on my machine, from VS, msbuild command line, everything, but it failed on the build server (running .NET 3.5 RTM). [XmlRoot("foo")] public class Foo { static void Main() { XmlSerializer serializer = new XmlSerializer(typeof(Foo)); string xml = @"<foo name='ack' />"; using (StringReader sr = new StringReader(xml)) { Foo foo = serializer

Can I dynamically add HTML within a div tag from C# on load event?

拟墨画扇 提交于 2019-12-29 12:13:44
问题 Mind you, I am using master pages, but can I locate a div within the page and throw some html in there? Thanks. 回答1: You can add a div with runat="server" to the page: <div runat="server" id="myDiv"> </div> and then set its InnerHtml property from the code-behind: myDiv.InnerHtml = "your html here"; If you want to modify the DIV's contents on the client side, then you can use javascript code similar to this: <script type="text/javascript"> Sys.Application.add_load(MyLoad); function MyLoad

How to query MS Access database with C# application?

烈酒焚心 提交于 2019-12-29 08:51:33
问题 I have an application that uses Microsoft.Office.Interop.Excel to pull data from an Excel workbook. The information in the Excel workbook has been moved to an Access database, and I have been tasked to update the application, so that it will look for the data in the database. I found the Microsoft.Office.Interop.Access reference, but how do I use it to open the database and run queries? The documentation on this on MSDN seems to be somewhat lacking. Maybe I'm looking in the wrong place... :\