Click here to Skip to main content
15,895,606 members

Comments by Sultan Uz Zaman (Top 13 by date)

Sultan Uz Zaman 11-Dec-15 11:19am View    
They supplied an application that allows to remote view from any browser. Just that.
Sultan Uz Zaman 13-Sep-15 1:04am View    
Mine is not a Web App. Before loading a page a few things are being checked. If eveything is ok it shows a page otherwise it shows another page with error information. I can naviagte to a page when I initiate the navigation from a button click event. But I just want to redirect to a page according to my requirement without any click event as stated earlier. Its just loading page on a frame of the main window without any clicking event.
Sultan Uz Zaman 7-Sep-15 13:02pm View    
Fantastic. Thanks a lot man. It worked!!!
Sultan Uz Zaman 7-Sep-15 0:24am View    
A button click event does the follwoing to save the pic:

public static void SavePic(string imageFile)
{
//Cam_NewFrame(null,null);
//image1.Source = frameHolder.Source;
//Image<bgr, byte=""> frame = frameHolder.Cam_NewFrame(null,null);
// Release any previous buffer


MainWindow myWin = Application.Current.MainWindow as MainWindow;
RenderTargetBitmap bitmap = new RenderTargetBitmap(320, 240, 96, 96, PixelFormats.Pbgra32);
bitmap.Render(myWin.frameHolder);


using (FileStream stream = File.Create(Global.xImageLocation+"\\"+imageFile)) // or .png
{
JpegBitmapEncoder encoder = new JpegBitmapEncoder();
encoder.QualityLevel = 90;
encoder.Frames.Add(BitmapFrame.Create(bitmap));
encoder.Save(stream);
}
}
Sultan Uz Zaman 7-Sep-15 0:22am View    
Right! Please find below the extract of my source that puts the stream on an image control called "frameHolder" (along with other codes out of scope). How can I avoid this?
-----------------------------------------------------
MainWindow.xaml.cs

void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
LoaclWebCamsCollection = new FilterInfoCollection(FilterCategory.VideoInputDevice);
LocalWebCam = new VideoCaptureDevice(LoaclWebCamsCollection[0].MonikerString);
LocalWebCam.DesiredFrameSize = new System.Drawing.Size(320, 240);

//MessageBox.Show(LocalWebCam.DesiredFrameSize.ToString());
LocalWebCam.NewFrame += new NewFrameEventHandler(Cam_NewFrame);

LocalWebCam.Start();


}

void Cam_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
BitmapImage bi = new BitmapImage();
try
{
img = (Bitmap)eventArgs.Frame.Clone();

MemoryStream ms = new MemoryStream();
img.Save(ms, ImageFormat.Bmp);
ms.Seek(0, SeekOrigin.Begin);


bi.BeginInit();
bi.StreamSource = ms;
bi.EndInit();

bi.Freeze();
Dispatcher.BeginInvoke(new ThreadStart(delegate
{
frameHolder.Source = bi;
}));

}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "NW CDM Test of Image Capture Failed");
}
}