Remove IFavorites

This commit is contained in:
Eric Harding committed 2017-11-29 10:16:11 -05:00
1 parent 83a7fb54aa
commit d5910673c3
7 files changed
+7 -92

No files matched your search

@@ -1,51 +0,0 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
namespace mbts.ui.shell
{
public interface IFavorites
{
void add_favorite(IShellWindow window);
void remove_favorite(IShellWindow window);
bool is_favorite(IShellWindow window);
}
[Export(typeof(IFavorites))]
public class FavoritesModel : IFavorites
{
private const string WORKSPACE_NAMESPACE = "shell_saved_windows";
[ImportingConstructor]
public FavoritesModel() {
FavoriteWindows = new ObservableCollection<string>();
}
public ObservableCollection<string> FavoriteWindows { get; set; }
public void add_favorite(IShellWindow window) {
throw new NotImplementedException();
}
public void remove_favorite(IShellWindow window) {
throw new NotImplementedException();
}
public bool is_favorite(IShellWindow window) {
throw new NotImplementedException();
}
public ICommand restore_favorite {
get {
return new DelegateCommand(name => {
throw new NotImplementedException();
});
}
}
}
}
@@ -30,7 +30,7 @@ namespace mbts.ui.shell
public MetaShellMenuModule(IViewLocator view, WorkspacesModel model, [Import("workspace")]string initial_workspace, IUndoActions undo, IBrowserWindowManager ibwm)
{
_viewfinder = view;
_viewmodel = new MetaShellMenuViewModel(model, null, undo as UndoModel, ibwm);
_viewmodel = new MetaShellMenuViewModel(model, undo as UndoModel, ibwm);
model.init(initial_workspace).ignore();
_bwm = ibwm;
}
@@ -13,12 +13,10 @@ namespace mbts.ui.shell
public class MetaShellMenuViewModel : ViewModelBaseWithValidation
{
private WorkspacesModel _work_model;
private FavoritesModel _fav_model;
private UndoModel _undo_model;
public MetaShellMenuViewModel(WorkspacesModel wmodel, FavoritesModel fmodel, UndoModel umodel, IBrowserWindowManager browser) {
public MetaShellMenuViewModel(WorkspacesModel wmodel, UndoModel umodel, IBrowserWindowManager browser) {
_work_model = wmodel;
_fav_model = fmodel;
_undo_model = umodel;
ShowWorkspaces = true;
ShowUndo = true;
@@ -60,12 +58,6 @@ namespace mbts.ui.shell
public ICommand manual_command { get; private set; }
public FavoritesModel Favorites { get; private set; }
#region Favorites
#endregion
public ObservableCollection<UndoModel.UndoItem> UndoItems { get { return _undo_model == null ? null : _undo_model.Items; } }
public bool ShowUndo { get; set; }
}
@@ -21,17 +21,15 @@ namespace mbts.ui.shell
IShellWindow _model;
UIElement _ui;
IWindowManager _wm;
IFavorites _favorites;
Dispatcher _dispatcher;
HwndContentHost _hwnd_host;
public ShellWindowVM(IShellWindow model, IWindowManager wm, IFavorites favorites, IShellThreadFactory threads, string host = "") {
public ShellWindowVM(IShellWindow model, IWindowManager wm, IShellThreadFactory threads, string host = "") {
Logger.assert(model != null);
_model = model;
_model.TitleChanged += () => RaisePropertyChanged("Title");
_model.IconChanged += () => { _icon = null; RaisePropertyChanged("Icon"); };
_wm = wm;
_favorites = favorites;
host_id = host;
ShellThreadFactory stf = (ShellThreadFactory)threads;
+2 -4
View File
@@ -28,7 +28,6 @@ namespace mbts.ui.shell
{
ObservableCollection<TabDocument> _documents;
Dictionary<string, FloatingWindow> _windows = new Dictionary<string, FloatingWindow>();
IFavorites _favorites;
IShellThreadFactory _threads;
Lazy<ISettingsCollector> _window_settings;
ISavedWindowFactory _window_factory;
@@ -37,10 +36,9 @@ namespace mbts.ui.shell
[ImportingConstructor]
public WindowManager(ObservableCollection<IShellWindow> windows,
IShellThreadFactory threads, IFavorites favorites, Lazy<ISettingsCollector> settings,
IShellThreadFactory threads, Lazy<ISettingsCollector> settings,
ISavedWindowFactory factory, IUndoActions undo, IBus bus) {
Windows = windows;
_favorites = favorites;
_threads = threads;
_window_settings = settings;
_window_factory = factory;
@@ -61,7 +59,7 @@ namespace mbts.ui.shell
if (!Application.Current.Dispatcher.CheckAccess()) {
return Application.Current.Dispatcher.Invoke(() => { return OnNewDocument(model); });
}
var viewmodel = new ShellWindowVM(model, this, _favorites, _threads);
var viewmodel = new ShellWindowVM(model, this, _threads);
var content = new TabDocument(this, viewmodel);
var state = model.start_position();
if (state != null) {
@@ -1,22 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using mbts.ui.shell;
namespace mbts.ui.tests
{
class TestFavorites : IFavorites
{
public void add_favorite(IShellWindow window) {
}
public void remove_favorite(IShellWindow window) {
}
public bool is_favorite(IShellWindow window) {
return true;
}
}
}
@@ -76,7 +76,7 @@ namespace mbts.ui.tests
// Make sure that an IShellWindow and ISlowWindow added to the Windows collection is eventually disposed
ObservableCollection<IShellWindow> windows = new ObservableCollection<IShellWindow>();
var thread_factory = new ShellThreadFactory();
IWindowManager wm = new WindowManager(windows, thread_factory, new TestFavorites(), new Lazy<ISettingsCollector>(() => new TestSettingsCollector()), new TestSavedWindowFactory(), new TestUndo(), new SingletonBus());
IWindowManager wm = new WindowManager(windows, thread_factory, new Lazy<ISettingsCollector>(() => new TestSettingsCollector()), new TestSavedWindowFactory(), new TestUndo(), new SingletonBus());
Assert.IsNotNull(Application.Current);
Assert.IsNotNull(Application.Current.Windows);
Assert.AreEqual(Application.Current.Windows.Count, 0);
@@ -102,7 +102,7 @@ namespace mbts.ui.tests
// Make sure that an IShellWindow and ISlowWindow added to the Windows collection is eventually disposed
ObservableCollection<IShellWindow> windows = new ObservableCollection<IShellWindow>();
var thread_factory = new ShellThreadFactory();
IWindowManager wm = new WindowManager(windows, thread_factory, new TestFavorites(), new Lazy<ISettingsCollector>(() => new TestSettingsCollector()), new TestSavedWindowFactory(), new TestUndo(), new SingletonBus());
IWindowManager wm = new WindowManager(windows, thread_factory, new Lazy<ISettingsCollector>(() => new TestSettingsCollector()), new TestSavedWindowFactory(), new TestUndo(), new SingletonBus());
Assert.AreEqual(Application.Current.Windows.Count, 0);
// an ISlowWindow gets its own thread