Ejemplo n.º 1
0
        public static void ContinueFolderOpenPicker(FolderPickerContinuationEventArgs args, FolderViewModel folderViewModel)
        {
            try
            {
                if (args == null || (args.ContinuationData["Operation"] as string) != "SelectDownloadFolder" || args.Folder == null)
                {
                    LogService.Log(MLogLevel.LOG_LEVEL_WARNING, "Error selecting the download destination folder");
                    ResetFolderPicker();
                    return;
                }

                if (!App.CloudDrive.IsUserOnline())
                {
                    return;
                }

                if (args.ContinuationData["NodeData"] != null)
                {
                    String        base64Handle = (String)args.ContinuationData["NodeData"];
                    NodeViewModel node;
                    if (App.LinkInformation.PublicNode != null && base64Handle.Equals(App.LinkInformation.PublicNode.getBase64Handle()))
                    {
                        node = NodeService.CreateNew(SdkService.MegaSdk, App.AppInformation, App.LinkInformation.PublicNode, ContainerType.PublicLink);
                        App.LinkInformation.Reset();
                    }
                    else
                    {
                        node = NodeService.CreateNew(folderViewModel.MegaSdk, App.AppInformation,
                                                     folderViewModel.MegaSdk.getNodeByBase64Handle(base64Handle), folderViewModel.Type);
                    }

                    if (node != null)
                    {
                        node.Download(TransfersService.MegaTransfers, args.Folder.Path);
                    }

                    ResetFolderPicker();
                    return;
                }

                folderViewModel.MultipleDownload(args.Folder.Path);
            }
            catch (Exception e)
            {
                LogService.Log(MLogLevel.LOG_LEVEL_ERROR, "Error preparing downloads", e);
                new CustomMessageDialog(AppMessages.AM_DownloadFailed_Title,
                                        AppMessages.AM_PrepareDownloadsFailed, App.AppInformation,
                                        MessageDialogButtons.Ok).ShowDialog();
            }
            finally
            {
                ResetFolderPicker();
            }
        }
Ejemplo n.º 2
0
        // Sample code for building a localized ApplicationBar
        //private void BuildLocalizedApplicationBar()
        //{
        //    // Set the page's ApplicationBar to a new instance of ApplicationBar.
        //    ApplicationBar = new ApplicationBar();

        //    // Create a new button and set the text value to the localized string from AppResources.
        //    ApplicationBarIconButton appBarButton = new ApplicationBarIconButton(new Uri("/Assets/AppBar/appbar.add.rest.png", UriKind.Relative));
        //    appBarButton.Text = AppResources.AppBarButtonText;
        //    ApplicationBar.Buttons.Add(appBarButton);

        //    // Create a new menu item with the localized string from AppResources.
        //    ApplicationBarMenuItem appBarMenuItem = new ApplicationBarMenuItem(AppResources.AppBarMenuItemText);
        //    ApplicationBar.MenuItems.Add(appBarMenuItem);
        //}
 

       

        public async void ContinueFromPickFolder(FolderPickerContinuationEventArgs pPick)
        {
            if (pPick.Folder == null)
                return;

            if (pPick.Folder.Path.ToLower() != @"d:\wpsystem")
                return;

            Logic.WpSystem = pPick.Folder;
            App.RootFrame.Navigate(new Uri("/TargetApplication.xaml", UriKind.RelativeOrAbsolute));
            //DoReplace(
            //    folder,
            //    "Microsoft.Upprv_1.1.1211.12_arm__8wekyb3d8bbwe",
            //    "new",
            //    new[] { "DeviceUpdateUtils.dll", "wptd.exe" });
            //DoReplace(
            //                folder,
            //                "Microsoft.WPDiet_2.0.15086.130_arm__8wekyb3d8bbwe",
            //                "new",
            //                new[] { "etwlogger.dll", "wptd.exe" });


   //         Execute(@"move d:\wpsystem\apps d:\wpsystem\appss");
   //         Execute(@"del D:\wpsystem\appss\WindowsApps\Microsoft.WPDiet_2.0.15086.130_arm__8wekyb3d8bbwe\etwlogger.dll");
   //         Execute(@"move d:\wpsystem\appss d:\wpsystem\Apps");
   //       //  Execute(@"del D:\wpsystem\appss\WindowsApps\Microsoft.WPDiet_2.0.15086.130_arm__8wekyb3d8bbwe\wpdiet.exe");
   //  //       Execute(@"del D:\wpsystem\appss\WindowsApps\68944423-66aa-41f2-ba9f-a95aa4b58f5a_1.0.0.6_arm__cxkkyw345tmjc\etwlogger.winmd");
   //  //       Execute(@"del D:\wpsystem\appss\WindowsApps\68944423-66aa-41f2-ba9f-a95aa4b58f5a_1.0.0.6_arm__cxkkyw345tmjc\etwlogger.dll");
      
   //   //     Execute(@"del D:\wpsystem\appss\WindowsApps\Microsoft.WPDiet_2.0.15086.130_arm__8wekyb3d8bbwe\etwlogger.winmd");
            
            
   //       var apps = await folder.GetFolderAsync("apps");
           
   //         var winapps = await apps.GetFolderAsync("WindowsApps");
   //         var appnames = new List<string>();
   //         foreach (StorageFolder folder2 in await winapps.GetFoldersAsync())
   //         {
   //             appnames.Add(folder2.Name);
   //         }
   //         var appFolder =
   //             await winapps.GetFolderAsync("Microsoft.WPDiet_2.0.15086.130_arm__8wekyb3d8bbwe"
   //         /*"68944423-66aa-41f2-ba9f-a95aa4b58f5a_1.0.0.6_arm__cxkkyw345tmjc"*/);
   //         var dll = await Package.Current.InstalledLocation.GetFileAsync(@"new\etwlogger.dll");
   //         var wptd = await Package.Current.InstalledLocation.GetFileAsync(@"wptd.exe");
   //   //     var winmd = await Package.Current.InstalledLocation.GetFileAsync(@"existing\etwlogger.winmd");
   //         await wptd.CopyAsync(appFolder);
   //         await dll.CopyAsync(appFolder);
   //    //   await winmd.CopyAsync(appFolder);
   ////         var exe = await Package.Current.InstalledLocation.GetFileAsync(@"existing\wpdiet.exe");
   //  //       await exe.CopyAsync(appFolder);
        }
 /// <summary>
 /// Handle the returned folder from folder picker
 /// This method is triggered by ContinuationManager based on ActivationKind
 /// </summary>
 /// <param name="args">Folder picker continuation activation argment. It cantains the folder user selected with folder picker </param>
 public void ContinueFolderPicker(FolderPickerContinuationEventArgs args)
 {
     StorageFolder folder = args.Folder;
     if (folder != null)
     {
         // Application now has read/write access to all contents in the picked folder (including other sub-folder contents)
         StorageApplicationPermissions.FutureAccessList.AddOrReplace("PickedFolderToken", folder);
         OutputTextBlock.Text = "Picked folder: " + folder.Name;
     }
     else
     {
         OutputTextBlock.Text = "Operation cancelled.";
     }
 }
        /// <summary>
        /// Handle the returned folder from folder picker
        /// This method is triggered by ContinuationManager based on ActivationKind
        /// </summary>
        /// <param name="args">Folder picker continuation activation argment. It cantains the folder user selected with folder picker </param>
        public void ContinueFolderPicker(FolderPickerContinuationEventArgs args)
        {
            StorageFolder folder = args.Folder;

            if (folder != null)
            {
                // Application now has read/write access to all contents in the picked folder (including other sub-folder contents)
                StorageApplicationPermissions.FutureAccessList.AddOrReplace("PickedFolderToken", folder);
                OutputTextBlock.Text = "Picked folder: " + folder.Name;
            }
            else
            {
                OutputTextBlock.Text = "Operation cancelled.";
            }
        }
