Esempio n. 1
0
        /// <summary>
        /// Method configures a drop down element to show a
        /// folder picker dialog up on opening up.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        private IDropDownViewModel InitializeDropDownBrowser(string path)
        {
            // See Loaded event in FolderBrowserTreeView_Loaded method to understand initial load
            var treeBrowser = FolderBrowserFactory.CreateBrowserViewModel();

            if (string.IsNullOrEmpty(path) == false)
            {
                treeBrowser.InitialPath = path;
            }
            else
            {
                treeBrowser.InitialPath = this.NewSolutionLocation;
            }

            treeBrowser.SetSpecialFoldersVisibility(true);

            var dlgVM = FolderBrowserFactory.CreateDropDownViewModel(treeBrowser, BookmarkedLocations, this.DropDownClosedResult);

            dlgVM.UpdateInitialPath      = this.UpdateCurrentPath;
            dlgVM.UpdateInitialBookmarks = this.UpdateBookmarks;

            dlgVM.ButtonLabel = LocultApp.Local.Strings.STR_SELECT_A_FOLDER;

            return(dlgVM);
        }
Esempio n. 2
0
        /// <summary>
        /// Method configures a drop down element to show a
        /// folder picker dialog on opening up.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        private IDropDownViewModel InitializeDropDownBrowser(string path)
        {
            // See Loaded event in FolderBrowserTreeView_Loaded method to understand initial load
            var treeBrowser = FolderBrowserFactory.CreateBrowserViewModel();

            // Switch updates to view of by default to speed up load of view
            // Loading the view will kick-off the browsing via View.Loaded Event
            // and that in turn will switch on view updates ...
            treeBrowser.UpdateView = false;

            if (string.IsNullOrEmpty(path) == false)
            {
                treeBrowser.InitialPath = path;
            }
            else
            {
                treeBrowser.InitialPath = this.Path;
            }

            treeBrowser.SetSpecialFoldersVisibility(true);

            var dlgVM = FolderBrowserFactory.CreateDropDownViewModel(
                treeBrowser, BookmarkedLocations, this.DropDownClosedResult);

            dlgVM.UpdateInitialPath      = this.UpdateCurrentPath;
            dlgVM.UpdateInitialBookmarks = this.UpdateBookmarks;

            dlgVM.ButtonLabel = "Select a Folder";

            return(dlgVM);
        }
Esempio n. 3
0
        private void AddRecentFolder_Executed(object p)
        {
            string path;
            IListControllerViewModel vm;

            this.ResolveParameterList(p as List <object>, out path, out vm);

            if (vm == null)
            {
                return;
            }

            var browser = FolderBrowserFactory.CreateBrowserViewModel();

            path = (string.IsNullOrEmpty(path) == true ? PathFactory.SysDefault.Path : path);
            browser.InitialPath = path;

            var dlg = new FolderBrowser.Views.FolderBrowserDialog();

            var dlgViewModel = FolderBrowserFactory.CreateDialogViewModel(
                browser, vm.RecentFolders.CloneBookmark());

            dlg.DataContext = dlgViewModel;

            bool?bResult = dlg.ShowDialog();

            if (dlgViewModel.DialogCloseResult == true || bResult == true)
            {
                vm.CloneBookmarks(dlgViewModel.BookmarkedLocations, vm.RecentFolders);
                vm.AddRecentFolder(dlgViewModel.TreeBrowser.SelectedFolder, true);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Shows a sample progress dialog that was invoked via a bound viewmodel.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="progressIsFinite"></param>
        internal async Task <string> ShowContentDialogFromVM(
            object context
            , bool progressIsFinite
            )
        {
            // See Loaded event in FolderBrowserTreeView_Loaded method to understand initial load
            var treeBrowserVM = FolderBrowserFactory.CreateBrowserViewModel(_SpecialFolderVisibility
                                                                            , _InitialPath);

            // Switch updates to view of by default to speed up load of view
            // Loading the view will kick-off the browsing via View.Loaded Event
            // and that in turn will switch on view updates ...
            treeBrowserVM.UpdateView = false;

            var fsDlg = FolderBrowserFactory.CreateDialogViewModel(treeBrowserVM, BookmarkedLocations);

            var customDialog = CreateFolderBrowserDialog(new FolderBrowserContentDialogViewModel(fsDlg));

            var coord   = GetService <IContentDialogService>().Coordinator;
            var manager = GetService <IContentDialogService>().Manager;

            string returnPath = null;

            // Show a progress dialog to initialize the viewmodel - in case file system is slow...
            await coord.ShowMetroDialogAsync(context, customDialog).ContinueWith
            (
                (t) =>
            {
                if (t.Result == DialogIntResults.OK)
                {
                    returnPath = treeBrowserVM.SelectedFolder;
                }
            }
            );

            if (fsDlg.BookmarkedLocations != null)
            {
                this.BookmarkedLocations = fsDlg.BookmarkedLocations.CloneBookmark();
            }

            return(returnPath);
        }