|
What I'm trying to achieve is two links under the application's Start Menu entry. One link opens the program connecting to the production database, the other link to the test database.
If there were some way I could do this with a single executable, I'd love to hear how.
But as I see it, two executables (of non-duplicated code) with two app.config files is the only way to do it.
|
|
|
|
|
Personally I use NSIS for writing installers but then you'd have the hassle of automatic updates etc. Perhaps WIX would be able to perform the updates? Not sure. I'll see what I can remember, there are some articles here which provide auto-update functionality for your program.
|
|
|
|
|
Automatic updates shouldn't be a problem... I don't foresee more development on this project, but even if there is, the old fashioned installation roll out is certainly acceptable (this is only for in-house use, and we're a pretty small shop).
|
|
|
|
|
Then just use an install system like NSIS. That's very powerful and free but only has a few designer like environments. There are others that will do the same job but easier initially.
|
|
|
|
|
If i have a Namespace as a string is there are any framework support to find the assembly file with the most closely matching name.
For example: If i have the assemblies x.DLL and X.Y.DLL. Then given the Namespace string 'X.Y.Z' - the 'X.Y.DLL' would be adopted.
Thanks
|
|
|
|
|
Nope. You'd have to build this yourself.
It shouldn't be too hard. From your description, it could be done just by getting filenames from a search of a directory structure and comparing themn to the search key using a RegEx.
|
|
|
|
|
Hi guys,
Please help! I have a windows service when started it goes out and retrieves a schedule from the database and stores it into a string array. Once the schedule is retrieved. I start my timer which calls the following code:
Every 45 seconds I am running MonitorFunc which checks whether the schedule is now to run a query. The question I have is whether the code section below is a good process that I am going by. Please help.
try
{
m_tMonitor = new TD.Timer(new TD.TimerCallback(MonitorFunc),1, 0,45000);//45 sec
if(m_sServerAddr==string.Empty)
{
m_sServerAddr=Dns.GetHostName();
}
if(m_nPort==-1)
{
m_nPort=1024;
}
IPHostEntry hostEntry=Dns.Resolve(m_sServerAddr);
IPAddress ipAddress = hostEntry.AddressList[0];
IPEndPoint ipEndPoint = new IPEndPoint(ipAddress,m_nPort);
m_svSocket = new Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
m_svSocket.Bind(ipEndPoint);
m_svSocket.Listen(10);
while(true)
{
Socket rtSocket=m_svSocket.Accept();
if(rtSocket.Connected)
{
TD.WaitCallback myCallBack = new TD.WaitCallback(ProcessClientRequest);
TD.ThreadPool.QueueUserWorkItem(myCallBack,rtSocket);
}
}
}
catch(Exception ex)
{
m_svSocket.Close();
m_tMonitor.Dispose();
}
Sameer
|
|
|
|
|
I'm suffering some issues at deployment time which seem to relate to various dlls etc not being available.
Is their a CLR version of the old depends tool that used to ship with visual studio? ie a tool that shows me which dependencies are broken rather than what the mainfest says the dependencies are?
Thanks
Russell
|
|
|
|
|
Reflector? It allows you to view the references, normally if it's in the path or the GAC then it can find it.
|
|
|
|
|
You don't need it. There is a Assembly Binding Log Viewer tool that tells you what happened.
In the MSDN docs, lookup "Fuslogvw.exe", or just Google for it.
|
|
|
|
|
brilliant thank you.
I'd completely forgotten about fuslog
|
|
|
|
|
I need to bind a textbox's text to an xmlElement's value.
<br />
TextBox tb;<br />
XmlNode nodeToBind;<br />
tb.DataBindings.Add("Text", nodeToBind, "Value");<br />
results in an ArgumentException (Property or Column for the datasource cannot be bound. parametername: dataMember).
any hints?
|
|
|
|
|
Hello,
I'm building an application which has an option to play a sound with the extern PlaySound method.
With the code below the PlaySound method is working
<br />
string fileName = @"C:\Documents and Settings\User\My documents\Visual Studio 2005\Projects\Alarm\Alarm\Resources\attention.wav";<br />
PlaySound(fileName, 0, 1);<br />
If I execute the program on an other computer the path will be different. So I need an function that will get the .wav file from my folder Resources. The standard way to access an embedded resource is to use the Assembly class's GetManifestResource* methods. But I can't get it to work properly.
This is proberly a very stupid question but i'm just a beginner and can't figure it out.
Can someone please help me out?
Thanks
|
|
|
|
|
JustRonald wrote: But I can't get it to work properly.
JustRonald wrote: but i'm just a beginner and can't figure it out.
If you are getting some error message you need to post that along with the relevant code. Read the first post in the forum titled "How to get an answer to your question".
led mike
|
|
|
|
|
There's an example here[^]
The only problem I've found is you need to specify the file's location as
"yournamespace.Resources.filename.ext"
e.g.
GetManifestResourceStream("My_App.Resources.new.wav");
Edit: You needto use Winmm.dll not Coredll.dll
Improved solution/example below
Dave
modified on Monday, March 3, 2008 2:51 PM
|
|
|
|
|
|
I thought this was something interesting that I could maybe use so I've had a play and the example below works (ringin.wav from C:\Windows\Media added to resources and BuildAction property set to Embedded Resource).
using System;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Load += new EventHandler(Form1_Load);
}
void Form1_Load(object sender, EventArgs e)
{
Stream wave = Assembly.GetExecutingAssembly().
GetManifestResourceStream(
MethodBase.GetCurrentMethod().
DeclaringType.Namespace + ".Resources." + "ringin.wav");
Byte[] waveData = new Byte[wave.Length];
wave.Read(waveData, 0, (int)wave.Length);
PlaySound(waveData, IntPtr.Zero, SoundFlags.SND_ASYNC | SoundFlags.SND_MEMORY);
}
enum SoundFlags
{
SND_SYNC = 0x0000,
SND_ASYNC = 0x0001,
SND_MEMORY = 0x0004,
SND_NODEFAULT = 0x0002,
SND_LOOP = 0x0008,
SND_NOSTOP = 0x0010,
SND_NOWAIT = 0x00002000,
SND_FILENAME = 0x00020000,
SND_RESOURCE = 0x00040004
}
[DllImport("winmm.dll")]
static extern bool PlaySound(byte[] pszSound, IntPtr hmod, SoundFlags fdwSound);
}
}
I've used SoundFlags.SND_ASYNC as it's in the load event but if you want it in FormClosing for example use SoundFlags.SND_SYNC
Dave
|
|
|
|
|
Hi Ronald,
there are some ways to solve your problem:
1. you can distribute your wav file in a specific subfolder of your application, e.g. Sounds. Then you just set the filename variable to the following value:
string filename = Application.StartupPath + @"Sounds\attention.wav";
Don't forget to include using System.Windows.Forms. or type the namespace with the Application.StartupPath
2. You add the audio file as manifest into your exe. Then you need to call the following function:
System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(typeof(Program), "attention.wav")
Note that you get a System.IO.Stream , so maybe need to save it in a temporary file and then call your PlaySound method (I don't know if your function supports a stream object as a parameter)
So, these are the ways, I retrieved quickly from my mind at 23:17 (German time)
PS: In the second solution I wrote typeof(Program). Program is a class generated by VisualStudio when you create a new project, so I used this here
I hope I could help you
_____________________________
The force of .NET is with me!
|
|
|
|
|
Does anyone know/have any control like calender, but only show month and year. So the user only need to select the month and date. I'm in a hurry and don't want to create my own control. tHanks.
|
|
|
|
|
If you don't have the day in the date, then the whole calendar paradigm doesn't work. In this case, you're better off with 2 combos. One for month and one for year.
|
|
|
|
|
Thank for the quick reply. But I'm hoping to find somebody who have made control consisting of two combobox , one for month and one for year.
|
|
|
|
|
To be honest, it'll take you longer to wait for the reply than it would to code it yourself. It's effectively two databound combos, so why not do it yourself.
|
|
|
|
|
Well, good idea. I'm starting to doing it by myself. It isn't as hard as I thought it will be.
|
|
|
|
|
Yulianto. wrote: I'm starting to doing it by myself. It isn't as hard as I thought it will be.
That's the spirit.
|
|
|
|
|