public WindowViewModel(IObjectProvider objectProvider, IWindowFactory windowFactory, ILogger logger, IWindowsController windowsController, RecentFilesViewModel recentFilesViewModel, GeneralOptionsViewModel generalOptionsViewModel, ISchedulerProvider schedulerProvider) { _logger = logger; _windowsController = windowsController; RecentFiles = recentFilesViewModel; GeneralOptions = generalOptionsViewModel; _schedulerProvider = schedulerProvider; _objectProvider = objectProvider; InterTabClient = new InterTabClient(windowFactory); OpenFileCommand = new Command(OpenFile); ShowInGitHubCommand = new Command(() => Process.Start("https://github.com/RolandPheasant")); ZoomOutCommand = new Command(() => { GeneralOptions.Scale = GeneralOptions.Scale + 5; }); ZoomInCommand = new Command(() => { GeneralOptions.Scale = GeneralOptions.Scale - 5; }); SaveLayoutCommand = new Command(WalkTheLayout); ExitCommmand = new Command(() => Application.Current.Shutdown()); Version = $"v{Assembly.GetEntryAssembly().GetName().Version.ToString(3)}"; var fileDropped = DropMonitor.Dropped.Subscribe(OpenFile); var isEmptyChecker = Views.ToObservableChangeSet() .ToCollection() .Select(items => items.Count) .StartWith(0) .Select(count => count == 0) .Subscribe(isEmpty => IsEmpty = isEmpty); var openRecent = recentFilesViewModel.OpenFileRequest .Subscribe(file => { MenuIsOpen = false; OpenFile(file); }); _cleanUp = new CompositeDisposable(recentFilesViewModel, isEmptyChecker, fileDropped, DropMonitor, openRecent, Disposable.Create(() => { Views.Select(vc => vc.Content) .OfType <IDisposable>() .ForEach(d => d.Dispose()); })); }
public WindowViewModel(IObjectProvider objectProvider, IWindowFactory windowFactory, ILogger logger, IWindowsController windowsController, RecentFilesViewModel recentFilesViewModel, GeneralOptionsViewModel generalOptionsViewModel, ISchedulerProvider schedulerProvider) { _logger = logger; _windowsController = windowsController; RecentFiles = recentFilesViewModel; GeneralOptions = generalOptionsViewModel; _schedulerProvider = schedulerProvider; _objectProvider = objectProvider; InterTabClient = new InterTabClient(windowFactory); OpenFileCommand = new Command(OpenFile); ShowInGitHubCommand = new Command(()=> Process.Start("https://github.com/RolandPheasant")); ZoomOutCommand= new Command(()=> { GeneralOptions.Scale = GeneralOptions.Scale + 5; }); ZoomInCommand = new Command(() => { GeneralOptions.Scale = GeneralOptions.Scale - 5; }); SaveLayoutCommand = new Command(WalkTheLayout); ExitCommmand = new Command(() => Application.Current.Shutdown()); Version = $"v{Assembly.GetEntryAssembly().GetName().Version.ToString(3)}"; var fileDropped = DropMonitor.Dropped.Subscribe(OpenFile); var isEmptyChecker = Views.ToObservableChangeSet() .ToCollection() .Select(items=>items.Count) .StartWith(0) .Select(count=>count==0) .Subscribe(isEmpty=> IsEmpty = isEmpty); var openRecent = recentFilesViewModel.OpenFileRequest .Subscribe(file => { MenuIsOpen = false; OpenFile(file); }); _cleanUp = new CompositeDisposable(recentFilesViewModel, isEmptyChecker, fileDropped, DropMonitor, openRecent, Disposable.Create(() => { Views.Select(vc => vc.Content) .OfType<IDisposable>() .ForEach(d=>d.Dispose()); })); }
public FileHeaderNamingJob(IWindowsController windowsController) { if (windowsController == null) throw new ArgumentNullException(nameof(windowsController)); _cleanUp = windowsController.Views .Connect(vc => vc.Header is FileHeader) .Transform(vc => (FileHeader) vc.Header) .ToCollection() .Subscribe(files => { var renamer = new FileNamer(files.Select(f => f.FullName)); files.Select(page => new { Item = page, Label = renamer.GetName(page.FullName) }) .ForEach(x => x.Item.DisplayName = x.Label); }); }
public FileHeaderNamingJob(IWindowsController windowsController) { if (windowsController == null) { throw new ArgumentNullException(nameof(windowsController)); } _cleanUp = windowsController.Views .Connect(vc => vc.Header is FileHeader) .Transform(vc => (FileHeader)vc.Header) .ToCollection() .Subscribe(files => { var renamer = new FileNamer(files.Select(f => f.FullName)); files.Select(page => new { Item = page, Label = renamer.GetName(page.FullName) }) .ForEach(x => x.Item.DisplayName = x.Label); }); }
public PropsWindowPresenter(PropsWindowView view, IWindowsController windowsController) : base(view) { _view = view; _windowsController = windowsController; }
public ResultsWindowsPresenter(ResultsWindowsView view, IWindowsController windowsController) : base(view) { _view = view; _windowsController = windowsController; }
public WindowViewModel(IObjectProvider objectProvider, IWindowFactory windowFactory, ILogger logger, IWindowsController windowsController, RecentFilesViewModel recentFilesViewModel, GeneralOptionsViewModel generalOptionsViewModel, ISchedulerProvider schedulerProvider, IApplicationStatePublisher applicationStatePublisher) { _logger = logger; _windowsController = windowsController; RecentFiles = recentFilesViewModel; GeneralOptions = generalOptionsViewModel; _schedulerProvider = schedulerProvider; _objectProvider = objectProvider; InterTabClient = new InterTabClient(windowFactory); OpenFileCommand = new Command(OpenFile); ShowInGitHubCommand = new Command(() => Process.Start("https://github.com/RolandPheasant")); ZoomOutCommand = new Command(() => { GeneralOptions.Scale = GeneralOptions.Scale + 5; }); ZoomInCommand = new Command(() => { GeneralOptions.Scale = GeneralOptions.Scale - 5; }); CollectMemoryCommand = new Command(() => { //Diagnostics [useful for memory testing] GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); }); ExitCommmand = new Command(() => { applicationStatePublisher.Publish(ApplicationState.ShuttingDown); Application.Current.Shutdown(); }); WindowExiting = () => { applicationStatePublisher.Publish(ApplicationState.ShuttingDown); }; Version = $"v{Assembly.GetEntryAssembly().GetName().Version.ToString(3)}"; var fileDropped = DropMonitor.Dropped.Subscribe(OpenFile); var isEmptyChecker = Views.ToObservableChangeSet() .ToCollection() .Select(items => items.Count) .StartWith(0) .Select(count => count == 0) .LogErrors(logger) .Subscribe(isEmpty => IsEmpty = isEmpty); var openRecent = recentFilesViewModel.OpenFileRequest .LogErrors(logger) .Subscribe(file => { MenuIsOpen = false; OpenFile(file); }); var selectedChange = this.WhenValueChanged(vm => vm.Selected) .Subscribe(selected => { var currentSelection = selected?.Content as ISelectedAware; Views.Where(hv => !hv.Equals(selected)) .Select(hv => hv.Content) .OfType <ISelectedAware>() .ForEach(selectedAware => selectedAware.IsSelected = false); if (currentSelection != null) { currentSelection.IsSelected = true; } }); _cleanUp = new CompositeDisposable(recentFilesViewModel, isEmptyChecker, fileDropped, DropMonitor, openRecent, selectedChange, Disposable.Create(() => { Views.Select(vc => vc.Content) .OfType <IDisposable>() .ForEach(d => d.Dispose()); })); }
public InputWindowPresenter(InputWindowView view, IWindowsController windowsController) : base(view) { _view = view; _windowsController = windowsController; }
public WindowViewModel(IObjectProvider objectProvider, IWindowFactory windowFactory, ILogger logger, IWindowsController windowsController, RecentFilesViewModel recentFilesViewModel, GeneralOptionsViewModel generalOptionsViewModel, ISchedulerProvider schedulerProvider, IApplicationStatePublisher applicationStatePublisher) { _logger = logger; _windowsController = windowsController; RecentFiles = recentFilesViewModel; GeneralOptions = generalOptionsViewModel; _schedulerProvider = schedulerProvider; _objectProvider = objectProvider; InterTabClient = new InterTabClient(windowFactory); OpenFileCommand = new Command(OpenFile); ShowInGitHubCommand = new Command(()=> Process.Start("https://github.com/RolandPheasant")); ZoomOutCommand= new Command(()=> { GeneralOptions.Scale = GeneralOptions.Scale + 5; }); ZoomInCommand = new Command(() => { GeneralOptions.Scale = GeneralOptions.Scale - 5; }); CollectMemoryCommand = new Command(() => { //Diagnostics [useful for memory testing] GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); }); ExitCommmand = new Command(() => { applicationStatePublisher.Publish(ApplicationState.ShuttingDown); Application.Current.Shutdown(); }); WindowExiting = () => { applicationStatePublisher.Publish(ApplicationState.ShuttingDown); }; Version = $"v{Assembly.GetEntryAssembly().GetName().Version.ToString(3)}"; var fileDropped = DropMonitor.Dropped.Subscribe(OpenFile); var isEmptyChecker = Views.ToObservableChangeSet() .ToCollection() .Select(items=>items.Count) .StartWith(0) .Select(count=>count==0) .LogErrors(logger) .Subscribe(isEmpty=> IsEmpty = isEmpty); var openRecent = recentFilesViewModel.OpenFileRequest .LogErrors(logger) .Subscribe(file => { MenuIsOpen = false; OpenFile(file); }); var selectedChange = this.WhenValueChanged(vm => vm.Selected) .Subscribe(selected => { var currentSelection = selected?.Content as ISelectedAware; Views.Where(hv=> !hv.Equals(selected)) .Select(hv => hv.Content) .OfType<ISelectedAware>() .ForEach(selectedAware => selectedAware.IsSelected = false); if (currentSelection != null) currentSelection.IsSelected = true; }); _cleanUp = new CompositeDisposable(recentFilesViewModel, isEmptyChecker, fileDropped, DropMonitor, openRecent, selectedChange, Disposable.Create(() => { Views.Select(vc => vc.Content) .OfType<IDisposable>() .ForEach(d=>d.Dispose()); })); }
public StatisticWindowPresenter(StatisticWindowView view, IWindowsController windowsController) : base(view) { _view = view; _windowsController = windowsController; }
public WindowViewModel(IObjectProvider objectProvider, IWindowFactory windowFactory, ILogger logger, IWindowsController windowsController, RecentFilesViewModel recentFilesViewModel, GeneralOptionsViewModel generalOptionsViewModel, ISchedulerProvider schedulerProvider, DialogViewModel dialogviewmodel, FileOpenViewModel fileopenviewmodel) { //This function handles the pinning //If the user decides to pin a tab the function will lock that tab and reorder the effected tabs Pinning = new ActionCommand(o => { var viewsarray = Views.ToList(); var pinnedone = Views.FirstOrDefault(c => c.Header.Equals(o)); var pinnedindex = Views.IndexOf(pinnedone); bool actualpinned = false; ViewContainer oldtab = null; if (o.GetType().IsEquivalentTo(typeof(FilesHeader))) { ((FilesHeader)pinnedone.Header).IsPinned = !((FilesHeader)pinnedone.Header).IsPinned; actualpinned = ((FilesHeader)pinnedone.Header).IsPinned; } else { ((FileHeader)pinnedone.Header).IsPinned = !((FileHeader)pinnedone.Header).IsPinned; actualpinned = ((FileHeader)pinnedone.Header).IsPinned; } if (actualpinned) { PinnedNumber += 1; PinnedNumber2 += 1; oldtab = Views[pinnedindex]; viewsarray.Remove(viewsarray[pinnedindex]); viewsarray.Insert(PinnedNumber, oldtab); } else { PinnedNumber -= 1; PinnedNumber2 -= 1; oldtab = Views[pinnedindex]; viewsarray.Remove(viewsarray[pinnedindex]); viewsarray.Insert(PinnedNumber2, oldtab); } Views = new ObservableCollection <ViewContainer>(viewsarray); OnPropertyChanged("Views"); OnPropertyChanged("PinnedNumber2"); }); _logger = logger; _windowsController = windowsController; RecentFiles = recentFilesViewModel; GeneralOptions = generalOptionsViewModel; Dialog = dialogviewmodel; _schedulerProvider = schedulerProvider; _objectProvider = objectProvider; InterTabClient = new InterTabClient(windowFactory); FileOpenDialogCommand = new Command(OpenFileDialog); FileOpen = new FileOpenViewModel(OpenFile); ShowInGitHubCommand = new Command(() => Process.Start("https://github.com/RolandPheasant")); Views.CollectionChanged += Views_CollectionChanged; ZoomOutCommand = new Command(() => { GeneralOptions.Scale = GeneralOptions.Scale + 5; }); ZoomInCommand = new Command(() => { GeneralOptions.Scale = GeneralOptions.Scale - 5; }); SaveLayoutCommand = new Command(WalkTheLayout); ExitCommmand = new Command(() => Application.Current.Shutdown()); Version = $"v{Assembly.GetEntryAssembly().GetName().Version.ToString(3)}"; var fileDropped = DropMonitor.Dropped.Subscribe(async t => await OpenFile(t)); var isEmptyChecker = Views.ToObservableChangeSet() .ToCollection() .Select(items => items.Count) .StartWith(0) .Select(count => count == 0) .Subscribe(isEmpty => IsEmpty = isEmpty); var openRecent = recentFilesViewModel.OpenFileRequest .Subscribe(file => { MenuIsOpen = false; OpenFile(file); }); _cleanUp = new CompositeDisposable(recentFilesViewModel, isEmptyChecker, fileDropped, DropMonitor, openRecent, Disposable.Create(() => { Views.Select(vc => vc.Content) .OfType <IDisposable>() .ForEach(d => d.Dispose()); })); }
public MainController(IWindowsController windowsController) { _windowsController = windowsController; Start(); }