BaconographyW8.View.FileOpenPickerView.Activate C# (CSharp) Method

Activate() public method

Invoked when another application wants to open files from this application.
public Activate ( FileOpenPickerActivatedEventArgs args ) : void
args Windows.ApplicationModel.Activation.FileOpenPickerActivatedEventArgs Activation data used to coordinate the process with Windows.
return void
        public void Activate(FileOpenPickerActivatedEventArgs args)
        {
            this._fileOpenPickerUI = args.FileOpenPickerUI;
            _fileOpenPickerUI.Closing += _fileOpenPickerUI_Closing;

            Messenger.Default.Register<PickerFileMessage>(this, pickerSelectionChanged);

            Window.Current.Content = this;
            Window.Current.Activate();
        }

Usage Example

Example #1
0
        /// <summary>
        /// Invoked when the application is activated to display a file open picker.
        /// </summary>
        /// <param name="args">Details about the activation request.</param>
        protected override async void OnFileOpenPickerActivated(Windows.ApplicationModel.Activation.FileOpenPickerActivatedEventArgs args)
        {

            if (_baconProvider == null)
            {
                _baconProvider = new BaconProvider(new Tuple<Type, Object>[] { new Tuple<Type, Object>(typeof(IDynamicViewLocator), new DynamicViewLocator()) });

                await _baconProvider.Initialize(null);

                ViewModelLocator.Initialize(_baconProvider);
            }

            var fileOpenPickerPage = new FileOpenPickerView();
            fileOpenPickerPage.Activate(args);
        }