Ejemplo n.º 5
0
        public async void ContinueFolderPicker(FolderPickerContinuationEventArgs args)
        {
            var folder = args.Folder;

            if (folder != null)
            {
                //중복된 폴더는 추가하지 않음
                if (!ExplorerFolderSource.Any(x => x.Path == folder.Path))
                {
                    //전체 비디오에 반영
                    await ThreadPool.RunAsync(async handler =>
                    {
                        var folderInfo = new FolderInfo(folder)
                        {
                            Level = 1,
                            Type  = FolderType.Root,
                            ButtonTappedCommand1 = LockFolderCommand,
                            ButtonTappedCommand2 = RemoveFolderCommand,
                            Passcode             = string.Empty
                        };

                        //선택한 폴더 DB등록
                        folderDAO.Insert(folderInfo);

                        await DispatcherHelper.RunAsync(() =>
                        {
                            //Add Folder 바로 앞에 추가
                            var addFolder         = ExplorerFolderSource.FirstOrDefault(x => x.Type == FolderType.Picker);
                            addFolder.IsHighlight = false;
                            var index             = ExplorerFolderSource.IndexOf(addFolder);
                            ExplorerFolderSource.Insert(index, folderInfo);

                            //전체 비디오에 반영
                            MessengerInstance.Send <Message>(new Message("FolderAdded", folderInfo), AllVideoViewModel.NAME);
                        });
                    });
                }
            }
            else
            {
                //간간히 화면에 렌더링이 안되는 경우가 생김. 전체 새로 고침을 통해서 다시 렌더링.
                LoadRootFolders();
            }
        }
