Inheritance: IFileActivatedEventArgs, IActivatedEventArgs
Exemplo n.º 1
0
        protected override async void OnFileActivated(FileActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                //this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                //TODO: Load state from previously suspended application
            }

            var appShell = Window.Current.Content as AppShell;

            if (appShell == null)
            {
                Window.Current.Content = appShell = new AppShell(e);
            }
            else
            {
                appShell.HandleFileActivation(e);
            }

            Window.Current.Activate();
            //DisableSearchPaneOnFocusHandler.IsSearchEnabled = false;

            base.OnFileActivated(e);
        }
Exemplo n.º 2
0
 internal async Task HandleFileActivationAsync(FileActivatedEventArgs e)
 {
     foreach (StorageFile file in e.Files.OfType<StorageFile>())
     {
         DC.Trace(await FileIO.ReadTextAsync(file));
     }
 }
Exemplo n.º 3
0
 protected async override void OnFileActivated(FileActivatedEventArgs args)
 {
    if(args.Files != null && args.Files.Count > 0)
    {
        //string path2m3u = args.Files[0].Path;
        //StorageFile file = await StorageFile.GetFileFromPathAsync(path2m3u);
        StorageFile file = (StorageFile)args.Files[0];
        IList<string> data = await FileIO.ReadLinesAsync(file);
        string streamUrl = data.ToList().Find(item => item.StartsWith("http://"));
        //string streamUrl = data[0].Substring(data[0].IndexOf("http://"));
        Frame rootFrame = Window.Current.Content as Frame;
        if (rootFrame == null)
        {
            rootFrame = new Frame();
            SuspensionManager.RegisterFrame(rootFrame, "AppFrame");
            if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                try
                {
                    await SuspensionManager.RestoreAsync();
                }
                catch (SuspensionManagerException) { }
            }
            Window.Current.Content = rootFrame;
        }              
         if (!rootFrame.Navigate(typeof(PlayerPage), streamUrl))
         {
             throw new Exception("Failed to create initial page");
         }
      
    }
 }
Exemplo n.º 4
0
        protected override void OnFileActivated(FileActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

            }
            if (args.Files[0] != null)
            {
                StorageFile file = args.Files[0] as StorageFile;
                Window.Current.Content = rootFrame;
                Dictionary<String, Object> p = new Dictionary<String, Object>();
                p.Add("DeckFile", file);
                rootFrame.Navigate(typeof(DeckSummaryPage), p);
            } else {
                throw new Exception("Failed to create initial page");
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
Exemplo n.º 5
0
 public void Handle(FileActivatedEventArgs e)
 {
     if (e.Files.Any())
     {
         ParseData((StorageFile)e.Files[0]);
     }
 }
Exemplo n.º 6
0
        protected override async void OnFileActivated(FileActivatedEventArgs args)
        {
            await InitializeFrameAsync(args.PreviousExecutionState);

            // TODO: Implement this directly in App.xaml.cs
            FilePickerPage.OnFileActivated(args);
        }
Exemplo n.º 7
0
        protected override void OnFileActivated(FileActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                //this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                //TODO: Load state from previously suspended application
            }

            var appShell = Window.Current.Content as AppShell;

            if (appShell == null)
            {
                Window.Current.Content = appShell = new AppShell(e);
            }
            else
            {
#pragma warning disable 4014
                appShell.HandleFileActivationAsync(e);
#pragma warning restore 4014
            }
            
            Window.Current.Activate();

            base.OnFileActivated(e);
        }
Exemplo n.º 8
0
        public AppShell(FileActivatedEventArgs e)
        {
            this.InitializeComponent();
            Frame = this.RootFrame;
            //Frame.CacheSize = 1;

//            if (Frame.Content == null)
//            {
//#if WINDOWS_PHONE_APP
//    // Removes the turnstile navigation for startup.
//                if (rootFrame.ContentTransitions != null)
//                {
//                    this.transitions = new TransitionCollection();
//                    foreach (var c in rootFrame.ContentTransitions)
//                    {
//                        this.transitions.Add(c);
//                    }
//                }

//                rootFrame.ContentTransitions = null;
//                rootFrame.Navigated += this.RootFrame_FirstNavigated;
//#endif
//            }

            Frame.Navigate(typeof(MainPage), e);
            InitializeNavigationHelper();
        }
