/// <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( IBrowserViewModel treeBrowser, IBookmarksViewModel recentLocations, DropDownClosedResult resultCallback) { return(new DropDownViewModel(treeBrowser, recentLocations, resultCallback)); }
/// <summary> /// Create a dialog viewmodel object that can be used to manage a dialog /// that contains a browser naviagtion (directory picker) control. /// </summary> /// <param name="treeBrowser"></param> /// <param name="recentLocations"></param> /// <returns></returns> public static IDialogViewModel CreateDialogViewModel( IMessageBoxService msgBox, IBrowserViewModel treeBrowser = null, IBookmarkedLocationsViewModel recentLocations = null) { return(new DialogViewModel(msgBox, treeBrowser, recentLocations)); }
/// <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)); }
/// <summary> /// Class constructor /// </summary> public DropDownViewModel( IBrowserViewModel treeBrowser, IBookmarksViewModel recentLocations, DropDownClosedResult resultCallback) : base(treeBrowser, recentLocations) { ResultCallback = resultCallback; }
/// <summary> /// Class constructor /// </summary> public DropDownViewModel( IMessageBoxService msgBox, IBrowserViewModel treeBrowser, IBookmarkedLocationsViewModel recentLocations, DropDownClosedResult resultCallback) : base(msgBox, treeBrowser, recentLocations) { ResultCallback = resultCallback; }
void Bind(IBrowserViewModel model) { // Bind the controls this.bindingSource.DataSource = model; // can't bind toolbar this.toolStripLabelName.Text = this.Presenter.ViewModel.Name; // Ugh, ListView not bindable, do it manually this.PopulateListView(model.Files); model.Files.ListChanged += (Files_ListChanged); model.PropertyChanged += (s, e) => EnableDisableControls(model.BrowserState); }
public void LocalListFiles() { BrowserPresenter presenter = new BrowserPresenter("Local", new LocalBrowserModel(), null, new MockFileTransferPresenter()); IBrowserViewModel viewModel = presenter.ViewModel; // make mock dir String testDir = Path.Combine(Path.GetTempPath(), Path.GetTempFileName()); File.Delete(testDir); Directory.CreateDirectory(Path.Combine(testDir, "A")); Directory.CreateDirectory(Path.Combine(testDir, "B")); Directory.CreateDirectory(Path.Combine(testDir, "C")); File.WriteAllText(Path.Combine(testDir, "file1"), ""); File.WriteAllText(Path.Combine(testDir, "file2"), ""); File.WriteAllText(Path.Combine(testDir, "file3"), ""); File.WriteAllText(Path.Combine(testDir, "file4"), "1"); // change to mode dir presenter.ViewModel.PropertyChanged += (s, e) => { if (presenter.ViewModel.BrowserState == BrowserState.Ready) { lock (this) { Monitor.Pulse(this); } } }; presenter.LoadDirectory(new BrowserFileInfo(new DirectoryInfo(testDir))); lock (this) { Monitor.Wait(this, 1000); } foreach (BrowserFileInfo bfi in presenter.ViewModel.Files) { Log.InfoFormat("BFI: {0}", bfi); } Assert.IsNotNull(viewModel.Files); Assert.AreEqual(8, viewModel.Files.Count); Assert.AreEqual("..", viewModel.Files[0].Name); Assert.AreEqual(new DirectoryInfo(Path.GetTempPath()), new DirectoryInfo(viewModel.Files[0].Path)); Assert.AreEqual(FileType.ParentDirectory, viewModel.Files[0].Type); Assert.AreEqual("A", viewModel.Files[1].Name); Assert.AreEqual(FileType.Directory, viewModel.Files[1].Type); Assert.AreEqual(0, viewModel.Files[1].Size); Assert.AreEqual("file1", viewModel.Files[4].Name, "file1"); Assert.AreEqual(FileType.File, viewModel.Files[4].Type); Assert.AreEqual(0, viewModel.Files[4].Size); Assert.AreEqual(1, viewModel.Files[7].Size); }
/// <summary> /// Class constructor /// </summary> public DialogBaseViewModel(IBrowserViewModel treeBrowser = null, IBookmarksViewModel recentLocations = null) { if (treeBrowser == null) { TreeBrowser = new BrowserViewModel(); } else { TreeBrowser = treeBrowser; } ResetBookmarks(recentLocations); }
/// <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); }
/// <summary> /// Create a dialog viewmodel object that can be used to manage a dialog /// that contains a browser naviagtion (directory picker) control. /// </summary> /// <param name="treeBrowser"></param> /// <param name="recentLocations"></param> /// <returns></returns> public static IDialogViewModel CreateDialogViewModel( IBrowserViewModel treeBrowser = null, IBookmarksViewModel recentLocations = null) { return(new DialogViewModel(treeBrowser, recentLocations)); }
/// <summary> /// Class constructor /// </summary> public DialogViewModel(IMessageBoxService msgBox, IBrowserViewModel treeBrowser = null, IBookmarkedLocationsViewModel recentLocations = null) : base(msgBox, treeBrowser, recentLocations) { }
/// <summary> /// Class constructor /// </summary> public DialogViewModel(IBrowserViewModel treeBrowser = null, IBookmarksViewModel recentLocations = null) : base(treeBrowser, recentLocations) { }