|
|
OK lets say I've got a form that sets regestry values. I must add an installer class to that project and then add that project to the custom actions. Is that right?
Stephen Lintott Bsc IT (RAU)
|
|
|
|
|
Yes that's along the right lines.
Generally your project will output a single assembly (exe / dll). That assembly may have some requirements that need to be created at installation time - in your case, registry entries.
So you build an installer class into each assembly, which handles the requirements for that assembly.
So your installer class in this case, will read the parameters that are passed to it from the msi (which the user typed into the msi gui). It will then use these parameters when creating the registry entries.
The assembly in question needs to be added to the custom actions - this is how the msi knows to look into that assembly and find the installer class and call its methods.
The mapping between the msi gui fields and the CustomActionData property of the custom action in the deployment package designer is something like this:
/MasterClientID=[MASTERCLIENTID] /LoggingPath=[LOGGINGPATH] /LogMsgsPath=[LOGMSGSPATH] /LogDbConnStr=[LOGDBCONNSTR]
The code for retrieving the parameters in the installer is something like this:
public override void Commit(IDictionary savedState)
{
string mstrClientId = Context.Parameters["MasterClientID"];
string loggingPath = Context.Parameters["LoggingPath"];
|
|
|
|
|
Hi,
how can i create crystal report by code, not with the given objects in c#2008, is there a good article?
Thanks
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
Hi,
private void ComboBox_RaceGrandPrix_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar < 256)
e.Handled = true;
}
how can i create a classe/routine for this. I can´t do it without the "e" stuff. i repeat this in other routines to, i want to avoid that.
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
Have one method, and have each control call it?
|
|
|
|
|
I'm very new to C#. I'm a beginner. I just need a very simple example of a ProgressBar that fills once every second for 10 seconds then goes blank and then fills every second for 10 seconds. I need this to study how it's done for something else. Many thanks if you are to help.
|
|
|
|
|
Listen, you have to start doing that, later on if you get stuck ask here for help ok? you are asking to post all the code, we are not your employees!!!
That is not hard to accomplish, i am sure you can do that!!!
Good Luck
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
Put a Timer control on your form and experiment with it. The method in which you write the code is the Tick event handler.
|
|
|
|
|
Hi...
I am trying to draw a line with DrawLine method in a panel when a button is pressed ! But i cant do this outside of panel1_onPain(object sender,PaineEventArgs e) event handler.
I'll be glad if you give me an example.
ThanX !
|
|
|
|
|
you can get the graphics from panel.CreateGraphics() and use that to draw whatever you want.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
You can draw graphics anywhere you like, so you can draw anything on the screen where the panel happens to be. However, when the panel is redrawn for any reason, whatever you have drawn is gone.
Also, if you draw on the screen where the panel is and the panel is partly or fully covered by another window, you will draw on top of that window, not on your panel.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Guffa wrote: panel is redrawn for any reason, whatever you have drawn is gone
Hi Guffa, not wanting to hijack the thread, but this is something, I've come across myself recently in a WinMobile signature capture control.
What would you suggest is the best way around that? I stored the drawing in a MemoryStream and used that in the OnPaint but it felt a bit 'hacky'.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
A MemoryStream seems to be an awkward place to save something like that. It means that you have to decode it somehow every time you use it. Whatever you store, there has to be some more convenient way to keep track of it.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I create several labels at runtime, and their click event is for all labels the same.
My only problem is how to recognize which label is clicked, because now I only get the label.Text property in the eventargs which is not very usefull.
The answer must be somewhere in this messageboard but I don't know on which term I have to search.
Many thanks in advance
|
|
|
|
|
You should have sender as a parameter in your eventhandler. That's the reference to the label sending the click event.
The need to optimize rises from a bad design
|
|
|
|
|
or you can use Tag property as unique identity
dhaim
programming is a hobby that make some money as side effect
|
|
|
|
|
I already looked at the sender parameter, but it didn't have any usefull properties.
Thanks to your answer I cast the sender to a label and all properties are available.
Thanks
Rob
|
|
|
|
|
On general principles you probably should check that sender is castable to a label first and chuck a messagebox otherwise. It'll avoid any embarassing crashes if you ever end up (intentionally or not) using the event handler on a different type of control.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
sender gives you access to the control that fired the event. Cast sender as a label (presumably it only serves a label) and then you have all the properties of the label available. Sender is an object and therefore has very few properties until it is recast.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
To sum up what Dan and Mycroft said above:
private void label_Click(object sender, EventArgs e)
{
if (sender is Label)
{
Label clickedLabel = (Label)sender;
}
else
{
throw new ArgumentException(
"The control that called this function was not a Label");
}
}
I've thrown an exception, but you may want to show a message box or write to the error log so the program doesn't halt, or better still catch the exception elsewhere and handle it then.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
hi all.
i want to create some doc in my application then format them (bold,italic,..) and then restore them.
is there any way that i don't have to using ms word doc instead t ?
sepel
modified on Wednesday, October 1, 2008 3:02 AM
|
|
|
|
|
You could use a rich text box and save in the RTF format. Of course, you could also create your own (simplified) format, but this would be much work.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi Everyone.
I'm developing an application which needs to record voice from microphone and save it in a wav file.
But the voice being recorded, isn't clear, it's lost some part something like 1-0-1-0-1-0-1...
which the 1s indicate the voice is present and the 0s indicate that there's no voice present, each ones duration is about 500ms.
Here is my code. Where is the problem?
mem2Write[uu] = new MemoryStream();
captureDeviceCollection = new CaptureDevicesCollection();
DeviceInformation deviceInfo = captureDeviceCollection[sh];
CaptureBufferDescription captureBufferDescription = new CaptureBufferDescription();
captureBufferDescription.BufferBytes = waveFormat.AverageBytesPerSecond / 5;
captureBufferDescription.Format = waveFormat;
BufferDescription playbackBufferDescription = new BufferDescription();
playbackBufferDescription.BufferBytes = waveFormat.AverageBytesPerSecond / 5;
playbackBufferDescription.Format = waveFormat;
SecondaryBuffer playbackBuffer = new SecondaryBuffer(playbackBufferDescription, device);
int bufferSize = captureBufferDescription.BufferBytes;
Capture capture = new Capture(deviceInfo.DriverGuid);
CaptureBuffer captureBuffer = new CaptureBuffer(captureBufferDescription, capture);
CreateNotifyPositions(captureBuffer, bufferSize);
//int halfBuffer = bufferSize / 2;
int tenBuffer = bufferSize / 10;
//int halfBuffer = bufferSize;
captureBuffer.Start(true);
//bool readFirstBufferPart = true;
int readFirstBufferPart = 0;
int offset = 0;
mem2Write[uu].Position = 0;
MemoryStream memStream = new MemoryStream(tenBuffer);
bStop = false;
while (!bStop)
{
autoResetEvent.WaitOne();
memStream.Seek(0, SeekOrigin.Begin);
captureBuffer.Read(offset, memStream, tenBuffer, LockFlag.None);
//readFirstBufferPart = !readFirstBufferPart;
readFirstBufferPart= (readFirstBufferPart+1)% 10;
//offset = readFirstBufferPart ? 0 : thirdBuffer;
offset = tenBuffer * readFirstBufferPart;
//TODO: Fix this ugly way of initializing differently.
//Choose the vocoder. And then send the data to other party at port 1550.
//dataToWrite
mem2Write[uu].Write(memStream.GetBuffer(), 0, (Int32)memStream.Length);
mem2Write[uu].Position += (Int32)memStream.Length;
}
|
|
|
|
|
you have to show us where is the line of your code that getting an exception then we can help you.
so where is your problem ???
dhaim
programming is a hobby that make some money as side effect
|
|
|
|