Пример #1
0
 /// <summary>
 /// Create a dropdown viewmodel object that can be used to manage a dropdown view
 /// that contains a browser naviagtion (directory picker) control.
 /// </summary>
 /// <param name="treeBrowser"></param>
 /// <param name="recentLocations"></param>
 /// <param name="resultCallback"></param>
 /// <returns></returns>
 public static IDropDownViewModel CreateDropDownViewModel(
     IMessageBoxService msgBox,
     IBrowserViewModel treeBrowser,
     IBookmarkedLocationsViewModel recentLocations,
     DropDownClosedResult resultCallback)
 {
     return(new DropDownViewModel(msgBox, treeBrowser, recentLocations, resultCallback));
 }
Пример #2
0
 /// <summary>
 /// Class constructor
 /// </summary>
 public DropDownViewModel(
     IMessageBoxService msgBox,
     IBrowserViewModel treeBrowser,
     IBookmarkedLocationsViewModel recentLocations,
     DropDownClosedResult resultCallback)
     : base(msgBox, treeBrowser, recentLocations)
 {
     ResultCallback = resultCallback;
 }
 /// <summary>
 /// Method is invoked when drop element is closed.
 /// </summary>
 /// <param name="bookmarks"></param>
 /// <param name="selectedPath"></param>
 /// <param name="result"></param>
 private void DropDownClosedResult(IBookmarkedLocationsViewModel bookmarks,
                                   string selectedPath,
                                   FolderBrowser.Dialogs.Interfaces.Result result)
 {
     if (result == FolderBrowser.Dialogs.Interfaces.Result.OK)
     {
         this.BookmarkedLocations = bookmarks.Copy();
         this.BookmarkSelected    = selectedPath;
     }
 }
        /// <summary>
        /// Constructs a few initial entries for
        /// the recent folder collection that implements folder bookmarks.
        /// </summary>
        /// <returns></returns>
        private IBookmarkedLocationsViewModel ConstructBookmarks()
        {
            IBookmarkedLocationsViewModel ret = FolderBrowserFactory.CreateReceentLocationsViewModel();

            ret.AddFolder(@"C:\Windows");
            ret.AddFolder(@"C:\Temp");

            ret.SelectedItem = ret.DropDownItems[0];

            return(ret);
        }
Пример #5
0
        /// <summary>
        /// Class constructor
        /// </summary>
        /// <param name="initialPath"></param>
        /// <param name="bookmarks"></param>
        /// <param name="specialFolderVisibility"></param>
        public FolderBrowserControler(string initialPath
                                      , IBookmarkedLocationsViewModel bookmarks
                                      , bool specialFolderVisibility = true)
            : this()
        {
            _SpecialFolderVisibility = specialFolderVisibility;
            _InitialPath             = initialPath;

            if (bookmarks != null)
            {
                _FBB_Bookmarks = bookmarks.Copy();
            }
        }
Пример #6
0
        /// <summary>
        /// Method is invoked when drop element is closed.
        /// </summary>
        /// <param name="bookmarks"></param>
        /// <param name="selectedPath"></param>
        /// <param name="result"></param>
        private void DropDownClosedResult(IBookmarkedLocationsViewModel bookmarks,
                                          string selectedPath,
                                          FolderBrowser.Dialogs.Interfaces.Result result)
        {
            if (result == FolderBrowser.Dialogs.Interfaces.Result.OK)
            {
                this.BookmarkedLocations = bookmarks.Copy();
                this.NewSolutionLocation = selectedPath;

                var optGroup = GetService <ISettingsManager>().Options.GetOptionGroup("Options");

                EditBookmarksViewModel.SaveBookmarksToModel(BookmarkedLocations.DropDownItems, optGroup);
            }
        }
Пример #7
0
        /// <summary>
        /// Constructs a few initial entries for
        /// the recent folder collection that implements folder bookmarks.
        /// </summary>
        /// <returns></returns>
        private IBookmarkedLocationsViewModel ConstructBookmarks()
        {
            IBookmarkedLocationsViewModel ret = FolderBrowserFactory.CreateReceentLocationsViewModel();

            var optGroup = GetService <ISettingsManager>().Options.GetOptionGroup("Options");

            EditBookmarksViewModel.LoadBookMarkOptionsFromModel(GetService <ISettingsManager>().Options, ret);

            if (ret.DropDownItems.Count > 0)
            {
                ret.SelectedItem = ret.DropDownItems[0];
            }

            return(ret);
        }
Пример #8
0
        /// <summary>
        /// Class constructor
        /// </summary>
        public DialogBaseViewModel(IMessageBoxService msgBox,
                                   IBrowserViewModel treeBrowser = null,
                                   IBookmarkedLocationsViewModel recentLocations = null)
        {
            if (treeBrowser == null)
            {
                TreeBrowser = new BrowserViewModel(msgBox);
            }
            else
            {
                TreeBrowser = treeBrowser;
            }

            ResetBookmarks(recentLocations);
        }
        internal static void LoadBookMarkOptionsFromModel(IEngine options
                                                          , IBookmarkedLocationsViewModel ret)
        {
            var optGroup = options.GetOptionGroup("Options");
            var opt      = optGroup.GetOptionDefinition("BookmarkedFolders");

            foreach (var item in opt.List_GetListOfKeyValues())
            {
                string sValue = item.Value as string;

                if (sValue != null)
                {
                    ret.AddFolder(sValue);
                }
            }
        }
Пример #10
0
        /// <summary>
        /// Constructs a few initial entries for
        /// the recent folder collection that implements folder bookmarks.
        /// </summary>
        /// <returns></returns>
        private IBookmarkedLocationsViewModel ConstructBookmarks()
        {
            IBookmarkedLocationsViewModel ret = FolderBrowserFactory.CreateReceentLocationsViewModel();

            // Copy items from current bookmark collection into bookmark collection of folder browser
            foreach (var item in Bookmarks)
            {
                ret.AddFolder(item);
            }

            if (ret.DropDownItems.Count > 0)
            {
                ret.SelectedItem = ret.DropDownItems[0];
            }

            return(ret);
        }
        /// <summary>
        /// Method is invoked when drop element is closed.
        /// </summary>
        /// <param name="bookmarks"></param>
        /// <param name="selectedPath"></param>
        /// <param name="result"></param>
        private void DropDownClosedResult(IBookmarkedLocationsViewModel bookmarks,
                                          string selectedPath,
                                          FolderBrowser.Dialogs.Interfaces.Result result)
        {
            if (result == FolderBrowser.Dialogs.Interfaces.Result.OK)
            {
                if (bookmarks != null)
                {
                    this.BookmarkedLocations = bookmarks.Copy();
                }

                if (string.IsNullOrEmpty(selectedPath) == false)
                {
                    this.InitialPath = selectedPath;
                }
                else
                {
                    this.InitialPath = @"C:\\";
                }
            }
        }
Пример #12
0
 /// <summary>
 /// Default Class Constructor
 /// </summary>
 protected FolderBrowserControler()
 {
     _SpecialFolderVisibility = true;
     _InitialPath             = string.Empty;
     _FBB_Bookmarks           = null;
 }
Пример #13
0
 /// <summary>
 /// Class constructor
 /// </summary>
 public DialogViewModel(IMessageBoxService msgBox,
                        IBrowserViewModel treeBrowser = null,
                        IBookmarkedLocationsViewModel recentLocations = null)
     : base(msgBox, treeBrowser, recentLocations)
 {
 }