Exemplo n.º 9
0
        public async Task Initialize(FileActivatedEventArgs args)
        {
            var file = args.Files[0];

            var folderPath = file.Path.Replace(file.Name, string.Empty);
            var folder = await StorageFolder.GetFolderFromPathAsync(folderPath);

            await SetPictures(await folder.GetFilesAsync());
        }
Exemplo n.º 10
0
        public AppShell(FileActivatedEventArgs args)
        {
            this.InitializeComponent();
            InitializeFrame(args);
#pragma warning disable 4014
            this.HandleFileActivationAsync(args);
#pragma warning restore 4014
            this.Loaded += this.OnLoaded;
        }
Exemplo n.º 11
0
        public AppShell(FileActivatedEventArgs e)
        {
            this.InitializeComponent();
            Frame = this.RootFrame;
            Frame.Navigate(typeof(MainPage), e);
#pragma warning disable 4014
            this.HandleFileActivationAsync(e);
#pragma warning restore 4014
        }
        protected override void OnFileActivated(FileActivatedEventArgs args)
        {
            base.OnFileActivated(args);

            if (args.Files.Count == 1)
            {
                MainPage.Current.LaunchParam = "file: " + args.Files[0].Name;
            }
        }
        protected override async void OnFileActivated(FileActivatedEventArgs args)
        {
            var storageFile = await StorageFile.GetFileFromPathAsync(args.Files.FirstOrDefault().Path);

            App.ViewModel.SelectedDocument = new ViewModel.DocumentViewModel { StorageFile = storageFile };

            ((Window.Current.Content as Frame).Content as MainView).OpenFile(storageFile);

            base.OnFileActivated(args);
        }
Exemplo n.º 14
0
 protected override void OnFileActivated(FileActivatedEventArgs args)
 {
     base.OnFileActivated(args);
     try
     {
         var wechat = new WXEntryBasePage();
         wechat.Handle(args);
     }
     catch (Exception)
     {
         // ignored
     }
 }
        protected async override void OnFileActivated(FileActivatedEventArgs args)
        {
            base.OnFileActivated(args);

            // find the page and tell it...
            var frame = (Frame)Window.Current.Content;
            if (!(frame.Content is FileActivationPage))
                frame.Navigate(typeof(FileActivationPage));

            // if...
            if (frame.Content is FileActivationPage)
                await ((FileActivationPage)frame.Content).FilesActivatedAsync(args.Files);
        }
Exemplo n.º 16
0
        protected async override void OnFileActivated(FileActivatedEventArgs args)
        {
            base.OnFileActivated(args);

            if (NavigationService == null)
            {
                await InitializeFrameAsync(args);
            }

            var torrents = await Helpers.GenerateTorrentFileDataAsync(args.Files);

            _eventAggregator.GetEvent<FileActivated>().Publish(torrents);
        }
Exemplo n.º 17
0
        protected async override void OnFileActivated(FileActivatedEventArgs e)
        {
            System.Diagnostics.Debug.WriteLine("App started.");
            HelperMethods.clearTempFiles();

            //Startup stuff
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

                // Ensure the current window is active
                Window.Current.Activate();
                System.Diagnostics.Debug.WriteLine("App goes to correct path.");
                Windows.Storage.IStorageItem file = e.Files.First();
                Windows.Storage.AccessCache.StorageApplicationPermissions.FutureAccessList.AddOrReplace("passFileToken", file);
                MessageDialog msgbox = new MessageDialog("Would you like to add this item to your wallet?", "Importing .PKPASS file!");
                UICommand uiYes = new UICommand("Yes");
                UICommand uiNo = new UICommand("No");
                msgbox.Commands.Add(uiYes);
                msgbox.Commands.Add(uiNo);
                msgbox.DefaultCommandIndex = 0;
                msgbox.CancelCommandIndex = 1;
            if (await msgbox.ShowAsync() == uiYes)
                rootFrame.Navigate(typeof(PassProcessor), "fileToken");
            else rootFrame.Navigate(typeof(MainPage));
        }
Exemplo n.º 18
0
        protected override void OnFileActivated(FileActivatedEventArgs args)
        {
            InitConfigurationInThisAssembly();
            Frame rootFrame = CreatOrSetupeRootFrame();
            if (rootFrame.Content == null)
            {
                rootFrame.Navigate(typeof(MainPage), null);
            }

            ConfigTitlebar();

            CurrentFile.OnNext(args.Files.FirstOrDefault());
            Window.Current.Activate();
            //base.OnFileActivated(args);
        }
