Possibility to return to ScanPage - c#

In Xamarin app, I have a page after scan a QR Code. An AlertPage to show if the ticket is good or not (I don't want a DisplayAlert). On this page I want a button to return to the page before the scanner, and an other button to return to scanner.
If you want I have 3 pages:
ListPeoplePage (with a button to go to scan who create new ZXingScannerPage);
ScannerPage (when you scan you go to AlertPage);
AlertScanPage (with backbutton to go to Scanner and an other to go to ListPeoplePage).
I'm not sure if it's possible and I have problems with my NavigationStack (I have never the good number of pages).
If you know a good method to add this AlertScanPage it would help me.
My question is to go from AlertScanPage to ScannerPage.

Related

How to disabled button after user have clicked the button before in asp.net using C#

I am currently creating a seat reservation system. In my system, if user select Seat 1 and proceed till the end, when the system come back again (I have a button linked to first page from the last page), the Seat 1 should be disabled and cannot be chose already. But somehow my code still allows it to choose. Why is that?
I am using this code:
if (seat1 == "Reserved")
{
ImageButton1.ImageUrl = "seatreserved.png";
ImageButton1.Enabled = false;
}
The image does change so I know the value "Reserved" had successfully passed to this page. But somehow the ImageButton1.Enabled = false; did not work.
Please help, thank you.
You are not saving the state of your actions anywhere at least you don't explain it. When you reserve a seat in your app save the value of the seat in some source-> db xml or whatever you like. After that on the next opening of your app load the reserved seats from this source and make disable this buttons.
If you use DB and you have two tables Event and Reserving seats. When you click on the button you are inserting data in Reserving with EventID='The ID of Event' and SeatNumber the number of the seat.
After that when you go into this event again load the data from Reserving table for this Event and disable what is needed.
try to clean project and rebuild again.. if problem still occurs then try to add new control and implement code again. Sometimes these kind of things happen in .Net Framework.

C# Selenium WebDriver - Is it possible to check if a certain webpage is already opened in the browser?

I was wondering if it is possible to check with C# and selenium web driver if a certain webpage is opened in the default browser?
My idea is to link certain ticketing system's time tracker with toggl.
For instance - on click of the "Time Track" button in the ticketing system, the program to click the toggl start button programmatically, at the same time.
Yes, it's possible.
You can devise a solution that checks the default window's URL or title.
if (driver.Url == 'http://some_url') { /* you are there */ }
or
if (driver.Title == 'Some Title') { /* the window is open and currently there */ }
Now, if you are running a browser manually using your own browser, then expect Selenium to detect that, then i'm sorry, but that is not possible.
In addition to #sircapsalot answer:
This won't be enough since the goal is to
on click of the "Time Track" button in the ticketing system
First you should be sure that the page has been loaded and the IWebElement is clickable. Without going in some advanced usage (like JS validation of the page state), this should do the work just fine:
var wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(15));
var myElement = wait.Until(x => x.FindElement(By.Id("timeTrackBtnId")));
if(myElement.Displayed)
myElement.Click();
Then go for the
program to click the toggl start button programmatically, at the same time
I'm not sure how you'll sync and how page's JS events will handle this simultaneous actions, but you can try with System.Threading. If the page is created by you maybe this second part (click button, click togl) is better to be handled in the JS code.

Check weather the page is out of focus asp.net

I am trying to build a online exam project. Once the student login the exam page will be in fullscreen mode. I want to know if the student presses any shortcut keys like Alt+Ctr+Del or Alt+D etc. which ever it may be. I just want to know is it possible to find out if the current page is out of focus ? So that I can end the session at that time.
Please help me with this.
if(string.Compare(Request.Url.LocalPath,"MyPage.aspx")==0)
// maek your session Null whatever you want
}
This can be done in master page easily

Come back from third window to first window in history

I'm developing a Windows Phone application and I have three screens:
Main screen
Login selection screen.
Sign in screen.
When user has signed in and push "sign in" button I want to come back from screen 3 to screen 1.
Now I come back to screen 2 and immediately to first one. I don't want to show 2 screen.
Is it possible to do this?
Try this
Assume your pages are named as FirstPage.xaml, SecondPage.xaml, ThirdPage.xaml
//Check for the first page and remove the remaining back stack in your ThirdPage.xaml
while(!NavigationService.BackStack.First().Source.OriginalString.Contains("FirstPage"))
{
NavigationService.RemoveBackEntry();
}
NavigationService.GoBack();
Somewhere in page 3 add
NavigationService.RemoveBackEntry();
This will remove page 2 from the back stack. Now when the user hits the back key, he'll navigate directly backwards to page 1.
But as Amal Dev noted, Microsoft wants you to let the user navigate to the previous page. This rule doesn't seem to be enforced too much, it's probably meant as "never ever confuse the user". If you confuse the certificating tester, your app will fail certification.
You can use the NavigationService.Navigate method for this.
NavigationService.Navigate(new Uri( string.Format("/your page name.xaml?val={0}", ValueTextBox.Text), UriKind.Relative));
Please refer the link given below.
Simple Navigation In Windows Phone 7

Can't find the function body in ASP.NET

I recently started working on a project that has been in development for some time now. The problem is this - in the web site page, a have a frame (amongst 4 others) in a frameset which contains the SVG map object (the whole site is GIS based). Also, in the same frame, there is a icon for opening the form in which user can choose a number of filters, and after he presses a button, the map refreshes and the area of influence around some key points on the map are drawn.
What i need to do is to open that form in a new (popup) window and not in the same frame where the map is. I did that this way:
onclick="window.open('zi.aspx','form1','width=700,height=500,left=350,top=100')"
This works fine. But then, when i enter the filters and hit Generate button, i get this error:
'parent.frames.map' is null or not an object
with the reference to zi.aspx. Now i know that this error is because i changed the form from opening in the same frame as map to opening it in a popup window, but i just can't find anywhere in the code where can i modify it. Before my changes, the code was just this:
onclick="showZi();"
and that is the function i can't find anywhere. Any ideas? How can i make this work, to make a map with filters drawn after the user has chosen appropriate ones from the popup window form? I should mention that this image link is in the ASP.NET table, with standard runat="server" command.
Okay, so you're opening a new window from javascript. Your problem is that you're trying to access the parent window by using the 'window.parent' property. This is wrong, you'll need to instead use 'window.opener' property. E.g.:
window.opener.frames.map

Categories