diff --git a/source/UpbeatUI/ViewModel/IOpensUpbeatViewModels.cs b/source/UpbeatUI/ViewModel/IOpensUpbeatViewModels.cs deleted file mode 100644 index 4e7a596..0000000 --- a/source/UpbeatUI/ViewModel/IOpensUpbeatViewModels.cs +++ /dev/null @@ -1,17 +0,0 @@ -/* This file is part of the UpbeatUI project, which is released under MIT License. - * See LICENSE.md or visit: - * https://github.com/michaelpduda/upbeatui/blob/master/LICENSE.md - */ -using System; -using System.Threading.Tasks; - -namespace UpbeatUI.ViewModel -{ - /// - /// Provides mechanisms for adding ViewModels to an . - /// - [Obsolete("This interface has been renamed to IOpensViewModels and will be removed in UpbeatUI V3.0.")] - public interface IOpensUpbeatViewModels : IOpensViewModels - - { } -} diff --git a/source/UpbeatUI/ViewModel/IOpensViewModels.cs b/source/UpbeatUI/ViewModel/IOpensViewModels.cs index 848c669..f53ec8a 100644 --- a/source/UpbeatUI/ViewModel/IOpensViewModels.cs +++ b/source/UpbeatUI/ViewModel/IOpensViewModels.cs @@ -13,32 +13,6 @@ namespace UpbeatUI.ViewModel public interface IOpensViewModels { - /// - /// Adds a new ViewModel to the based on the provided. - /// - /// The type of the parameters used to create the ViewModel. - /// The parameters used to create the ViewModel. - [Obsolete("Renamed to OpenViewModelAsync. This method will be removed in UpbeatUI 3.0.")] - void OpenUpbeatViewModel(TParameters parameters); - - /// - /// Adds a new ViewModel to the based on the provided and executes a callback after that ViewModel closes. - /// - /// The type of the parameters used to create the ViewModel. - /// The parameters used to create the ViewModel. - /// A delegate for the to execute after the ViewModel closes. - [Obsolete("Renamed to OpenViewModelAsync. This method will be removed in UpbeatUI 3.0.")] - void OpenUpbeatViewModel(TParameters parameters, Action closedCallback); - - /// - /// Adds a new ViewModel to the based on the provided and returns a that completes after the ViewModel closes. - /// - /// The type of the parameters used to create the ViewModel. - /// The parameters used to create the ViewModel. - /// A that represents the created ViewModel being open - [Obsolete("Renamed to OpenViewModelAsync. This method will be removed in UpbeatUI 3.0.")] - Task OpenUpbeatViewModelAsync(TParameters parameters); - /// /// Adds a new ViewModel to the based on the provided. /// diff --git a/source/UpbeatUI/ViewModel/IUpbeatService.cs b/source/UpbeatUI/ViewModel/IUpbeatService.cs index 74b3750..3f66e35 100644 --- a/source/UpbeatUI/ViewModel/IUpbeatService.cs +++ b/source/UpbeatUI/ViewModel/IUpbeatService.cs @@ -11,13 +11,11 @@ namespace UpbeatUI.ViewModel /// /// Provides methods for a ViewModel to interact with the that it is a part of. instancess are created by the unique to each ViewModel, so do not share them. /// - public interface IUpbeatService : IOpensViewModels, IOpensUpbeatViewModels + public interface IUpbeatService : IOpensViewModels { /// /// Gets whether or not the ViewModel is the top item in the , and thus active for the user. /// - [Obsolete("Renamed to IsActiveViewModel. This property will be removed in UpbeatUI 3.0.")] - bool IsActiveUpbeatViewModel { get; } bool IsActiveViewModel { get; } /// /// Gets whether or not the parent is configured to update ViewModels on each rendering event. @@ -29,20 +27,6 @@ public interface IUpbeatService : IOpensViewModels, IOpensUpbeatViewModels /// void Close(); - /// - /// Gets the current string contents of the clipboard. This is a convenience method for assemblies that do not want to reference . - /// - /// The current contents of the clipboard. - [Obsolete("This will be removed in UpbeatUI 3.0. Use another injected service instead.")] - string GetClipboard(); - - /// - /// Sets the string contents of the clipboard. This is a convenience method for assemblies that do not want to reference . - /// - /// What to set the clipboard to. - [Obsolete("This will be removed in UpbeatUI 3.0. Use another injected service instead.")] - void SetClipboard(string text); - /// /// Sets the delegate that the containing will call before closing this ViewModel (instead of closing it automatically). The delegate should return true if okay to close and false if the ViewModel needs to stay open. /// diff --git a/source/UpbeatUI/ViewModel/IUpbeatViewModel.cs b/source/UpbeatUI/ViewModel/IUpbeatViewModel.cs deleted file mode 100644 index 5f7fec5..0000000 --- a/source/UpbeatUI/ViewModel/IUpbeatViewModel.cs +++ /dev/null @@ -1,23 +0,0 @@ -/* This file is part of the UpbeatUI project, which is released under MIT License. - * See LICENSE.md or visit: - * https://github.com/michaelpduda/upbeatui/blob/master/LICENSE.md - */ -using System; -using System.ComponentModel; - -namespace UpbeatUI.ViewModel -{ - /// - /// Defines functionality for a class that can be placed on an . - /// - [Obsolete("The SignalToClose method is being replaced with the IUpbeatService.SetCloseCallback method. The UpbeatStack will no longer require the IUpbeatViewModel interface and will automatically handle IDisposables. This IUpbeatViewModel interface will be removed in UpbeatUI 3.0.")] - public interface IUpbeatViewModel : IDisposable, INotifyPropertyChanged - { - /// - /// Signals to the that the user or another object would like it to close. - /// - /// A delegate that the can call when it is ready to close. - [Obsolete("The SignalToClose method is being replaced with the IUpbeatService.SetCloseCallback method. This base UpbeatViewModel class will be removed in UpbeatUI 3.0.")] - void SignalToClose(Action closeCallback); - } -} diff --git a/source/UpbeatUI/ViewModel/IUpdatableViewModel.cs b/source/UpbeatUI/ViewModel/IUpdatableViewModel.cs deleted file mode 100644 index 58ca7a4..0000000 --- a/source/UpbeatUI/ViewModel/IUpdatableViewModel.cs +++ /dev/null @@ -1,21 +0,0 @@ -/* This file is part of the UpbeatUI project, which is released under MIT License. - * See LICENSE.md or visit: - * https://github.com/michaelpduda/upbeatui/blob/master/LICENSE.md - */ -using System; - -namespace UpbeatUI.ViewModel -{ - /// - /// Defines functionality for ViewModels that need to be updated for each frame render. - /// - [Obsolete("The IUpbeatService.SetUpdateCallback is the preffered mechanism for configuring a ViewModel to update on each frame render, and this interface will be removed in UpbeatUI 3.0")] - public interface IUpdatableViewModel - { - /// - /// Signals that a new frame is being rendered so that the ViewModel can update its properties. - /// - [Obsolete("The IUpbeatService.SetUpdateCallback is the preffered mechanism for configuring a ViewModel to update on each frame render, and this interface will be removed in UpbeatUI 3.0")] - void UpdateViewModelProperties(); - } -} diff --git a/source/UpbeatUI/ViewModel/UpbeatStack.UpbeatService.cs b/source/UpbeatUI/ViewModel/UpbeatStack.UpbeatService.cs index 350543d..4ff14fe 100644 --- a/source/UpbeatUI/ViewModel/UpbeatStack.UpbeatService.cs +++ b/source/UpbeatUI/ViewModel/UpbeatStack.UpbeatService.cs @@ -4,7 +4,6 @@ */ using System; using System.Threading.Tasks; -using System.Windows; namespace UpbeatUI.ViewModel { @@ -26,8 +25,6 @@ internal UpbeatService(bool updatesOnRender, Action childViewMod ClosedCallback = closedCallback; } - [Obsolete("Renamed to IsActiveViewModel. This property will be removed in UpbeatUI 3.0.")] - public bool IsActiveUpbeatViewModel => IsActiveViewModel; public bool IsActiveViewModel => _isActiveViewModel(); public bool UpdatesOnRender { get; } internal Action ClosedCallback { get; } @@ -40,22 +37,6 @@ public void Close() _deferrer(() => _closer()); } - [Obsolete("This will be removed in UpbeatUI 3.0. Use another injected service instead.")] - public string GetClipboard() => - Clipboard.GetText(); - - [Obsolete("Renamed to OpenViewModel. This method will be removed in UpbeatUI 3.0.")] - public void OpenUpbeatViewModel(TParameters parameters) => - OpenViewModel(parameters); - - [Obsolete("Renamed to OpenViewModel. This method will be removed in UpbeatUI 3.0.")] - public void OpenUpbeatViewModel(TParameters parameters, Action closedCallback) => - OpenViewModel(parameters, closedCallback); - - [Obsolete("Renamed to OpenViewModelAsync. This method will be removed in UpbeatUI 3.0.")] - public Task OpenUpbeatViewModelAsync(TParameters parameters) => - OpenViewModelAsync(parameters); - public void OpenViewModel(TParameters parameters) => OpenViewModel(parameters, null); @@ -76,10 +57,6 @@ public Task OpenViewModelAsync(TParameters parameters) return taskCompletionSource.Task; } - [Obsolete("This will be removed in UpbeatUI 3.0. Use another injected service instead.")] - public void SetClipboard(string text) => - Clipboard.SetText(text); - public void SetCloseCallback(Func okToCloseCallback) => _asyncOkToCloseCallback = () => Task.FromResult(okToCloseCallback()); @@ -94,15 +71,6 @@ internal object Activate(Func viewModelCreator, Func isActiveViewModel(viewModel); _closer = () => closer(viewModel); - if (viewModel is IUpdatableViewModel updatableViewModel) - _updateCallback = updatableViewModel.UpdateViewModelProperties; - if (viewModel is IUpbeatViewModel upbeatViewModel) - _asyncOkToCloseCallback = () => - { - bool okToClose = false; - upbeatViewModel.SignalToClose(() => okToClose = true); - return Task.FromResult(okToClose); - }; return viewModel; } diff --git a/source/UpbeatUI/ViewModel/UpbeatStack.UpbeatServiceDeferrer.cs b/source/UpbeatUI/ViewModel/UpbeatStack.UpbeatServiceDeferrer.cs index 862c0b4..f49ce77 100644 --- a/source/UpbeatUI/ViewModel/UpbeatStack.UpbeatServiceDeferrer.cs +++ b/source/UpbeatUI/ViewModel/UpbeatStack.UpbeatServiceDeferrer.cs @@ -6,7 +6,7 @@ namespace UpbeatUI.ViewModel { - public partial class UpbeatStack : BaseViewModel, IDisposable, IUpdatableViewModel + public partial class UpbeatStack : BaseViewModel, IDisposable { private class UpbeatServiceDeferrer : ActionDeferrer { diff --git a/source/UpbeatUI/ViewModel/UpbeatStack.cs b/source/UpbeatUI/ViewModel/UpbeatStack.cs index b3aaac5..5eca5b9 100644 --- a/source/UpbeatUI/ViewModel/UpbeatStack.cs +++ b/source/UpbeatUI/ViewModel/UpbeatStack.cs @@ -17,7 +17,7 @@ namespace UpbeatUI.ViewModel /// /// Represents a stack of ViewModels and provides methods and commands for controlling them. /// - public partial class UpbeatStack : BaseViewModel, IOpensViewModels, IOpensUpbeatViewModels, IDisposable + public partial class UpbeatStack : BaseViewModel, IOpensViewModels, IDisposable { private delegate object ViewModelCreator(IUpbeatService upbeatService, object parameters); @@ -40,11 +40,6 @@ public UpbeatStack(bool updateOnRender = true) CompositionTarget.Rendering += UpdateViewModelProperties; } - /// - /// Gets the 's currently defined mappings between ViewModels and (Views). - /// - [Obsolete("Replaced by internal mechanisms. This property returns null and will be removed in UpbeatUI 3.0.")] - public IReadOnlyDictionary UpbeatViewModelControlMappings => ViewModelControlMappings; /// /// Gets the 's currently defined mappings between ViewModels and (Views). /// @@ -52,11 +47,6 @@ public UpbeatStack(bool updateOnRender = true) /// /// Gets the 's current ViewModels. /// - [Obsolete("Replaced by internal mechanisms. This property returns null and will be removed in UpbeatUI 3.0.")] - public INotifyCollectionChanged UpbeatViewModels => ViewModels; - /// - /// Gets the 's current ViewModels. - /// public INotifyCollectionChanged ViewModels { get; } /// /// Gets the count of the 's current ViewModels. @@ -65,24 +55,10 @@ public UpbeatStack(bool updateOnRender = true) /// /// Gets a command to remove the top (active) ViewModel. /// - [Obsolete("Renamed to RemoveTopViewModelCommand. This property will be removed in UpbeatUI 3.0.")] - public ICommand RemoveTopUpbeatViewModelCommand => RemoveTopViewModelCommand; - /// - /// Gets a command to remove the top (active) ViewModel. - /// public ICommand RemoveTopViewModelCommand { get; } /// /// Gets or sets an callback that the will execute when it is empty of ViewModels. /// - [Obsolete("Renamed to ViewModelsEmptyCallback. This property will be removed in UpbeatUI 3.0.")] - public Action UpbeatViewModelsEmptyCallback - { - get => ViewModelsEmptyCallback; - set => ViewModelsEmptyCallback = value; - } - /// - /// Gets or sets an callback that the will execute when it is empty of ViewModels. - /// public Action ViewModelsEmptyCallback { get; set; } public void Dispose() @@ -93,19 +69,6 @@ public void Dispose() upbeatViewModel.Dispose(); } - /// - /// Defines a mapping between the type, the Type and the Type. - /// - /// The type of the parameters used to create . - /// The type of the ViewModel created from a . - /// The Type of the . - /// The delegate that will executed to create the ViewModel from an and . - [Obsolete("Renamed to MapViewModel. This method will be removed in UpbeatUI 3.0.")] - public void MapUpbeatViewModel( - Func viewModelCreator) - where TView : UIElement => - MapViewModel(viewModelCreator); - /// /// Defines a mapping between the type, the Type and the Type. /// @@ -135,18 +98,6 @@ public void MapViewModel(IServiceProvider servic where TView : UIElement => MapViewModel(serviceProvider, typeof(TParameters), typeof(TViewModel), typeof(TView)); - [Obsolete("Renamed to OpenViewModelAsync. This method will be removed in UpbeatUI 3.0.")] - public void OpenUpbeatViewModel(TParameters parameters) => - OpenViewModel(parameters); - - [Obsolete("Renamed to OpenViewModelAsync. This method will be removed in UpbeatUI 3.0.")] - public void OpenUpbeatViewModel(TParameters parameters, Action closedCallback) => - OpenViewModel(parameters, closedCallback); - - [Obsolete("Renamed to OpenViewModelAsync. This method will be removed in UpbeatUI 3.0.")] - public Task OpenUpbeatViewModelAsync(TParameters parameters) => - OpenViewModelAsync(parameters); - public void OpenViewModel(TParameters parameters) => OpenViewModel(parameters, null); @@ -174,27 +125,6 @@ public Task OpenViewModelAsync(TParameters parameters) return taskCompletionSource.Task; } - /// - /// Closes and disposes all ViewModels from the . - /// - [Obsolete("Use TryCloseAllViewModelsAsync instead, which gives ViewModels a chance to cancel closing (e.g., to save unsaved work). This method will be removed in UpbeatUI 3.0.")] - public void RemoveAllUpbeatViewModels() - { - foreach (var viewModel in _openViewModels.Reverse()) - RemoveViewModel(viewModel); - } - - /// - /// Executes the method on each ViewModel that implements the interface. This is a convenience method that can easily be subscribed to the event, which fires for each frame render. - /// - /// The source of the event. - /// An object that contains no event data. - [Obsolete("The UpbeatStack will automatically execute UpdateViewModelProperties on each frame render unless it is constructed with 'updateOnRender' as false. This handler is now a noop and will be removed in UpbeatUI 3.0.")] - public void RenderingHandler(object sender, EventArgs e) - { - return; - } - /// /// Sets the to automatically map Parameters s to ViewModel s and View s using the default conventions. /// Parameters class names must follow the pattern of: "{BaseNamespace}.ViewModel.{Name}ViewModel+Parameters" (The Parameters class must be a public nested class of the ViewModel class). diff --git a/source/UpbeatUI/ViewModel/UpbeatViewModel.cs b/source/UpbeatUI/ViewModel/UpbeatViewModel.cs deleted file mode 100644 index 9c237a8..0000000 --- a/source/UpbeatUI/ViewModel/UpbeatViewModel.cs +++ /dev/null @@ -1,21 +0,0 @@ -/* This file is part of the UpbeatUI project, which is released under MIT License. - * See LICENSE.md or visit: - * https://github.com/michaelpduda/upbeatui/blob/master/LICENSE.md - */ -using System; - -namespace UpbeatUI.ViewModel -{ - /// - /// Provides a base class for s that will placed on a . - /// - [Obsolete("The SignalToClose method is being replaced with the IUpbeatService.SetCloseCallback method. The UpbeatStack will no longer require the IUpbeatViewModel interface and will automatically handle IDisposables. This base UpbeatViewModel class will be removed in UpbeatUI 3.0.")] - public abstract class UpbeatViewModel : BaseViewModel, IUpbeatViewModel - { - public virtual void Dispose() { } - - [Obsolete("The SignalToClose method is being replaced with the IUpbeatService.SetCloseCallback method. This base UpbeatViewModel class will be removed in UpbeatUI 3.0.")] - public virtual void SignalToClose(Action closeCallback) - => closeCallback(); - } -}