Exemplo n.º 19
0
        /// <summary>
        /// Invoked when application is launched via file
        /// Read more - http://msdn.microsoft.com/library/windows/apps/br224742
        /// </summary>
        /// <param name="args"></param>
        protected override void OnFileActivated(FileActivatedEventArgs args)
        {
            string appArgs = "";

            splashScreen = args.SplashScreen;
            appArgs += "File=";
            bool firstFileAdded = false;
            foreach (var file in args.Files)
            {
                if (firstFileAdded) appArgs += ";";
                appArgs += file.Path;
                firstFileAdded = true;
            }

            InitializeUnity(appArgs);
        }
Exemplo n.º 20
0
        // https://msdn.microsoft.com/en-us/windows/uwp/launch-resume/handle-file-activation
        protected override void OnFileActivated(FileActivatedEventArgs args)
        {
            // TODO: Handle file activation
            // The number of files received is args.Files.Size
            // The name of the first file is args.Files[0].Name

            #if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = false;
            }
            #endif

            Frame rootFrame = Window.Current.Content as Frame;

            // ウィンドウに既にコンテンツが表示されている場合は、アプリケーションの初期化を繰り返さずに、
            // ウィンドウがアクティブであることだけを確認してください
            if (rootFrame == null)
            {
                // ナビゲーション コンテキストとして動作するフレームを作成し、最初のページに移動します
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: 以前中断したアプリケーションから状態を読み込みます
                }

                // フレームを現在のウィンドウに配置します
                Window.Current.Content = rootFrame;
            }

            // Get file
            var storageFile = args.Files[0] as StorageFile;

            if (rootFrame.Content == null)
            {
                // ナビゲーション スタックが復元されない場合は、最初のページに移動します。
                // このとき、必要な情報をナビゲーション パラメーターとして渡して、新しいページを
                //構成します
                rootFrame.Navigate(typeof(SharePage), storageFile);
            }
            // 現在のウィンドウがアクティブであることを確認します
            Window.Current.Activate();
        }
Exemplo n.º 21
0
        protected override void OnFileActivated(FileActivatedEventArgs args)
        {
            var rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();
            }

            if (args.Files != null && args.Files.Any())
            {
                rootFrame.Navigate(typeof(MainPage), args);
                Window.Current.Content = rootFrame;
                var p = rootFrame.Content as MainPage;
            }

            Window.Current.Activate();
        }
        /// <summary>
        // Handle file activations.
        /// </summary>
        protected override void OnFileActivated(FileActivatedEventArgs e)
        {
            Frame rootFrame = CreateRootFrame();

            if (rootFrame.Content == null)
            {
                if (!rootFrame.Navigate(typeof(MainPage)))
                {
                    throw new Exception("Failed to create initial page");
                }
            }

            var p = rootFrame.Content as MainPage;
            p.NavigateToPageWithParameter(2, e);

            // Ensure the current window is active
            Window.Current.Activate();
        }
Exemplo n.º 23
0
        protected override void OnFileActivated(FileActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (!rootFrame.Navigate(typeof(MainPage), args.Files.First()))
            {
                throw new Exception("Failed to create initial page");
            }

            Window.Current.Activate();
        }
Exemplo n.º 24
0
        protected override async void OnFileActivated(FileActivatedEventArgs args)
        {
            Frame rootFrame = Window.Current.Content as Frame;
            if (args.Files.Count == 0)
                return;
            var file = args.Files[0] as StorageFile;
            if( ! file.Name.EndsWith(".ics", StringComparison.CurrentCultureIgnoreCase))
            {
                MessageDialog dialog = new MessageDialog("不支持的文件后缀名," + file.Name);
                await dialog.ShowAsync();
                return;
            }
            // 不要在窗口已包含内容时重复应用程序初始化,
            // 只需确保窗口处于活动状态
            if (rootFrame == null)
            {
                // 创建要充当导航上下文的框架,并导航到第一页
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                // 将框架放在当前窗口中
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // 当导航堆栈尚未还原时,导航到第一页,
                // 并通过将所需信息作为导航参数传入来配置
                // 参数
                rootFrame.Navigate(typeof(MainPage), file);
            }
            else if ( ((MainPage)rootFrame.Content).current != null )
                (rootFrame.Content as MainPage).current.ImportIcsFile(file as StorageFile);
            // 确保当前窗口处于活动状态
            Window.Current.Activate();
            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"))
            {
                await Windows.UI.ViewManagement.StatusBar.GetForCurrentView().HideAsync();
            }
        }
