|
Hi!
The proxy is created when you call Activator.GetObject() but until you actually call any method on the remote object, there's no need to establish a network connection to the server.
From my understanding, the remoting infrastructure doesn't hold the network connection open all the time and chokes whenever the remoting server goes down, but is only interested in whether the server can be reached during method calls to the remote object.
So the only way to find out whether the server is running is to actually call a method on the remote object. For one of my projects I added a simple Available property (always returning true ) to the server object so that I have a method to call without any sideeffects.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
I have a combo box that I need to make first item in list blank. Here is the code that loads the combo box:
aAdaptor = new OleDbDataAdapter(aSQLQuery, aConnection);
aAdaptor.Fill(aDataSet);
cBox.DataSource = aDataSet.Tables[0];
cBox.DisplayMember = aDisplayName;
cBox.ForeColor = Color.Blue;
This code all works great, it loads the combo as I need. But I cannot figure out how to get the first item in the list to be blank.
Would appreciate any ideas here.
Thanks, Vern
Vern
|
|
|
|
|
You'll need to add an empty entry to your dataset. That's the only way I'm aware of.
|
|
|
|
|
You can insert an item in the DataSet before data binding, or insert an item in the combo box after data binding.
---
single minded; short sighted; long gone;
|
|
|
|
|
Is it possible to add a reference to a C# project only for a given solution?
Instead of a separate test project, I'd like to have the Unit tests in the same project, activated by a specific configuration (declaring NUINIT, having a different debug command line and being the only one that references nunit.framework)
|
|
|
|
|
(Erasing everything since I just re-read the question and really understood it)
I know you can easily do all of it, except referencing nunit.framework only on certain configurations. Maybe a #pragma (in C++ you could set the linker's command line from the source file).
If you find out how, I'd be interested to know.
|
|
|
|
|
As far as I know, the project references are really only needed by the Visual Studio IDE to inform the compiler what additional assemblies to compile/link against.
You should be able to add the NUnit reference to the project, add your conditional symbol, and wrap the using nunit.framework and your test code in a #if NUNIT directive. You might also want to decorate the test methods with a Conditional attribute as well.
This should give you what you are looking for. Personally, I prefer my unit tests in a separate project. If you're worried about trying to unit test internal/private methods you might want to consider using code coverage analysis to ensure that all of your code is being tested.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|
|
Hello All!
There are plenty of examples of excellent volume controls out there with slide bars and other fancy gizmos however I have a slightly different requirement for setting volume.
I mainly do programming within a certain application that uses its own internal sound engine to read .WAV files.
The problem is that wav files of over a certain quality can cause serious distortion if the "WAVE" option is set at anything over 50% in the sound control panel (Standard windows XP)
I wish to create an application in C# that simply has two buttons, one for high quality sound files that sets the Wave volume at 50% and the volume control to 100%, and one for normal quality that sets both at 100%
Could some kind soul possibly help out? I understand it is probably an incredibly simple problem to most on here but most my programming is XML variables and I have only recently begun to work with C#.
All the best,
Alex
|
|
|
|
|
You could use the SecondaryBuffer[^] class in Microsoft.DirectX.DirectSound to play your waveform and set its Volume property to Volume.Max / 2 to get 50% volume.
If you're asking how to set the actual soundcard mixer, I believe there is an API to do that, though probably not managed. But I'm not familiar with it.
|
|
|
|
|
Hi!
This article[^] gives you a library to work with the windows audio mixers. You can use these classes to set the volume for every mixer line you need.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Hello experts,
I'm using the System.Runtime.Remoting.Channels.Ipc namespace, and other remoting-related classes to communicate between instances of my app.
I have registered a class using the RemotingConfiguration.RegisterWellKnownServiceType() method, specifying WellKnownObjectMode.Singleton .
AFAIK, normally, the server automatically creates an instance of the object when the first request for the object is made, and for any request which follows, only returns references to it.
What I would like to do, is to be able to create the first instance myself, and have the clients requesting the object receive the reference to MY object.
Is it possible? How?
Hope I made myself clear enough...
Thanks in advance,
Shy.
|
|
|
|
|
Maybe if the application creating the server would also create a temporary client which would instantiate the first instance of the class?
|
|
|
|
|
Hello!
The RemotingServices.Marshal() method does exactly this - it publishes a given instance of an object as remoting server.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Thanks a bunch!
Greatly appreciated!
Wow... there are times I tell myself "Microsoft are really f***ed-up for not having an implementation for this and that in the .NET framework."
But then there are times I think the .NET framework contains everything a programmer needs...
Regards,
Shy.
|
|
|
|
|
I would like to use C# for writing a program to compile file html to file XML.How should I do? anyone help me?
|
|
|
|
|
turoi wrote: compile file html to file XML
|
|
|
|
|
You cannot compile HTML or XML. I thnk you mean to convert HTML to XHTML ? You'd have to write a parser to do that.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
There's already a program for this, HtmlTidy.
|
|
|
|
|
To start, this is what I'm trying to do:
I have a custom style for my TreeViewItems in my WPF application. They do not have the small (+) expanders on the sides of my root items, and I don't want them anyway, so I have to double-click my TreeViewItems that have child items in order to expand them. I would rather my users have to single-click those TreeViewItems to expand them, showing the child items.
My problem is that the SelectedItemChanged event is not being fired when I select an already selected TreeViewItem, not allowing me to set the IsExpanded property in my event handler.
I have two options:
1. To find an easy way to expand my root TreeViewItems by single-clicking them instead of double-clicking them.
2. To allow the SelectedItemChanged event to fire even if the object I'm clicking on is already selected.
How do I either fire the SelectedItemChanged event if the selected item of the event is already selected?
For instance, I select one item in my TreeView, I select it again. However, the SelectedItemChanged event is not fired again because it's already selected, and technically not changed.
I tried using TreeView.MouseLeftButtonDown to test a click on my TreeView, but the event wasn't even firing because the SelectedItemChanged event was being fired when I would select items.
I've also tried setting the selected TreeViewItem's IsSelected property to false.
Any suggestions?
I appreciate your help in advance!
~ Doc
|
|
|
|
|
Try using the NodeMouseClick event.
Extract the clicked node from the e argument passed to the event, and call its Expand() method.
Regards,
Shy.
|
|
|
|
|
Sorry, I forgot to mention my application is a WPF application, so there isn't a NodeMouseClick event...
|
|
|
|
|
No... you did not...
I'm the one who didn't see it...
|
|
|
|
|
|
I'm using Visual C# Express Edition and the XNA Game Studio add-on.
If I want to include a System.X file by just writing "using System.X.Y" in the top of the program the compiler says he cannot find the files. I heard that there is another possibility to include the files so that's working (that should work somehow with the menu). If anyone knows how it works please write it in the message board.
Thanks.
Ich benutze Visual C# Express Edition mit der XNA-Game-Studios Erweiterung.
Wenn ich eine System.X-Datei einbinden will, und nur "using System.X" am Anfang des Programms schreibe, meldet der Compiler, er finde die Dateien nicht. Ich habe gehört, es gebe auch noch eine andere Möglichkeit die Dateien einzubinden (soll irgendwie über das Menü funktionieren).
Ich habe bis jetzt noch nicht herausgefunden, wie das funktioniert. Wenn es jemand weiß, bitte ins Forum schreiben.
Danke im Voraus.
|
|
|
|
|
Writing using This.That; doesn't include anything in your project.
It's just a shortcut for writing This.That. in front of every class living in this namespace.
You'll have to add a reference to the assembly containing these classes via the project explorer ("Add reference..."/"Verweis hinzufügen...") so that the compiler is able to find the corresponding classes.
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|