Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to create a dialog like CameraCaptureUI.CaptureFileAsync?
    primarykey
    data
    text
    <p>I would like to create a library behaving like the <a href="http://msdn.microsoft.com/en-us/library/windows/apps/windows.media.capture.cameracaptureui.capturefileasync.aspx" rel="nofollow">CaptureFileAsync</a> method, i.e. on a method call it would open up a full screen page with standard back navigation and return result to the caller.</p> <p>I want to be able to call it the same way CaptureFileAsync is called:</p> <pre><code>var dialog = new Library.Dialog(); var result = await dialog.Show(); </code></pre> <p>In the <code>Show</code> method I'm currently navigating to my own page and returning a <code>Task</code> which can be awaited by the caller:</p> <pre><code>public Task&lt;string&gt; Show() { var task = new Task&lt;string&gt;(() =&gt; result); var frame = ((Window.Current.Content) as Frame); frame.Navigate(typeof(DialogPage)); return task; } </code></pre> <p>I call <code>task.Start()</code> when the dialog is being closed (either cancelled by navigating back or confirmed by pressing a button) which causes the result to be returned to the awaiting caller.</p> <p>The problem is that when <code>Frame.GoBack()</code> is called, a new instance of the previous page is created and the result gets returned to the old instance which is not displayed any more. This is not how <code>CaptureFileAsync</code> works: in its case the same instance of the calling page is kept.</p> <p>My question is: how can I display a page from my library without affecting the frame navigation and inadvertently causing a new instance of the calling page to be created?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload