Does threading (with Dispatcher Invoke) have anything to with this? Please note that the navigation service used in Timer tick event works perfectly everytime. However navigation in the dispatcher invoke event used otherwise only works the 1st time. Can't figure out how to trace this bug.
Sorry to bother you again. But I am getting similar exception during the following code:
Dispatcher.Invoke(new System.Threading.ThreadStart(delegate
{
NavigationService.Navigate(new Uri("TmpMsg.xaml", UriKind.RelativeOrAbsolute));
}));
Interestingly it shows the...
Could it be in the following line?
Dispatcher.BeginInvoke(new System.Threading.ThreadStart(delegate
Please note that nothing goes wrong when the CshDeposit5.xaml is called for the 1st time but problem arises when it is called the 2nd time.
Moreover, similar navigation is done from...
I 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...
I am using a serial port device that checks whether any object has been passed thru its gate when it is open. It takes "t" as input and responds with "1" if the object completely passed thru or "0" if the object returned. Depneding on the response the UI navigates to different pages with...
The timer is used to track if 20 seconds have elapsed or not and notify the user of how much seconds left. When there's no seconds left I would like redirect it to Start.xaml.
I didn't get "why would you try to navigate again from a page you have already navigated away from?" I am only...
From window is alright. However when I try navigating to another page from a page with the following code after it checks 20 seconds timer has elapsed or not
private void dispatcherTimer_Tick(object sender, EventArgs e)
{
NWCDMLibNew x = new NWCDMLibNew()...
My Main Window is named MainWindow. It has a frame named MainFrame. As per your advice I could use frame.content/frame.source. However, I cannot access this frame from any xaml page. How would I do it? If possible it would be the most simplest one to load a page from anywhere within the app.
I tried with the following now
Start x = new Start();
ShowError(x);
Where Start.xaml is the page ShowError function is called from. This time it works. However it loops around as if the Start.xaml page is being called for loading
I tried modifying the function as follows,
public void ShowError(Page s)
{
try
{
NavigationService nav = NavigationService.GetNavigationService(s);
nav.Navigate(new Uri("ErrorMsg.xaml"...
I didn't get it. What would be the DependencyObject to pass to GetNavigationService when called from a page class just after the InitializeComponent();
Sorry, it was acrually NWCDMLibNew - that is just a class file where I wrote all the functions required throughout the application. The Function ShowError() is supposed to load the ErrorMsg.xaml page showing the customized error string on a label.
As I said earlier when I use...
Compilation Error 1: The best overloaded method match for 'System.Windows.Navigation.NavigationService.GetNavigationService(System.Windows.DependencyObject)' has some invalid arguments D:\Docs\Networld\CDM Project\Interfacing USB in C#\NWCDM\NWCDM2\NWCDMLibNew.cs 842 37 NWCDM
Error 2: Argument...
I have this following code that acts when there's an error:
public void ShowErrorScreen()
{
NavigationService nav = NavigationService.GetNavigationService(this));
nav.Navigate(new Uri("ErrorMsg.xaml", UriKind.RelativeOrAbsolute));
}But it doesn't seem to be working for "this"...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.