Ejemplo n.º 6
0
        public static void ContinueFolderOpenPicker(FolderPickerContinuationEventArgs args, FolderViewModel folderViewModel)
        {
            if ((args.ContinuationData["Operation"] as string) != "SelectDownloadFolder" || args.Folder == null)
            {
                ResetFolderPicker();
                return;
            }

            if (!App.CloudDrive.IsUserOnline())
            {
                return;
            }

            if (args.ContinuationData["NodeData"] != null)
            {
                String        base64Handle = (String)args.ContinuationData["NodeData"];
                NodeViewModel node;
                if (App.LinkInformation.PublicNode != null && base64Handle.Equals(App.LinkInformation.PublicNode.getBase64Handle()))
                {
                    node = NodeService.CreateNew(App.MegaSdk, App.AppInformation, App.LinkInformation.PublicNode, ContainerType.PublicLink);
                    App.LinkInformation.Reset();
                }
                else
                {
                    node = NodeService.CreateNew(folderViewModel.MegaSdk, App.AppInformation,
                                                 folderViewModel.MegaSdk.getNodeByBase64Handle(base64Handle), folderViewModel.Type);
                }

                if (node != null)
                {
                    App.AppInformation.PickerOrAsyncDialogIsOpen = false;
                    node.Download(App.MegaTransfers, args.Folder.Path);
                }

                ResetFolderPicker();
                return;
            }

            App.AppInformation.PickerOrAsyncDialogIsOpen = false;

            folderViewModel.MultipleDownload(args.Folder.Path);

            ResetFolderPicker();
        }
Ejemplo n.º 7
0
        public async void ContinueFolderPicking(FolderPickerContinuationEventArgs args)
        {
            Generic.ContinuationManager.PickFolderContinuableCurrent = null;
            var folder = args.Folder;

            if (folder == null)
            {
                return;
            }

            vm.RightPanel.CurrentDrive = new WPDrive(args.Folder);

            if (vm.CurrentActivePanel == 0)
            {
                await vm.ChangeLeftDir();
            }
            else if (vm.CurrentActivePanel == 1)
            {
                await vm.ChangeRightDir();
            }
        }
Ejemplo n.º 8
0
        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);
                    }
                }
            }
        }
        public static async Task <bool> ImportMaFile(FolderPickerContinuationEventArgs args)
        {
            LoadFileResult res = await LoadFile(args.Folder);

            var msg = "";

            switch (res.ResultStatus)
            {
            case ELoadFileResult.Success:
                msg = string.Format(
                    StringResourceLoader.GetString("AddAccount_Success"),
                    res.Loaded
                    );
                break;

            case ELoadFileResult.PasswordIncorrect:
                msg = StringResourceLoader.GetString("AddAccount_ErrorPassword");
                break;
            }
            await new MessageDialog(msg).ShowAsync();

            return(res.ResultStatus == ELoadFileResult.Success);
        }
Ejemplo n.º 10
0
        public async void ContinueFolderPicking(FolderPickerContinuationEventArgs args)
        {
            Generic.ContinuationManager.PickFolderContinuableCurrent = null;
            var folder = args.Folder;
            if (folder == null)
                return;

            vm.RightPanel.CurrentDrive = new WPDrive(args.Folder);

            if(vm.CurrentActivePanel == 0)
                await vm.ChangeLeftDir();
            else if(vm.CurrentActivePanel == 1)
                await vm.ChangeRightDir();
        }
Ejemplo n.º 11
0
        internal void WinPhonePickedFolder(FolderPickerContinuationEventArgs args)
        {
            var folder = args.Folder;

            DisplayFolderInfo(folder);
        }
Ejemplo n.º 12
0
        public async void ContinueFolderPicker(FolderPickerContinuationEventArgs pArgs)
        {
            
            var folder = pArgs.Folder;
           
            if (folder.Path.ToLower() != @"d:\wpsystem")
                return;
            Windows.Storage.AccessCache.StorageApplicationPermissions.FutureAccessList.AddOrReplace(
               "WPSYSTEM", folder);
           
            var cont = DataContext as HostAppsView;
            cont.AppsStorageFolder = await folder.GetFolderAsync("apps");
            MainPage.Current.Frame.Navigate(typeof (ChooseDestination));
            MainPage.Current.Frame.DataContext = cont;
            //var message = await cont.CopyFiles(folder);

            //if (message == null)
            //{
            //    MainPage.Current.Frame.Navigate(typeof (DoneScreen));
            //    MainPage.Current.Frame.BackStack.Clear();
            //    MainPage.Current.Frame.DataContext = cont;
            //}
            //else
            //{
            //    Message.Text = message;
            //}

        }
Ejemplo n.º 13
0
        public void ContinueFolderPicker(FolderPickerContinuationEventArgs args)
        {
            StorageFolder folder = args.Folder;

            dfuSettingViewModel.SaveFolder(folder);
        }
Ejemplo n.º 14
0
 public void ContinueFolderPicker(FolderPickerContinuationEventArgs args)
 {
     StorageApplicationPermissions.FutureAccessList.Add(args.Folder);
 }
		public void ContinueFolderPicker(FolderPickerContinuationEventArgs args)
		{
			StorageFolder folder = args.Folder;
			dfuSettingViewModel.SaveFolder(folder);
		}
 internal void WinPhonePickedFolder(FolderPickerContinuationEventArgs args)
 {
     var folder = args.Folder;
     DisplayFolderInfo(folder);
 }