It means you don't have any clue to suggest. Thanks anyways.
Sultan Uz Zaman
Posts
-
Why does Navigation throw null exception when returning to a page 2nd time -
Why does Navigation throw null exception when returning to a page 2nd timeCurrentsource property not available
-
Why does Navigation throw null exception when returning to a page 2nd timeHow do I check if the page is already loaded or not in WPF?
-
Why does Navigation throw null exception when returning to a page 2nd timePlease note as I mentioned earlier it doesn't thro any null exception 1st time. I get this when CshDeposit5.xaml is called the 2nd time. How do I find its returning null?
-
Why does Navigation throw null exception when returning to a page 2nd timeNavigationService.Navigate(new Uri("TmpMsg.xaml", UriKind.RelativeOrAbsolute)); throws the null exception. I tried the following, NavigationService nav = NavigationService.GetNavigationService(this); nav.Navigate(new Uri("TmpMsg.xaml", UriKind.RelativeOrAbsolute)); where nav variable is shown null.
-
Why does Navigation throw null exception when returning to a page 2nd timeI have a serial port controller (for sensing any object that passes through its transport module) connected to USB. It responses with either 0 or 1 after input command "t" when it senses any dropping or no dropping of object through the transport. The page CshDeposit5 contains the code. Start.xaml is the page the activity starts and ends up in CshDeposit5.xaml. TmpErrorMsg and TmpMsg are the pages to show the user what happened. Everything runs fine for the first time. But when it tries to come to this CshDeposit5.xaml 2nd time it throws exception on the follwoing highlighted codes:
CshDeposit5.xaml.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO.Ports;
using System.Windows.Threading;namespace NWCDM
{
public partial class CshDeposit5 : Page
{
private System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
private static int i;public CshDeposit5() { InitializeComponent(); } private void Page\_Loaded(object sender, RoutedEventArgs e) { i = Global.xDropTime; //Stipulated Time for the object to pass through before timeout - declared in Global.cs TimeLeft.Text = i.ToString(); dispatcherTimer.Tick += dispatcherTimer\_Tick; dispatcherTimer.Interval = new TimeSpan(0, 0, 1); Global.xController.WriteLine("t"); //serialport declared in Global.cs file dispatcherTimer.Start(); SerialPort sp2 = Global.xController; //Declared in Global.cs as serial port sp2.DataReceived += new SerialDataReceivedEventHandler(DataReceivedHandler ); } public void DataReceivedHandler(object sender, SerialDataReceivedEventArgs e) { SerialPort sp = (SerialPort)sender; string indata = sp.ReadExisting(); Dispatcher.Invoke(DispatcherPriority.Send, new Action(() => DoTrans(indata))); } private void DoTrans(string x){ if (i >= 0) { if (x.IndexOf("1") >= 0) { dispatcherTimer.Stop(); Dispatcher.BeginInvoke(new System.Threading.ThreadStart(delegate
-
Capturing from Webcam without preview to the userStill cannot figure out. Please help the novice.
-
Capturing from Webcam without preview to the userThis is where I failed to implement. Can you please share with me a few codes so I could understand the fact to store the stream anything other than the image control and grab the current from that variable?
-
Capturing from Webcam without preview to the userPlease find below the extarct of my application where the stream is stored in an image control named frameHolder and function SavePic grabs the current frame and save it to disk. frameHolder is shown on the Main Window. Making it invisible captures blank picture. 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"); } } Sultan Uz Zaman at 4 hrs ago Reply Modify the comment. Delete the comment. 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 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); } }
-
Capturing from Webcam without preview to the userYes. But how do I do it without showing it on the image control?
-
Capturing from Webcam without preview to the userDon't worry, the DropBoxes are generally like this and it does not have any illegal elements. And by the way we are actually looking for something where there is no preview - just capture on demand. So, even if the user sees the light of the webcam it really doesn't matter because it actually strengthens his side in case of any dispute unless he claims anything useless (like claiming transaction without dropping the envelop).
-
Capturing from Webcam without preview to the userSince all the webcams are inside the cage the light can not be seen by the user.
-
Capturing from Webcam without preview to the userLet me clear my objectives one more time before it creates any ambiguity. This is an application where the user puts a few input in a sequence of pages. Every time the user enters into a page the application captures the image of his/her face along with the other activities with 2 webcams. Reason to take the image is to resolve any dispute if occurs. It would be awkward to show the webcam preview on the input pages. If we had to put an image control it has to be on the main window keeping it hidden. This is a DropBox application to be written in C# WPF where there are 2 webcams - 1 for the user face and the other at the DropBox shutter end to capture if the user actually dropped anything.
-
Capturing from Webcam without preview to the userGreat! Please help me with a few codes in WPF C# so I could implement this to my application. Please note that the objective is not to aware the user of the webcam activity at all. Thanks in advance.
-
Capturing from Webcam without preview to the userI would like to know if it is possible to develop an webcam application under WPF C# to capture webcam image and save it to disk without showing the preview (showing the content to the user)?
-
Using WFP application for webcam. I do not want to show the image control on window. Using a function from pages to capture the image on certain occassion and save it.Just code dump
-
Using WFP application for webcam. I do not want to show the image control on window. Using a function from pages to capture the image on certain occassion and save it.MainWindow.xaml ---------------- x:Class="NWCDM.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525" WindowStartupLocation="CenterScreen" WindowState="Maximized" WindowStyle="None">
-
Web deployment task failedDuring the publishing of my web application using VS 2010 I get the following message, Web deployment task failed. (There was an error reading IIS configuration schema from 'C:\WINDOWS\system32\inetsrv\config\schema\'.) Can anyone please advice me the resolution? regards Sultan