/// <summary> /// Sets the ContinuationArgs for this instance. Should be called by the main activation /// handling code in App.xaml.cs /// </summary> /// <param name="args">The activation args</param> /// <param name="rootFrame">The frame control that contains the current page</param> internal void Continue(IContinuationActivatedEventArgs args, Frame rootFrame) { if (args == null) throw new ArgumentNullException("args"); if (_args != null && !_handled) throw new InvalidOperationException("Can't set args more than once"); _args = args; _handled = false; _id = Guid.NewGuid(); if (rootFrame == null) return; switch (args.Kind) { case ActivationKind.PickFileContinuation: var fileOpenPickerPage = rootFrame.Content as IFileOpenPickerContinuable; if (fileOpenPickerPage != null) { fileOpenPickerPage.ContinueFileOpenPicker(args as FileOpenPickerContinuationEventArgs); } break; } }
/// <summary> /// Sets the ContinuationArgs for this instance. Using default Frame of current Window /// Should be called by the main activation handling code in App.xaml.cs /// </summary> /// <param name="args">The activation args</param> internal void Continue(IContinuationActivatedEventArgs args) { if (args == null) { throw new ArgumentNullException(nameof(args)); } if (args.Kind != ActivationKind.WebAuthenticationBrokerContinuation) { return; } var rootFrame = Window.Current.Content as Frame; if (_args != null && !_handled) { throw new InvalidOperationException("Can't set args more than once"); } _args = args; _handled = false; if (rootFrame == null) { return; } var wabPage = rootFrame.Content as IWebAuthenticationContinuable; wabPage?.ContinueWebAuthentication(args as WebAuthenticationBrokerContinuationEventArgs); }
private async void App_ContinuationEventArgsChanged(object sender, IContinuationActivatedEventArgs e) { App.ContinuationEventArgsChanged -= App_ContinuationEventArgsChanged; var fileArgs = e as FileOpenPickerContinuationEventArgs; var folderArgs = e as FolderPickerContinuationEventArgs; if (fileArgs != null && (fileArgs.ContinuationData["Operation"] as string) == "OpenPhotoFile" && fileArgs.Files != null && fileArgs.Files.Count > 0) { var file = fileArgs.Files[0]; SessionModel.Instance.Photo = new FilteredPhotoModel(file); var frame = (Frame)Window.Current.Content; frame.Navigate(typeof(PhotoPage)); } else if (folderArgs != null && (folderArgs.ContinuationData["Operation"] as string) == "OpenPhotoFolder" && folderArgs.Folder != null) { var folder = folderArgs.Folder; if (folder != null && (SessionModel.Instance.Folder == null || folder.Path != SessionModel.Instance.Folder.Path)) { SessionModel.Instance.Folder = folder; await Refresh(); } } }
/// <summary> /// Execute continue with specified <see cref="IContinuationActivatedEventArgs"/>. /// </summary> /// <param name="args">activation args</param> /// <param name="targetFrame">The frame control that contains the current page</param> public static void Continue([NotNull] IContinuationActivatedEventArgs args, [CanBeNull] Frame targetFrame) { if (args == null) { throw new ArgumentNullException("args"); } if (targetFrame == null) { // target frame is not specified. return; } switch (args.Kind) { case ActivationKind.PickFileContinuation: ContinueTo <FileOpenPickerContinuationEventArgs>(targetFrame, args); break; case ActivationKind.PickSaveFileContinuation: ContinueTo <FileSavePickerContinuationEventArgs>(targetFrame, args); break; case ActivationKind.PickFolderContinuation: ContinueTo <FolderPickerContinuationEventArgs>(targetFrame, args); break; case ActivationKind.WebAuthenticationBrokerContinuation: ContinueTo <WebAuthenticationBrokerContinuationEventArgs>(targetFrame, args); break; } }
/// <summary> /// Sets the ContinuationArgs for this instance. Should be called by the main activation /// handling code in App.xaml.cs /// </summary> /// <param name="args">The activation args</param> /// <param name="rootFrame">The frame control that contains the current page</param> internal void Continue(IContinuationActivatedEventArgs args, Frame rootFrame) { if (args == null) { throw new ArgumentNullException("args"); } if (_args != null && !_handled) { throw new InvalidOperationException("Can't set args more than once"); } _args = args; _handled = false; Id = Guid.NewGuid(); if (rootFrame == null) { return; } switch (args.Kind) { case ActivationKind.PickFileContinuation: var fileOpenPickerPage = rootFrame.Content as IFileOpenPickerContinuable; if (fileOpenPickerPage != null) { fileOpenPickerPage.ContinueFileOpenPicker(args as FileOpenPickerContinuationEventArgs); } break; } }
/// <summary> /// Sets the ContinuationArgs for this instance. Should be called by the main activation /// handling code in App.xaml.cs /// </summary> /// <param name="args">The activation args</param> /// <param name="rootFrame">The frame control that contains the current page</param> public void Continue(IContinuationActivatedEventArgs args, Frame rootFrame) { if (args == null) throw new ArgumentNullException("args"); if (this.args != null && !handled) throw new InvalidOperationException("Can't set args more than once"); this.args = args; this.handled = false; this.id = Guid.NewGuid(); if (rootFrame == null) return; switch (args.Kind) { case ActivationKind.PickFileContinuation: ContinuationFileOpenPicker( rootFrame.Content as Page, args as FileOpenPickerContinuationEventArgs); break; case ActivationKind.PickSaveFileContinuation: break; case ActivationKind.PickFolderContinuation: break; case ActivationKind.WebAuthenticationBrokerContinuation: break; } }
internal void Continue(IContinuationActivatedEventArgs args, Frame rootFrame) { if (args == null) { throw new ArgumentNullException("args"); } if (this.args != null && !handled) { throw new InvalidOperationException("Can't set args more than once"); } this.args = args; this.handled = false; this.id = Guid.NewGuid(); if (rootFrame == null) { return; } //if (rootFrame.Content == null) // return; switch (args.Kind) { case ActivationKind.PickFileContinuation: var fileOpenPickerPage = rootFrame.Content as IFileOpenPickerContinuable; if (fileOpenPickerPage != null) { fileOpenPickerPage.ContinueFileOpenPicker(args as FileOpenPickerContinuationEventArgs); } break; case ActivationKind.PickSaveFileContinuation: var fileSavePickerPage = rootFrame.Content as IFileSavePickerContinuable; if (fileSavePickerPage != null) { fileSavePickerPage.ContinueFileSavePicker(args as FileSavePickerContinuationEventArgs); } break; case ActivationKind.PickFolderContinuation: var folderPickerPage = rootFrame.Content as IFolderPickerContinuable; if (folderPickerPage != null) { folderPickerPage.ContinueFolderPicker(args as FolderPickerContinuationEventArgs); } break; case ActivationKind.WebAuthenticationBrokerContinuation: var wabPage = rootFrame.Content as IWebAuthenticationContinuable; if (wabPage != null) { wabPage.ContinueWebAuthentication(args as WebAuthenticationBrokerContinuationEventArgs); } break; } }
internal void OnContinue(IContinuationActivatedEventArgs e) { if (e is FileOpenPickerContinuationEventArgs) { OnFilePickerOpened((FileOpenPickerContinuationEventArgs)e); } }
public void OnContinue(IContinuationActivatedEventArgs e) { if (e is FileOpenPickerContinuationEventArgs) OnFilePickerOpened((FileOpenPickerContinuationEventArgs)e); else if (e is FileSavePickerContinuationEventArgs) OnFilePickerSaved((FileSavePickerContinuationEventArgs)e); }
/// <summary> /// Sets the ContinuationArgs for this instance. Should be called by the main activation /// handling code in App.xaml.cs /// </summary> /// <param name="args">The activation args</param> /// <param name="rootFrame">The frame control that contains the current page</param> internal void Continue(IContinuationActivatedEventArgs args, Frame rootFrame) { if (args == null) { throw new ArgumentNullException("args"); } if (this.args != null && !handled) { throw new InvalidOperationException("Can't set args more than once"); } this.args = args; this.id = Guid.NewGuid(); if (rootFrame == null) { return; } var webPage = rootFrame.Content as IWebAuthenticationContinuable; if (webPage != null) { webPage.ContinueWebAuthentication(args as WebAuthenticationBrokerContinuationEventArgs); } }
/// <summary> /// Sets the ContinuationArgs for this instance. Should be called by the main activation /// handling code in App.xaml.cs. /// </summary> /// <param name="args"> /// The activation args. /// </param> /// <param name="rootFrame"> /// The frame control that contains the current page. /// </param> internal void Continue(IContinuationActivatedEventArgs args, Frame rootFrame) { if (args == null) { throw new ArgumentNullException("args"); } if (_continuationActivatedEventArgs != null && !_handled) { throw new InvalidOperationException("Can't set args more than once"); } _continuationActivatedEventArgs = args; _handled = false; _id = Guid.NewGuid(); if (rootFrame == null) { return; } switch (args.Kind) { case ActivationKind.WebAuthenticationBrokerContinuation: var webPage = rootFrame.Content as IWebAuthenticationContinuable; if (webPage != null) { webPage.ContinueWebAuthentication(args as WebAuthenticationBrokerContinuationEventArgs); } break; } }
protected async override void OnActivated(IActivatedEventArgs args) { base.OnActivated(args); IContinuationActivatedEventArgs continuationArgs = args as IContinuationActivatedEventArgs; if (continuationArgs != null && continuationArgs.Kind == ActivationKind.PickFileContinuation) { FileOpenPickerContinuationEventArgs pickerArgs = args as FileOpenPickerContinuationEventArgs; if (pickerArgs.Files.Count > 0) { // Get the file and a Stream StorageFile storageFile = pickerArgs.Files[0]; IRandomAccessStreamWithContentType raStream = await storageFile.OpenReadAsync(); Stream stream = raStream.AsStreamForRead(); // Set the completion of the Task TaskCompletionSource.SetResult(stream); } else { TaskCompletionSource.SetResult(null); } } }
/// <summary> /// Called when the app is activated from a UX contract. /// </summary> /// <param name="e">Activation event</param> public void HandleAppContractActivated(IActivatedEventArgs e) { if (e is IContinuationActivatedEventArgs) { // Stores the event args, to be used for BaseViewModel navigation logic. ContractContinuationActivatedEventArgs = (IContinuationActivatedEventArgs)e; } }
protected override void OnActivated(IActivatedEventArgs args) { ContinuationEventArgs = args as IContinuationActivatedEventArgs; if (ContinuationEventHandler != null) { ContinuationEventHandler(this, ContinuationEventArgs); } }
public void Continue(IContinuationActivatedEventArgs args) { string action = (string)args.ContinuationData["Action"]; if (action == "RenderSupport.cameraTakePhoto") { rsupport.continueCameraTakePhoto(args); } }
/// <summary> /// Sets the ContinuationArgs for this instance. /// Should be called by the main activation handling code in App.xaml.cs. /// </summary> /// <param name="args">The activation args.</param> internal void Continue(IContinuationActivatedEventArgs args) { if (args.Kind == ActivationKind.WebAuthenticationBrokerContinuation) { var page = MainPage.Current as IWebAuthenticationContinuable; page?.ContinueWebAuthentication( args as WebAuthenticationBrokerContinuationEventArgs); } }
/// <summary> /// Windows Phone 文件选择器导航 /// </summary> protected override void OnActivated(IActivatedEventArgs e) { #if WINDOWS_PHONE_APP ContinuationActivatedEventArgs = e as IContinuationActivatedEventArgs; if (ContinuationEventArgsChanged != null) { ContinuationEventArgsChanged(this, ContinuationActivatedEventArgs); } #endif }
/// <summary> /// Sets the ContinuationArgs for this instance. Should be called by the main activation /// handling code in App.xaml.cs /// </summary> /// <param name="args">The activation args</param> /// <param name="rootFrame">The frame control that contains the current page</param> internal void Continue(IContinuationActivatedEventArgs args, object dataContext) { if (args == null) { throw new ArgumentNullException("args"); } if (this.args != null) { throw new InvalidOperationException("Can't set args more than once"); } this.args = args; this.id = Guid.NewGuid(); if (dataContext == null) { return; } switch (args.Kind) { case ActivationKind.PickFileContinuation: var fileOpenPickerViewModel = dataContext as IFileOpenPickerContinuable; if (fileOpenPickerViewModel != null) { fileOpenPickerViewModel.ContinueFileOpenPicker(args as FileOpenPickerContinuationEventArgs); } break; case ActivationKind.PickSaveFileContinuation: var fileSavePickerViewModel = dataContext as IFileSavePickerContinuable; if (fileSavePickerViewModel != null) { fileSavePickerViewModel.ContinueFileSavePicker(args as FileSavePickerContinuationEventArgs); } break; case ActivationKind.PickFolderContinuation: var folderPickerViewModel = dataContext as IFolderPickerContinuable; if (folderPickerViewModel != null) { folderPickerViewModel.ContinueFolderPicker(args as FolderPickerContinuationEventArgs); } break; case ActivationKind.WebAuthenticationBrokerContinuation: var wabViewModel = dataContext as IWebAuthenticationContinuable; if (wabViewModel != null) { wabViewModel.ContinueWebAuthentication(args as WebAuthenticationBrokerContinuationEventArgs); } break; } }
/// <summary> /// Sets the ContinuationArgs for this instance. Should be called by the main activation /// handling code in App.xaml.cs /// </summary> /// <param name="args">The activation args</param> /// <param name="rootFrame">The frame control that contains the current page</param> internal void Continue(IContinuationActivatedEventArgs args, Frame rootFrame) { if (args == null) throw new ArgumentNullException("args"); if (this.args != null && !handled) throw new InvalidOperationException("Can't set args more than once"); this.args = args; this.handled = false; this.id = Guid.NewGuid(); if (rootFrame == null) return; switch (args.Kind) { case ActivationKind.PickFileContinuation: var fileOpenPickerPage = rootFrame.Content as IFileOpenPickerContinuable; if (fileOpenPickerPage != null) { fileOpenPickerPage.ContinueFileOpenPicker(args as FileOpenPickerContinuationEventArgs); } break; case ActivationKind.PickSaveFileContinuation: var fileSavePickerPage = rootFrame.Content as IFileSavePickerContinuable; if (fileSavePickerPage != null) { fileSavePickerPage.ContinueFileSavePicker(args as FileSavePickerContinuationEventArgs); } break; case ActivationKind.PickFolderContinuation: var folderPickerPage = rootFrame.Content as IFolderPickerContinuable; if (folderPickerPage != null) { folderPickerPage.ContinueFolderPicker(args as FolderPickerContinuationEventArgs); } break; case ActivationKind.WebAuthenticationBrokerContinuation: IWebAuthenticationContinuable wabPage; if (args.ContinuationData.ContainsKey("IdentityManager.OAuthAuthorize")) wabPage = IdentityManager.Current.OAuthAuthorizeHandler as IWebAuthenticationContinuable; else wabPage = rootFrame.Content as IWebAuthenticationContinuable; if (wabPage != null) { wabPage.ContinueWebAuthentication(args as WebAuthenticationBrokerContinuationEventArgs); } break; } }
/// <summary> /// Continue to target frame (or DataContext of that). /// </summary> /// <typeparam name="T">event type</typeparam> /// <param name="targetFrame">target frame</param> /// <param name="args">event args</param> private static void ContinueTo <T>(Frame targetFrame, IContinuationActivatedEventArgs args) where T : class, IContinuationActivatedEventArgs { var typedArgs = args as T; var continuable = GetContinuationTargetAs <IContinuable <T> >(targetFrame); if (continuable != null && typedArgs != null) { continuable.Continue(typedArgs); } }
protected override void OnActivated(IActivatedEventArgs e) { CreateRootFrame(e.PreviousExecutionState); ContinuationActivatedEventArgs = e as IContinuationActivatedEventArgs; if (ContinuationEventArgsChanged != null) { ContinuationEventArgsChanged(this, ContinuationActivatedEventArgs); } }
public void OnContinue(IContinuationActivatedEventArgs e) { if (e is FileOpenPickerContinuationEventArgs) { OnFilePickerOpened((FileOpenPickerContinuationEventArgs)e); } else if (e is FileSavePickerContinuationEventArgs) { OnFilePickerSaved((FileSavePickerContinuationEventArgs)e); } }
protected override void OnActivated(IActivatedEventArgs e) { CreateRootFrame(e.PreviousExecutionState); ContinuationActivatedEventArgs = e as IContinuationActivatedEventArgs; if (ContinuationEventArgsChanged != null) { ContinuationEventArgsChanged(this, ContinuationActivatedEventArgs); } }
public NavigationInfo(NavigationContext ctx, NavigationMode mode) { NavigationContext = ctx; NavigationMode = mode; // Checks for a continuation operation. IContinuationActivatedEventArgs e = App.Current.ViewModel.ContractContinuationActivatedEventArgs; ContinuationEventArgs = e; if (e != null) { ContinuationOperation = e.ContinuationData.GetValueOrDefault<string>(ContinuationOperationKey); } }
public bool HandleActivation(IContinuationActivatedEventArgs args, Frame rootFrame) { if (args.Kind == ActivationKind.WebAuthenticationBrokerContinuation) { var wabPage = rootFrame.Content as IWebAuthenticationContinuable; if (wabPage != null) { wabPage.ContinueWebAuthentication(args as WebAuthenticationBrokerContinuationEventArgs); } return(true); } return(false); }
/// <summary> /// Sets the ContinuationArgs for this instance. /// Should be called by the main activation handling code in App.xaml.cs. /// </summary> /// <param name="args">The activation args.</param> internal void Continue(IContinuationActivatedEventArgs args) { switch (args.Kind) { case ActivationKind.WebAuthenticationBrokerContinuation: var page = MainPage.Current as IWebAuthenticationContinuable; if (page != null) { page.ContinueWebAuthentication(args as WebAuthenticationBrokerContinuationEventArgs); } break; } }
public bool HandleActivation(IContinuationActivatedEventArgs args, Frame rootFrame) { if (args.Kind == ActivationKind.WebAuthenticationBrokerContinuation) { var wabPage = rootFrame.Content as IWebAuthenticationContinuable; if (wabPage != null) { wabPage.ContinueWebAuthentication(args as WebAuthenticationBrokerContinuationEventArgs); } return true; } return false; }
/// <summary> /// Sets the ContinuationArgs for this instance. /// Should be called by the main activation handling code in App.xaml.cs. /// </summary> /// <param name="args">The activation args.</param> internal void Continue(IContinuationActivatedEventArgs args) { switch (args.Kind) { case ActivationKind.WebAuthenticationBrokerContinuation: var page = MainPage.Current as IWebAuthenticationContinuable; if (page != null) { page.ContinueWebAuthentication(args as WebAuthenticationBrokerContinuationEventArgs); } break; } }
/// <summary> /// Sets the ContinuationArgs for this instance. Should be called by the main activation /// handling code in App.xaml.cs /// </summary> /// <param name="args">The activation args</param> /// <param name="rootFrame">The frame control that contains the current page</param> public void Continue(IContinuationActivatedEventArgs args, Frame rootFrame) { if (args == null) throw new ArgumentNullException("args"); if (this.args != null && !handled) throw new InvalidOperationException("Can't set args more than once"); this.args = args; handled = false; Id = Guid.NewGuid(); if (rootFrame == null) return; switch (args.Kind) { case ActivationKind.PickFileContinuation: var fileOpenPickerPage = rootFrame.Content as IFileOpenPickerContinuable; if (fileOpenPickerPage != null) { fileOpenPickerPage.ContinueFileOpenPicker(args as FileOpenPickerContinuationEventArgs); } break; case ActivationKind.PickSaveFileContinuation: var fileSavePickerPage = rootFrame.Content as IFileSavePickerContinuable; if (fileSavePickerPage != null) { fileSavePickerPage.ContinueFileSavePicker(args as FileSavePickerContinuationEventArgs); } break; case ActivationKind.PickFolderContinuation: var folderPickerPage = rootFrame.Content as IFolderPickerContinuable; if (folderPickerPage != null) { folderPickerPage.ContinueFolderPicker(args as FolderPickerContinuationEventArgs); } break; case ActivationKind.WebAuthenticationBrokerContinuation: var wabPage = rootFrame.Content as IWebAuthenticationContinuable; if (wabPage != null) { wabPage.ContinueWebAuthentication(args as WebAuthenticationBrokerContinuationEventArgs); } break; } }
public NavigationInfo(NavigationContext ctx, NavigationMode mode, Uri uri) { NavigationContext = ctx; NavigationMode = mode; Uri = uri; // Checks for a continuation operation. IContinuationActivatedEventArgs e = App.Current.ViewModel.ContractContinuationActivatedEventArgs; ContinuationEventArgs = e; if (e != null) { ContinuationOperation = e.ContinuationData.GetValueOrDefault <string>(ContinuationOperationKey); } }
internal static void Continue(IContinuationActivatedEventArgs continuationActivatedEventArgs) { var rootFrame = Window.Current.Content as Frame; if (rootFrame == null) return; var page = rootFrame.Content as Page; if (page == null) return; if (continuationActivatedEventArgs.Kind == ActivationKind.PickFileContinuation) { var openPickerContinuable = page.DataContext as IFileOpenPickerContinuable; var fileOpenArgs = continuationActivatedEventArgs as FileOpenPickerContinuationEventArgs; if(openPickerContinuable != null && fileOpenArgs != null) openPickerContinuable.ContinueFileOpenPicker(fileOpenArgs.Files); } }
public async void ContinueFileOpenPicker(IContinuationActivatedEventArgs args) { switch (args.Kind) { case ActivationKind.PickFileContinuation: this.Files = (args as FileOpenPickerContinuationEventArgs).Files; if (this.Files != null && this.Files.Count > 0) { this.File = this.Files[0]; if (FilePickerFinish != null) { this.FilePickerFinish(this.File, null); } } break; case ActivationKind.PickFolderContinuation: this.Folder = (args as FolderPickerContinuationEventArgs).Folder; if (this.Folder != null) { StorageApplicationPermissions.FutureAccessList.AddOrReplace("FeaturePickFolder", this.Folder); if (FilePickerFinish != null) { this.FilePickerFinish(this.Folder, null); } } break; case ActivationKind.PickSaveFileContinuation: StorageFile file = (args as FileSavePickerContinuationEventArgs).File; if (file != null) { CachedFileManager.DeferUpdates(file); await FileIO.WriteTextAsync(file, this.Content); FileUpdateStatus status = await CachedFileManager.CompleteUpdatesAsync(file); if (status == FileUpdateStatus.Complete) { if (FilePickerFinish != null) { this.FilePickerFinish("Complete", null); } } } break; } }
public static void Continue(IContinuationActivatedEventArgs args) { if (args != null) { switch (args.Kind) { case ActivationKind.PickFileContinuation: read((args as FileOpenPickerContinuationEventArgs).Files[0]); break; case ActivationKind.PickSaveFileContinuation: write((args as FileSavePickerContinuationEventArgs).File, data); break; } } }
/// <summary> /// Sets the ContinuationArgs for this instance. Should be called by the main activation /// handling code in App.xaml.cs /// </summary> /// <param name="args">The activation args</param> /// <param name="rootFrame">The frame control that contains the current page</param> internal void Continue(IContinuationActivatedEventArgs args) { if (args == null) { throw new ArgumentNullException("args"); } if (this.args != null && !handled) { throw new InvalidOperationException("Can't set args more than once"); } this.args = args; this.handled = false; this.id = Guid.NewGuid(); Global.Current.FilePicker.ContinueFileOpenPicker(args); }
/// <summary> /// Sets the ContinuationArgs for this instance. Should be called by the main activation /// handling code in App.xaml.cs /// </summary> /// <param name="args">The activation args</param> internal void Continue(IContinuationActivatedEventArgs args) { if (args == null) { throw new ArgumentNullException("args"); } this.args = args; id = Guid.NewGuid(); switch (args.Kind) { case ActivationKind.PickFileContinuation: var fileOpenPickerPage = App.Navigator.CurrentPage as IFileOpenPickerContinuable; if (fileOpenPickerPage != null) { fileOpenPickerPage.ContinueFileOpenPicker(args as FileOpenPickerContinuationEventArgs); } break; case ActivationKind.PickSaveFileContinuation: var fileSavePickerPage = App.Navigator.CurrentPage as IFileSavePickerContinuable; if (fileSavePickerPage != null) { fileSavePickerPage.ContinueFileSavePicker(args as FileSavePickerContinuationEventArgs); } break; case ActivationKind.PickFolderContinuation: var folderPickerPage = App.Navigator.CurrentPage as IFolderPickerContinuable; if (folderPickerPage != null) { folderPickerPage.ContinueFolderPicker(args as FolderPickerContinuationEventArgs); } break; case ActivationKind.WebAuthenticationBrokerContinuation: var wabPage = App.Navigator.CurrentPage as IWebAuthenticationContinuable; if (wabPage != null) { wabPage.ContinueWebAuthentication(args as WebAuthenticationBrokerContinuationEventArgs); } break; } }
private async void App_ContinuationEventArgsChanged(object sender, IContinuationActivatedEventArgs e) { App.ContinuationEventArgsChanged -= App_ContinuationEventArgsChanged; var openFileArgs = e as FileOpenPickerContinuationEventArgs; var saveFileArgs = e as FileSavePickerContinuationEventArgs; if (openFileArgs != null && openFileArgs.Files != null && openFileArgs.Files.Count > 0) { App.ChosenPhoto = openFileArgs.Files[0]; if (App.ChosenPhoto != null) { await _imaging.RenderPlainPhoto(ImageControl); } } }
/// <summary> /// Sets the ContinuationArgs for this instance. Should be called by the main activation /// handling code in App.xaml.cs /// </summary> /// <param name="args">The activation args</param> internal void Continue(IContinuationActivatedEventArgs args) { if (args == null) throw new ArgumentNullException("args"); this.args = args; id = Guid.NewGuid(); switch (args.Kind) { case ActivationKind.PickFileContinuation: var fileOpenPickerPage = App.Navigator.CurrentPage as IFileOpenPickerContinuable; if (fileOpenPickerPage != null) { fileOpenPickerPage.ContinueFileOpenPicker(args as FileOpenPickerContinuationEventArgs); } break; case ActivationKind.PickSaveFileContinuation: var fileSavePickerPage = App.Navigator.CurrentPage as IFileSavePickerContinuable; if (fileSavePickerPage != null) { fileSavePickerPage.ContinueFileSavePicker(args as FileSavePickerContinuationEventArgs); } break; case ActivationKind.PickFolderContinuation: var folderPickerPage = App.Navigator.CurrentPage as IFolderPickerContinuable; if (folderPickerPage != null) { folderPickerPage.ContinueFolderPicker(args as FolderPickerContinuationEventArgs); } break; case ActivationKind.WebAuthenticationBrokerContinuation: var wabPage = App.Navigator.CurrentPage as IWebAuthenticationContinuable; if (wabPage != null) { wabPage.ContinueWebAuthentication(args as WebAuthenticationBrokerContinuationEventArgs); } break; } }
/// <summary> /// Sets the ContinuationArgs for this instance. /// Should be called by the main activation handling code in App.xaml.cs. /// </summary> /// <param name="args">The activation args.</param> internal void Continue(IContinuationActivatedEventArgs args) { if (args.Kind == ActivationKind.WebAuthenticationBrokerContinuation) { if (Current != null) { Current.ContinueWebAuthentication( args as WebAuthenticationBrokerContinuationEventArgs); } } else if (args.Kind == ActivationKind.PickFolderContinuation) { if (PickFolderContinuableCurrent != null) { PickFolderContinuableCurrent.ContinueFolderPicking( args as FolderPickerContinuationEventArgs); } } }
private async void ExportSaveGameContinue(IContinuationActivatedEventArgs e) { // Returns if no target file was selected. FileSavePickerContinuationEventArgs args = e as FileSavePickerContinuationEventArgs; if (args == null || args.File == null) { return; } // Gets the source filename. string sourceFilename = args.ContinuationData.GetValueOrDefault <string>(ExportSavegameSourceFileKey); if (sourceFilename == null) { return; } // Copies the source file to the target file. StorageFile targetFile = args.File; try { using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication()) { using (IsolatedStorageFileStream isfs = isf.OpenFile(sourceFilename, System.IO.FileMode.Open, System.IO.FileAccess.Read)) { using (Stream outputStream = await targetFile.OpenStreamForWriteAsync()) { await isfs.CopyToAsync(outputStream); } } } MessageBox.Show(String.Format("Export succeeded to {0}.", targetFile.Path), "Success", MessageBoxButton.OK); } catch (Exception ex) { DebugUtils.DumpException(ex, "Export savegame"); MessageBox.Show(String.Format("Cannot export savegame to {0}. An error occured: {1}", targetFile.Path, ex.Message), "Error", MessageBoxButton.OK); } }
/// <summary> /// Sets the ContinuationArgs for this instance. Using default Frame of current Window /// Should be called by the main activation handling code in App.xaml.cs /// </summary> /// <param name="args">The activation args</param> internal void Continue(IContinuationActivatedEventArgs args) { var view = this.GetCurrentView(); if (view == null) { return; } object dataContext = view.DataContext; //파일열기전 viewModel을 지정한 경우 overriding if (args.ContinuationData.ContainsKey(SOURCE_VIEW_MODEL_TYPE_FULL_NAME)) { var viewModelTypeName = args.ContinuationData[SOURCE_VIEW_MODEL_TYPE_FULL_NAME] as string; dataContext = ServiceLocator.Current.GetInstance(Type.GetType(viewModelTypeName)); } this.Continue(args, dataContext); }
/// <summary> /// Sets the ContinuationArgs for this instance. /// Should be called by the main activation handling code in App.xaml.cs. /// </summary> /// <param name="args">The activation args.</param> internal void Continue(IContinuationActivatedEventArgs args) { if (args.Kind == ActivationKind.WebAuthenticationBrokerContinuation) { if (Current != null) { Current.ContinueWebAuthentication( args as WebAuthenticationBrokerContinuationEventArgs); } } else if(args.Kind == ActivationKind.PickFolderContinuation) { if(PickFolderContinuableCurrent != null) { PickFolderContinuableCurrent.ContinueFolderPicking( args as FolderPickerContinuationEventArgs); } } }
private async void App_ContinuationEventArgsChanged(object sender, IContinuationActivatedEventArgs e) { App.ContinuationEventArgsChanged -= App_ContinuationEventArgsChanged; var args = e as FileSavePickerContinuationEventArgs; if (args != null && (args.ContinuationData["Operation"] as string) == "SavePhotoFile") { if (args.File != null) { await SavePhotoAsync(Preview.Model, args.File); System.Diagnostics.Debug.WriteLine("Photo saved to " + args.File.Path); } else { System.Diagnostics.Debug.WriteLine("Photo not saved"); } } }
/// <summary> /// Called when the application is restored on the phone from e.g. a file picker dialog /// </summary> protected async override void OnActivated(IActivatedEventArgs args) { base.OnActivated(args); ContinuationManager = new ContinuationManager(); if (args.PreviousExecutionState == ApplicationExecutionState.Terminated) { try { await SuspensionManager.RestoreAsync(); } catch (Exception e) { } } // Get the event args for the continuation, and run them through the continuationmanager to feed the right information into the page that paused for it IContinuationActivatedEventArgs eventArgs = (IContinuationActivatedEventArgs)args; if (eventArgs != null) { ContinuationManager.Continue(eventArgs, (Frame)Window.Current.Content); } // Load the app into the front of the phone Window.Current.Activate(); }
internal void HandleContinuation(IContinuationActivatedEventArgs continuationEventArgs) { if (mainNavigationFrame != null && mainNavigationFrame.Content is AlbumPage) { if (continuationEventArgs is FileOpenPickerContinuationEventArgs) { AlbumPage currentAlbumPage = DebugHelper.CastAndAssert <AlbumPage>(mainNavigationFrame.Content); FileOpenPickerContinuationEventArgs filePickerOpenArgs = DebugHelper.CastAndAssert <FileOpenPickerContinuationEventArgs>(continuationEventArgs); currentAlbumPage.HandleFilePickerLaunch(filePickerOpenArgs); } } else if (mainNavigationFrame != null && mainNavigationFrame.Content is ManageLibrary) { if (continuationEventArgs is FileOpenPickerContinuationEventArgs) { FileOpenPickerContinuationEventArgs filePickerOpenArgs = DebugHelper.CastAndAssert <FileOpenPickerContinuationEventArgs>(continuationEventArgs); if (filePickerOpenArgs.Files.Count > 0) { DebugHelper.Assert(new CallerInfo(), filePickerOpenArgs.Files.Count == 1); IStorageFile pickedFile = filePickerOpenArgs.Files[0]; MediaImportManager.Current.HandleFilePickerLaunch(pickedFile); } } else if (continuationEventArgs is FolderPickerContinuationEventArgs) { FolderPickerContinuationEventArgs folderOpenArgs = DebugHelper.CastAndAssert <FolderPickerContinuationEventArgs>(continuationEventArgs); if (folderOpenArgs.Folder != null) { MediaImportManager.Current.HandleSyncFolderLaunch(folderOpenArgs.Folder); } } } }
internal void HandleContinuation(IContinuationActivatedEventArgs continuationEventArgs) { if (mainNavigationFrame != null && mainNavigationFrame.Content is AlbumPage) { if (continuationEventArgs is FileOpenPickerContinuationEventArgs) { AlbumPage currentAlbumPage = DebugHelper.CastAndAssert<AlbumPage>(mainNavigationFrame.Content); FileOpenPickerContinuationEventArgs filePickerOpenArgs = DebugHelper.CastAndAssert<FileOpenPickerContinuationEventArgs>(continuationEventArgs); currentAlbumPage.HandleFilePickerLaunch(filePickerOpenArgs); } } else if (mainNavigationFrame != null && mainNavigationFrame.Content is ManageLibrary) { if (continuationEventArgs is FileOpenPickerContinuationEventArgs) { FileOpenPickerContinuationEventArgs filePickerOpenArgs = DebugHelper.CastAndAssert<FileOpenPickerContinuationEventArgs>(continuationEventArgs); if (filePickerOpenArgs.Files.Count > 0) { DebugHelper.Assert(new CallerInfo(), filePickerOpenArgs.Files.Count == 1); IStorageFile pickedFile = filePickerOpenArgs.Files[0]; MediaImportManager.Current.HandleFilePickerLaunch(pickedFile); } } else if (continuationEventArgs is FolderPickerContinuationEventArgs) { FolderPickerContinuationEventArgs folderOpenArgs = DebugHelper.CastAndAssert<FolderPickerContinuationEventArgs>(continuationEventArgs); if (folderOpenArgs.Folder != null) { MediaImportManager.Current.HandleSyncFolderLaunch(folderOpenArgs.Folder); } } } }
/// <summary> /// Sets the ContinuationArgs for this instance. Should be called by the main activation /// handling code in App.xaml.cs /// </summary> /// <param name="args">The activation args</param> /// <param name="rootFrame">The frame control that contains the current page</param> internal void Continue(IContinuationActivatedEventArgs args, Frame rootFrame) { if (args == null) throw new ArgumentNullException("args"); if (this.args != null && !handled) throw new InvalidOperationException("Can't set args more than once"); this.args = args; this.id = Guid.NewGuid(); if (rootFrame == null) return; var webPage = rootFrame.Content as IWebAuthenticationContinuable; if (webPage != null) { webPage.ContinueWebAuthentication(args as WebAuthenticationBrokerContinuationEventArgs); } }
/// <summary> /// Sets the ContinuationArgs for this instance. Using default Frame of current Window /// Should be called by the main activation handling code in App.xaml.cs. /// </summary> /// <param name="args">The activation args.</param> internal void Continue(IContinuationActivatedEventArgs args) { Continue(args, Window.Current.Content as Frame); }
private async void App_ContinuationEventArgsChanged(object sender, IContinuationActivatedEventArgs e) { App.ContinuationEventArgsChanged -= App_ContinuationEventArgsChanged; var args = e as FileSavePickerContinuationEventArgs; if (args != null && (args.ContinuationData["Operation"] as string) == "SavePhotoFile") { if (args.File != null) { await SavePhotoAsync(Preview.Model, args.File); System.Diagnostics.Debug.WriteLine("Photo saved to " + args.File.Path); } else { System.Diagnostics.Debug.WriteLine("Photo not saved"); } } }
private async void App_ContinuationEventArgsChanged(object sender, IContinuationActivatedEventArgs e) { App.ContinuationEventArgsChanged -= App_ContinuationEventArgsChanged; var fileArgs = e as FileOpenPickerContinuationEventArgs; var folderArgs = e as FolderPickerContinuationEventArgs; if (fileArgs != null && (fileArgs.ContinuationData["Operation"] as string) == "OpenPhotoFile" && fileArgs.Files != null && fileArgs.Files.Count > 0) { var file = fileArgs.Files[0]; SessionModel.Instance.Photo = new FilteredPhotoModel(file); var frame = (Frame)Window.Current.Content; frame.Navigate(typeof(PhotoPage)); } else if (folderArgs != null && (folderArgs.ContinuationData["Operation"] as string) == "OpenPhotoFolder" && folderArgs.Folder != null) { var folder = folderArgs.Folder; if (folder != null && (SessionModel.Instance.Folder == null || folder.Path != SessionModel.Instance.Folder.Path)) { SessionModel.Instance.Folder = folder; await Refresh(); } } }
/// <summary> /// Called when the app is activated from a UX contract. /// </summary> /// <param name="e">Activation event</param> public void HandleAppContractActivated(IActivatedEventArgs e) { if (e is IContinuationActivatedEventArgs) { // Stores the event args, to be used for BaseViewModel navigation logic. ContractContinuationActivatedEventArgs = (IContinuationActivatedEventArgs)e; } }