init
This commit is contained in:
49
Common/DTS.Common/Base/View/BaseView.cs
Normal file
49
Common/DTS.Common/Base/View/BaseView.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace DTS.Common.Base
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the base class for views that define the appearance of data in a UserControl control.
|
||||
/// </summary>
|
||||
///
|
||||
public class BaseView : UserControl, IBaseView
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the bound object data data has been changed (View is dirty).
|
||||
/// </summary>
|
||||
public bool IsDirty
|
||||
{
|
||||
get
|
||||
{
|
||||
if (DataContext != null)
|
||||
{
|
||||
if (DataContext is IBaseViewModel baseViewModel)
|
||||
{
|
||||
return baseViewModel.IsDirty;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a header info which uses by the TabControl to display the TabItem's header.
|
||||
/// </summary>
|
||||
public string HeaderInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
if (DataContext != null)
|
||||
{
|
||||
if (DataContext is IHeaderInfoProvider<string> headerInfoProvider)
|
||||
{
|
||||
return headerInfoProvider.HeaderInfo;
|
||||
}
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
41
Common/DTS.Common/Base/View/BaseWindow.cs
Normal file
41
Common/DTS.Common/Base/View/BaseWindow.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System.Windows;
|
||||
// ReSharper disable once CheckNamespace
|
||||
namespace DTS.Common.Base
|
||||
{
|
||||
public class BaseWindow : Window, IBaseWindow
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the bound object data data has been changed (View is dirty).
|
||||
/// </summary>
|
||||
public bool IsDirty
|
||||
{
|
||||
get
|
||||
{
|
||||
if (DataContext != null)
|
||||
{
|
||||
if (DataContext is IBaseWindowModel baseWindowModel)
|
||||
return baseWindowModel.IsDirty;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a header info which uses by the TabControl to display the TabItem's header.
|
||||
/// </summary>
|
||||
public string HeaderInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
if (DataContext != null)
|
||||
{
|
||||
if (DataContext is IHeaderInfoProvider<string> iHeaderInfoProvider)
|
||||
return iHeaderInfoProvider.HeaderInfo;
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user