|
I noticed that for async calls, when unhandled exception is occured, JIT debugger is not showing typical dialog box with stack trace/continue/quit buttons. Instead the standard error report dialog box with Send Report/Don't Send buttons. Is there any way to make unhandled exceptions in async calls like begininvoke/begin* to show JIT debugging dialog box?
Thx
|
|
|
|
|
You need to catch ThreadException IIRC.
xacc.ideIronScheme - 1.0 beta 3 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
well, since the question is how to _make_ c# catch itself all unhandled exceptions from within async operations, then I don't really want to catch ThreadException, unless I missed some point.
|
|
|
|
|
Hi,
I am using DateTimePicker Control to display Date in to Custom Format like 2009/07/13 (YYYY:MM:DD)
But the date is not changing according to user selection. Is there any other controls in .net 2003?
Thanks,
Subbu
|
|
|
|
|
|
Hi,
You have probably made simple mistake in the format string.
The following will output e.g. 2009/07/13. Note that you have to enable custom formatting via the Format property.
dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = "yyyy/MM/dd";
Alan.
|
|
|
|
|
Thanks a Lot. Now it works well.
|
|
|
|
|
Hi,
I am working on a project involving communication using GPRS. We have a GPRS enabled modem that sends data to server at regular intervals. All I have to do is develop a service that reads the data sent from GPRS enabled modem and save into database.
I request any one who has experience in these type of projects to guide me in three things.
1.How to establish connection between Modem and Server
2.How to read data received by the server
3.How to close the connection
Thanks in advance
|
|
|
|
|
Your question is way too broad for a specific answer; in general terms the answer is this:
1) figure out how the device is sending data (read the documentation)
2) code your service accordingly
I'm doing the same thing right now - here's what I encountered. Our devices are configurable; we chose UDP sockets as our preferred communication method so we programmed the devices with the required commands and then used this[^] in a service on the server to read incoming data. The other option was to use TCP/IP in which case we would've used this[^] and this[^] on the server to receive data from the devices. All of those classes have methods for opening and closing connections (if applicable) and reading data. We ruled out comms via SMS on a cost basis.
Hope that helps.
Jim
|
|
|
|
|
hi,
is there away to change the controlbox color
thanks
Have Fun
Never forget it
|
|
|
|
|
What is 'the controlbox'?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
the bar containg the name of the app, the icon, maximize, etc...
Have Fun
Never forget it
|
|
|
|
|
Take a look at this[^], just one hit from googling for custom borders on windows forms
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Thanls
Have Fun
Never forget it
|
|
|
|
|
No, there isn't. It's always painted using the system colors.
|
|
|
|
|
|
half-life wrote: change the system colors, that an idea
No it's not, since any change you make there affects ALL applications and windows, not just your apps. Changing system-wide settings just to make your app look pretty will ultimately get your app uninstalled.
|
|
|
|
|
Yep, yuor'e right, that i knew a second Later, but what thw hack i'm doing this for my own eyes
Have Fun
Never forget it
|
|
|
|
|
Hi!
below is my codes. I am trying to play all the files in a playlist but it only plays one and stops
[STAThread]
static void Main()
{
Application.Run(new Form1());
Form1 frm = new Form1();
frm.queueMedia();
}
private void queueMedia()
{
string mediasource = "C:\\Test\\Media";
string[] filenames = Directory.GetFiles(mediasource);
foreach (string filename in filenames)
{
PlayMedia(filename);
}
}
private void PlayMedia(string filename)
{
CleanUp();
m_objFilterGraph = new FilgraphManager();
m_objFilterGraph.RenderFile(filename);
m_objBasicAudio = m_objFilterGraph as IBasicAudio;
try
{
m_objVideoWindow = m_objFilterGraph as IVideoWindow;
m_objVideoWindow.Owner = (int)panel1.Handle;
m_objVideoWindow.WindowStyle = WS_CHILD | WS_CLIPCHILDREN;
m_objVideoWindow.SetWindowPosition(panel1.ClientRectangle.Left,
panel1.ClientRectangle.Top,
panel1.ClientRectangle.Width,
panel1.ClientRectangle.Height);
}
catch (Exception)
{
m_objVideoWindow = null;
}
m_objMediaEvent = m_objFilterGraph as IMediaEvent;
m_objMediaEventEx = m_objFilterGraph as IMediaEventEx;
m_objMediaEventEx.SetNotifyWindow((int)this.Handle, WM_GRAPHNOTIFY, 0);
m_objMediaPosition = m_objFilterGraph as IMediaPosition;
m_objMediaControl = m_objFilterGraph as IMediaControl;
this.Text = "DirectShow - [" + filename + "]";
m_objMediaControl.Run();
m_CurrentStatus = MediaStatus.Running;
UpdateStatusBar();
UpdateToolBar();
}
private void CleanUp()
{
if (m_objMediaControl != null)
m_objMediaControl.Stop();
m_CurrentStatus = MediaStatus.Stopped;
if (m_objMediaEventEx != null)
m_objMediaEventEx.SetNotifyWindow(0, 0, 0);
if (m_objVideoWindow != null)
{
m_objVideoWindow.Visible = 0;
m_objVideoWindow.Owner = 0;
}
if (m_objMediaControl != null) m_objMediaControl = null;
if (m_objMediaPosition != null) m_objMediaPosition = null;
if (m_objMediaEventEx != null) m_objMediaEventEx = null;
if (m_objMediaEvent != null) m_objMediaEvent = null;
if (m_objVideoWindow != null) m_objVideoWindow = null;
if (m_objBasicAudio != null) m_objBasicAudio = null;
if (m_objFilterGraph != null) m_objFilterGraph = null;
}
private void menuItem4_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void Form1_SizeChanged(object sender, System.EventArgs e)
{
if (m_objVideoWindow != null)
{
m_objVideoWindow.SetWindowPosition(panel1.ClientRectangle.Left,
panel1.ClientRectangle.Top,
panel1.ClientRectangle.Width,
panel1.ClientRectangle.Height);
}
}
private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
{
switch(toolBar1.Buttons.IndexOf(e.Button))
{
case 0: m_objMediaControl.Run();
m_CurrentStatus = MediaStatus.Running;
break;
case 1: m_objMediaControl.Pause();
m_CurrentStatus = MediaStatus.Paused;
break;
case 2: m_objMediaControl.Stop();
m_objMediaPosition.CurrentPosition = 0;
m_CurrentStatus = MediaStatus.Stopped;
break;
}
UpdateStatusBar();
UpdateToolBar();
}
protected override void WndProc( ref Message m)
{
if (m.Msg == WM_GRAPHNOTIFY)
{
int lEventCode;
int lParam1, lParam2;
while (true)
{
try
{
m_objMediaEventEx.GetEvent(out lEventCode,
out lParam1,
out lParam2,
0);
m_objMediaEventEx.FreeEventParams(lEventCode, lParam1, lParam2);
if (lEventCode == EC_COMPLETE)
{
m_objMediaControl.Stop();
m_objMediaPosition.CurrentPosition = 0;
m_CurrentStatus = MediaStatus.Stopped;
UpdateStatusBar();
UpdateToolBar();
}
}
catch (Exception)
{
break;
}
}
}
base.WndProc(ref m);
}
private void timer1_Tick(object sender, System.EventArgs e)
{
if (m_CurrentStatus == MediaStatus.Running)
{
UpdateStatusBar();
}
}
private void UpdateStatusBar()
{
switch (m_CurrentStatus)
{
case MediaStatus.None : statusBarPanel1.Text = "Stopped"; break;
case MediaStatus.Paused : statusBarPanel1.Text = "Paused "; break;
case MediaStatus.Running: statusBarPanel1.Text = "Running"; break;
case MediaStatus.Stopped: statusBarPanel1.Text = "Stopped"; break;
}
if (m_objMediaPosition != null)
{
int s = (int) m_objMediaPosition.Duration;
int h = s / 3600;
int m = (s - (h * 3600)) / 60;
s = s - (h * 3600 + m * 60);
statusBarPanel2.Text = String.Format("{0:D2}:{1:D2}:{2:D2}", h, m, s);
s = (int) m_objMediaPosition.CurrentPosition;
h = s / 3600;
m = (s - (h * 3600)) / 60;
s = s - (h * 3600 + m * 60);
statusBarPanel3.Text = String.Format("{0:D2}:{1:D2}:{2:D2}", h, m, s);
}
else
{
statusBarPanel2.Text = "00:00:00";
statusBarPanel3.Text = "00:00:00";
}
}
private void UpdateToolBar()
{
switch (m_CurrentStatus)
{
case MediaStatus.None : toolBarButton1.Enabled = false;
toolBarButton2.Enabled = false;
toolBarButton3.Enabled = false;
break;
case MediaStatus.Paused : toolBarButton1.Enabled = true;
toolBarButton2.Enabled = false;
toolBarButton3.Enabled = true;
break;
case MediaStatus.Running: toolBarButton1.Enabled = false;
toolBarButton2.Enabled = true;
toolBarButton3.Enabled = true;
break;
case MediaStatus.Stopped: toolBarButton1.Enabled = true;
toolBarButton2.Enabled = false;
toolBarButton3.Enabled = false;
break;
}
}
private void menuItem5_Click(object sender, System.EventArgs e)
{
Form2 dlg = new Form2();
dlg.ShowDialog();
}
}
please help
|
|
|
|
|
Don't use
foreach (string filename in filenames)
{
PlayMedia(filename);
}
Instead write an event. When one song is completed, fire that event within WndProc
if (lEventCode == EC_COMPLETE)
{
m_objMediaControl.Stop();
m_objMediaPosition.CurrentPosition = 0;
m_CurrentStatus = MediaStatus.Stopped;
UpdateStatusBar();
UpdateToolBar();
// Fire that event
}
Then clean up and start the next song. Hope it will help
|
|
|
|
|
Hi!
thanks, I am new to c# and also media files. could you please provide me a snippet as to how this can be achieved. I also need to delete it from file list once played. thanks in advance.
|
|
|
|
|
Sorry friend,
Today I am in a bit hurry. Currently I am in my office. You can consult any preliminary C# book on how to create an event and fire it. It is a very simple one. Sorry again, don't mind
|
|
|
|
|
|
based on what you have said, I created below delege method
public delegate void PlayNextFileEventHandler(string nextFile);
public event PlayNextFileEventHandler PlayNextFile;
private string file;
public string FileToPlay
{
get { return this.file; }
set
{
this.file = value;
if (this.PlayNextFile != null)
this.PlayNextFile(value);
}
}
codes in main
[STAThread]
static void Main()
{
Application.Run(new Form1());
Form1 frm = new Form1();
frm.PlayNextFile += new PlayNextFileEventHandler(queueMedia);
}
static void queueMedia(object source, MyEventArgs e)
{
string mediasource = "C:\\Test\\Media";
string[] filenames = Directory.GetFiles(mediasource);
foreach (string filename in filenames)
{
PlayMedia(filename);
}
}
not sure how to raise the event so that it plays next file. could someone please help?
|
|
|
|
|
ok, could someone please show me how to play the files sequentially in above codes. thank you
|
|
|
|