Exemplo n.º 25
0
        protected override void OnFileActivated(FileActivatedEventArgs args)
        {
            base.OnFileActivated(args);

            if (args.Files.Count > 0)
            {
                Frame rootFrame = getRootFrame();

                if (rootFrame.Content == null)
                {
                    rootFrame.Navigate(typeof(MainPage), args.Files[0] as StorageFile);
                }
                else
                {
                    ((MainPage)rootFrame.Content).OnFileReActivated(args.Files[0] as StorageFile);
                }

                // 現在のウィンドウがアクティブであることを確認します
                Window.Current.Activate();
            }
        }
Exemplo n.º 26
0
        // File extension registration (see Package.appxmanifest for file extension registartion)
        public static async void OnFileActivated(FileActivatedEventArgs args)
        {
            // TODO: Implement this directly in App.xaml.cs

            if (args.Kind == ActivationKind.File)
            {
                var file = args.Files[0];
                if (file.Name.EndsWith(".mytxt"))
                {
                    var frame = (MtFrame)Window.Current.Content;
                    var page = frame.CurrentPage.Page as FilePickerPage;
                    if (page == null)
                    {
                        await frame.NavigateAsync(typeof(FilePickerPage));
                        page = (FilePickerPage)frame.CurrentPage.Page;
                    }

                    page.Initialize(file);
                }
            }
        }
Exemplo n.º 27
0
        protected override void OnFileActivated(FileActivatedEventArgs args)
        {
            var locator = (ViewModelLocator)Resources["Locator"];
            var files = args.Files;
            foreach (StorageFile file in files)
            {
                var x = new LocalDocument(file);
                x.Load();
                locator.Main.Open(x);
            }

            var rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();
                rootFrame.Navigate(typeof(MainPage));
                Window.Current.Content = rootFrame;
            }

            Window.Current.Activate();
        }
Exemplo n.º 28
0
        /// <summary>
        /// Invoked when the application is launched to open a specific file or to access
        /// specific content. This is the entry point for Content Autoplay when camera
        /// memory is attached to the PC.
        /// </summary>
        /// <param name="args">Details about the file activation request.</param>
        protected override void OnFileActivated(FileActivatedEventArgs args)
        {
            Frame rootFrame = null;
            if (Window.Current.Content == null)
            {
                rootFrame = new Frame();
                rootFrame.Navigate(typeof(MainPage));
                Window.Current.Content = rootFrame;
            }
            else
            {
                rootFrame = Window.Current.Content as Frame;
            }
            Window.Current.Activate();
            MainPage mainPage = (MainPage)rootFrame.Content as MainPage;

            // Clear any device id so we always use the latest connected device
            mainPage.AutoplayNonFileSystemDeviceId = null;

            if (args.Verb == "storageDevice")
            {
                // Launched from Autoplay for content. This will return a single storage folder
                // representing that file system device.
                mainPage.AutoplayFileSystemDeviceFolder = args.Files[0] as StorageFolder;
                mainPage.FileActivationFiles = null;
            }
            else
            {
                // Launched to handle a file type.  This will return a list of image files that the user
                // requests for this application to handle.
                mainPage.FileActivationFiles = args.Files;
                mainPage.AutoplayFileSystemDeviceFolder = null;
            }

            // Select the Autoplay scenario
            mainPage.LoadAutoplayScenario();
        }
Exemplo n.º 29
0
 protected override async void OnFileActivated(FileActivatedEventArgs args)
 {
     var mobilePayService = ServiceLocator.Current.GetInstance<IMobilePayService>();
     var paymentResultHandler = ServiceLocator.Current.GetInstance<IPaymentResultHandler>();
     await mobilePayService.PaymentResultHandler.HandlePaymentResultFromFileAsync(args.Files.OfType<IStorageFile>().First(), paymentResultHandler.Success, paymentResultHandler.Failure);
     base.OnFileActivated(args);
 }
Exemplo n.º 30
0
 private async Task ManageOpeningFiles(FileActivatedEventArgs args)
 {
     if (Window.Current.Content == null)
         await LaunchTheApp();
     await Locator.MediaPlaybackViewModel.OpenFile(args.Files[0] as StorageFile);
 }