This commit is contained in:
2026-04-17 14:55:32 -04:00
commit bc3ac1d4c9
18017 changed files with 4371742 additions and 0 deletions

View File

@@ -0,0 +1 @@
12

View File

@@ -0,0 +1 @@
12

View File

@@ -0,0 +1,135 @@
using System;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using DTS.Common.Base;
using DTS.Common.Classes;
using DTS.Common.Events;
using DTS.Common.Interactivity;
using DTS.Common.Interface;
using Prism.Events;
using Prism.Regions;
using Unity;
namespace DTS.StatusAndProgressBar
{
public class StatusAndProgressBarViewModel : BaseViewModel<IStatusAndProgressBarViewModel>, IStatusAndProgressBarViewModel
{
public IBaseView View { get; set; }
public IBaseViewModel Parent { get; set; }
private IEventAggregator _eventAggregator { get; set; }
private IUnityContainer _unityContainer { get; set; }
public InteractionRequest<Notification> NotificationRequest { get; private set; }
public new InteractionRequest<Confirmation> ConfirmationRequest { get; private set; }
/// <summary>
/// Creates a new instance of the FilterViewModel.
/// </summary>
/// <param name="view">The StatusAndProgressBar View interface.</param>
/// <param name="regionManager">The logical placeholder defined within the application's UI (in the shell or within views) into which views are displayed.</param>
/// <param name="eventAggregator">The EventAggregator which allows different components to publish/subscribe to events without being coupled to each other.</param>
/// <param name="unityContainer">The Unity container.</param>
public StatusAndProgressBarViewModel(IStatusAndProgressBarView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)
: base(regionManager, eventAggregator, unityContainer)
{
View = view;
View.DataContext = this;
NotificationRequest = new InteractionRequest<Notification>();
ConfirmationRequest = new InteractionRequest<Confirmation>();
_eventAggregator = eventAggregator;
_unityContainer = unityContainer;
_searchButtonVisability = false;
_eventAggregator.GetEvent<StatusAndProgressBarEvent>().Subscribe(OnUpdate, ThreadOption.PublisherThread, true);
}
#region Properties
public string ProgressBarName { get; set; }
public new bool IsMenuIncluded { get; set; }
public new bool IsNavigationIncluded { get; set; }
public new bool IsBusy { get; set; }
public new bool IsDirty { get; }
public object ContextSearchRegion { get; set; }
private bool _searchButtonVisability = false;
public bool SearchButtonVisability { get => _searchButtonVisability; set { _searchButtonVisability = value; OnPropertyChanged("SearchButtonVisability"); } }
private Visibility _alertVisibility = Visibility.Hidden;
public Visibility AlertVisibility
{
get => _alertVisibility;
set => SetProperty(ref _alertVisibility, value, "AlertVisibility");
}
private string _aggregateStatusText = "---";
public string AggregateStatusText { get => _aggregateStatusText; set { _aggregateStatusText = value; OnPropertyChanged("AggregateStatusText"); } }
private Color _aggregateStatusColor = Colors.AliceBlue;
public Color AggregateStatusColor { get => _aggregateStatusColor; set { _aggregateStatusColor = value; OnPropertyChanged("AggregateStatusColor"); } }
private Visibility _progressBarVisibility = Visibility.Hidden;
public Visibility ProgressBarVisibility { get => _progressBarVisibility; set { _progressBarVisibility = value; OnPropertyChanged("ProgressBarVisibility"); } }
private int _progressBarValue;
public int ProgressBarValue { get => _progressBarValue; set { _progressBarValue = value; OnPropertyChanged("ProgressBarValue"); } }
public new event PropertyChangedEventHandler PropertyChanged;
///<summary>
///Occurs when a property value changes.
///</summary>
private new void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
#endregion Properties
#region Methods
public override void Initialize()
{
}
public override void Initialize(object parameter)
{
Parent = (IBaseViewModel)parameter;
_eventAggregator.GetEvent<ProgressBarEvent>().Subscribe(OnProgressBarEvent, ThreadOption.UIThread);
}
private void OnProgressBarEvent(ProgressBarEventArg arg)
{
if (arg.ProgressBarName != ProgressBarName) { return; }
AggregateStatusColor = arg.ProgressBarColor;
AggregateStatusText = arg.ProgressBarText;
ProgressBarVisibility = arg.ProgressBarVisibility;
if (!double.IsNaN(arg.ProgressBarPercentage))
{
ProgressBarValue = Convert.ToInt32(arg.ProgressBarPercentage);
}
}
public override void Activated()
{
}
public override void Cleanup()
{
}
private void OnUpdate(StatusAndProgressBarEventArgs args)
{
//Since there may be multiple instances of this control, don't do anything if
//the requester is not our parent because it's just a waste of time and resources
if (args.Requester != Parent) return;
AggregateStatusText = args.StatusText;
if (!string.IsNullOrWhiteSpace(args.ErrorText))
{
AggregateStatusText += " - " + args.ErrorText;
}
AggregateStatusColor = args.StatusColor;
ProgressBarVisibility = args.ProgressBarVisibility;
ProgressBarValue = (int)args.ProgressValue;
}
#endregion Methods
}
}

View File

@@ -0,0 +1,43 @@
<base:BaseView x:Class="DTS.StatusAndProgressBar.StatusAndProgressFooterView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:base="clr-namespace:DTS.Common.Base;assembly=DTS.Common"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" d:DesignWidth="800">
<base:BaseView.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Themes/CommonStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</base:BaseView.Resources>
<Grid HorizontalAlignment="Stretch" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>
<ProgressBar
Margin="0"
Grid.Column="0"
Height="3"
Background="White"
VerticalAlignment="Center"
HorizontalContentAlignment="Stretch"
Value="{Binding ProgressBarValue,FallbackValue=55}"
Visibility="{Binding ProgressBarVisiblity}"
/>
<TextBlock
FontFamily="Segoe UI"
FontSize="12"
Height="25"
Grid.Column="1"
Foreground="White"
Text="{Binding ProgressText, FallbackValue=Connecting}"
HorizontalAlignment="Center"
Margin="0"
Padding="5,0"
/>
</Grid>
</base:BaseView>

View File

@@ -0,0 +1,17 @@
using DTS.Common.Interface;
// ReSharper disable CheckNamespace
namespace DTS.StatusAndProgressBar
{
/// <summary>
/// Interaction logic for StatusAndProgressFooterView.xaml
/// </summary>
public partial class StatusAndProgressFooterView : IStatusAndProgressFooterView
{
public StatusAndProgressFooterView()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1F817D85-4EC6-4300-AB35-085765B97A9A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>StatusAndProgressBar</RootNamespace>
<AssemblyName>StatusAndProgressBar</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Xaml.Behaviors">
<HintPath>..\..\..\Common\DTS.Common\lib\PrismLibrary\Microsoft.Xaml.Behaviors.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Prism">
<HintPath>..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.dll</HintPath>
</Reference>
<Reference Include="Prism.Unity.Wpf">
<HintPath>..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.Unity.Wpf.dll</HintPath>
</Reference>
<Reference Include="Prism.Wpf">
<HintPath>..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.Wpf.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Xaml" />
<Reference Include="Unity.Abstractions">
<HintPath>..\..\..\Common\DTS.Common\lib\PrismLibrary\Unity.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Unity.Container">
<HintPath>..\..\..\Common\DTS.Common\lib\PrismLibrary\Unity.Container.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="StatusAndProgressBarModule.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ViewModel\StatusAndProgressFooterViewModel.cs" />
<Compile Include="ViewModel\StatusAndProgressBarViewModel.cs" />
<Compile Include="View\StatusAndProgressFooterView.xaml.cs">
<DependentUpon>StatusAndProgressFooterView.xaml</DependentUpon>
</Compile>
<Compile Include="View\StatusAndProgressBarView.xaml.cs">
<DependentUpon>StatusAndProgressBarView.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Common\DTS.Common.Utilities\DTS.Common.Utilities.csproj">
<Project>{03EACE47-EA59-44AC-B49D-956E4DC4D618}</Project>
<Name>DTS.Common.Utilities</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Common\DTS.Common\DTS.Common.csproj">
<Project>{114edc77-f3b5-4576-a91b-40818d503b55}</Project>
<Name>DTS.Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Page Include="View\StatusAndProgressFooterView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="View\StatusAndProgressBarView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,104 @@
using System;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows;
using DTS.Common.Base;
using DTS.Common.Events;
using DTS.Common.Interactivity;
using DTS.Common.Interface;
using Prism.Events;
using Prism.Regions;
using Unity;
namespace DTS.StatusAndProgressBar
{
public class StatusAndProgressFooterViewModel : BaseViewModel<IStatusAndProgressBarFooterViewModel>, IStatusAndProgressBarFooterViewModel
{
public IStatusAndProgressFooterView View { get; set; }
public IBaseViewModel Parent { get; set; }
private IEventAggregator _eventAggregator { get; set; }
private IUnityContainer _unityContainer { get; set; }
public InteractionRequest<Notification> NotificationRequest { get; private set; }
public new InteractionRequest<Confirmation> ConfirmationRequest { get; private set; }
/// <summary>
/// Creates a new instance of the FilterViewModel.
/// </summary>
/// <param name="view">The StatusAndProgressBar View interface.</param>
/// <param name="regionManager">The logical placeholder defined within the application's UI (in the shell or within views) into which views are displayed.</param>
/// <param name="eventAggregator">The EventAggregator which allows different components to publish/subscribe to events without being coupled to each other.</param>
/// <param name="unityContainer">The Unity container.</param>
public StatusAndProgressFooterViewModel(IStatusAndProgressFooterView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)
: base(regionManager, eventAggregator, unityContainer)
{
View = view;
View.DataContext = this;
NotificationRequest = new InteractionRequest<Notification>();
ConfirmationRequest = new InteractionRequest<Confirmation>();
_eventAggregator = eventAggregator;
_unityContainer = unityContainer;
_eventAggregator.GetEvent<ProgressBarEvent>().Subscribe(OnStatusAndProgressBarEvent);
}
#region Properties
public new bool IsMenuIncluded { get; set; }
public new bool IsNavigationIncluded { get; set; }
public new bool IsBusy { get; set; }
public new bool IsDirty { get; }
public new event PropertyChangedEventHandler PropertyChanged;
///<summary>
///Occurs when a property value changes.
///</summary>
private new void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public string ProgressText { get; set; }
public Visibility ProgressBarVisiblity { get; set; }
public int ProgressBarValue { get; set; }
#endregion Properties
#region Methods
private void SetProgressText(string value)
{
ProgressText = value;
OnPropertyChanged("ProgressText");
}
private void SetProgressBarVisibility(Visibility visibility)
{
ProgressBarVisiblity = visibility;
OnPropertyChanged("ProgressBarVisibility");
}
private void SetProgressBarValue(int value)
{
ProgressBarValue = value;
OnPropertyChanged("ProgressBarValue");
}
private void OnStatusAndProgressBarEvent(ProgressBarEventArg args)
{
if (args.ProgressBarName != "Footer") { return; }
if (args.SetPercentage)
{
SetProgressBarValue(Convert.ToInt32(args.ProgressBarPercentage));
}
if (args.SetText)
{
SetProgressText(args.ProgressBarText);
}
if (args.SetVisibility)
{
SetProgressBarVisibility(args.ProgressBarVisibility);
}
}
#endregion Methods
}
}

View File

@@ -0,0 +1,73 @@
<base:BaseView x:Class="DTS.StatusAndProgressBar.StatusAndProgressBarView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:base="clr-namespace:DTS.Common.Base;assembly=DTS.Common"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" d:DesignWidth="800">
<base:BaseView.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Themes/CommonStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</base:BaseView.Resources>
<Grid HorizontalAlignment="Stretch" >
<Grid.Background>
<SolidColorBrush Color="{Binding AggregateStatusColor, FallbackValue=Yellow}" />
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Rectangle
Fill="{DynamicResource Brush_StatusRibbonErrorBackgroundDark}"
Grid.Row="0" Grid.RowSpan="2"
Visibility="{Binding AlertVisibility, FallbackValue=Hidden}"
/>
<Grid
Background="{DynamicResource Brush_StatusRibbonErrorBackgroundLight}"
Grid.Row="0" Grid.RowSpan="2"
Visibility="{Binding AlertVisibility, FallbackValue=Hidden}">
<Grid.Style>
<Style TargetType="{x:Type Grid}">
<Style.Resources>
<Storyboard x:Key="flashAnimation" >
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="0.2" To="1" AutoReverse="True" Duration="0:0:0.3" RepeatBehavior="Forever" />
</Storyboard>
</Style.Resources>
<Style.Triggers>
<EventTrigger RoutedEvent="Window.Loaded">
<BeginStoryboard Name="flash" Storyboard="{StaticResource flashAnimation}" />
</EventTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
</Grid>
<ProgressBar
Margin="0"
Grid.Row="0"
Height="3"
Background="White"
VerticalAlignment="Bottom"
HorizontalContentAlignment="Stretch"
Visibility="{Binding ProgressBarVisibility}"
Value="{Binding ProgressBarValue,FallbackValue=55}"
/>
<TextBlock
FontFamily="Segoe UI"
FontSize="12"
Height="25"
Grid.Row="0"
Foreground="{Binding TextColor}"
Text="{Binding AggregateStatusText, FallbackValue=Connecting}"
HorizontalAlignment="Center"
Margin="0"
Padding="5,0"
x:Name="lblAggregateStatusText"
/>
</Grid>
</base:BaseView>

View File

@@ -0,0 +1,17 @@
using DTS.Common.Interface;
// ReSharper disable CheckNamespace
namespace DTS.StatusAndProgressBar
{
/// <summary>
/// Interaction logic for StatusAndProgressBarView.xaml
/// </summary>
public partial class StatusAndProgressBarView : IStatusAndProgressBarView
{
public StatusAndProgressBarView()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,161 @@
using System;
using System.ComponentModel.Composition;
using System.Windows.Media.Imaging;
using DTS.Common;
using DTS.Common.Interface;
using DTS.Common.Utilities.Logging;
using DTS.StatusAndProgressBar;
using Prism.Ioc;
using Prism.Modularity;
using StatusAndProgressBar;
using Unity;
// ReSharper disable UnusedParameter.Local
[assembly: StatusAndProgressBarPropertiesName()]
[assembly: StatusAndProgressBarPropertiesImage()]
namespace StatusAndProgressBar
{
[Export(typeof(IModule))]
[Module(ModuleName = "StatusAndProgressBarProperties")]
public class StatusAndProgressBarModule : IModule
{
/// <summary>
/// Injected unity container
/// </summary>
private readonly IUnityContainer _unityContainer;
/// <summary>
/// Initializes a new instance of the <see cref="StatusAndProgressBarModule"/> class.
/// </summary>
/// <param name="unityContainer">Obtained reference of the unity container by using dependency injection.</param>
public StatusAndProgressBarModule(IUnityContainer unityContainer)
{
_unityContainer = unityContainer;
}
public void Initialize()
{
try
{
// Register View & View-Model with Unity dependency injection container as a singleton.
_unityContainer.RegisterType<IStatusAndProgressBarView, StatusAndProgressBarView>();
_unityContainer.RegisterType<IStatusAndProgressBarViewModel, StatusAndProgressBarViewModel>();
_unityContainer.RegisterType<IStatusAndProgressFooterView, StatusAndProgressFooterView>();
_unityContainer.RegisterType<IStatusAndProgressBarFooterViewModel, StatusAndProgressFooterViewModel>();
}
catch (Exception ex)
{
APILogger.Log(ex.GetBaseException().ToString());
APILogger.Log(ex.InnerException);
APILogger.Log(ex.Message);
throw new Exception(ex.GetBaseException().ToString());
}
}
public void OnInitialized(IContainerProvider containerProvider)
{
}
public void RegisterTypes(IContainerRegistry containerRegistry)
{
Initialize();
}
}
/// <summary>
/// Attribute class contains assembly name
/// </summary>
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
public class StatusAndProgressBarPropertiesNameAttribute : TextAttribute
{
private readonly string _assemblyName;
public StatusAndProgressBarPropertiesNameAttribute() : this(null) { }
public StatusAndProgressBarPropertiesNameAttribute(string s)
{
_assemblyName = AssemblyNames.Filter.ToString();
}
public override string AssemblyName => _assemblyName;
public override Type GetAttributeType()
{
return typeof(TextAttribute);
}
public override string GetAssemblyName()
{
return AssemblyName;
}
}
/// <summary>
/// Attribute class contains assembly image and name - used on the Main screen to display available components
/// </summary>
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
public class StatusAndProgressBarPropertiesImageAttribute : ImageAttribute
{
private BitmapImage _img;
public StatusAndProgressBarPropertiesImageAttribute() : this(null) { }
public override BitmapImage AssemblyImage
{
get { _img = AssemblyInfo.GetImage(AssemblyNames.StatusAndProgressBar.ToString()); return _img; }
}
public StatusAndProgressBarPropertiesImageAttribute(string s)
{
_img = AssemblyInfo.GetImage(AssemblyNames.StatusAndProgressBar.ToString());
}
public override Type GetAttributeType()
{
return typeof(ImageAttribute);
}
public override BitmapImage GetAssemblyImage()
{
return AssemblyImage;
}
public override string GetAssemblyName()
{
return AssemblyName;
}
public override eAssemblyRegion GetAssemblyRegion()
{
return AssemblyRegion;
}
public override string GetAssemblyGroup()
{
return AssemblyGroup;
}
private string _name;
public override string AssemblyName
{
get { _name = AssemblyNames.StatusAndProgressBar.ToString(); return _name; }
}
private string _group;
public override string AssemblyGroup
{
get { _group = eAssemblyGroups.Viewer.ToString(); return _group; }
}
private eAssemblyRegion _region;
public override eAssemblyRegion AssemblyRegion
{
get { _region = eAssemblyRegion.StatusAndProgressBarRegion; return _region; }
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("StatusAndProgressBar")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("StatusAndProgressBar")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1f817d85-4ec6-4300-ab35-085765b97a9a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

Binary file not shown.

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("StatusAndProgressBar")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("StatusAndProgressBar")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1f817d85-4ec6-4300-ab35-085765b97a9a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,115 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1F817D85-4EC6-4300-AB35-085765B97A9A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>StatusAndProgressBar</RootNamespace>
<AssemblyName>StatusAndProgressBar</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Xaml.Behaviors">
<HintPath>..\..\..\Common\DTS.Common\lib\PrismLibrary\Microsoft.Xaml.Behaviors.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Prism">
<HintPath>..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.dll</HintPath>
</Reference>
<Reference Include="Prism.Unity.Wpf">
<HintPath>..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.Unity.Wpf.dll</HintPath>
</Reference>
<Reference Include="Prism.Wpf">
<HintPath>..\..\..\Common\DTS.Common\lib\PrismLibrary\Prism.Wpf.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Xaml" />
<Reference Include="Unity.Abstractions">
<HintPath>..\..\..\Common\DTS.Common\lib\PrismLibrary\Unity.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Unity.Container">
<HintPath>..\..\..\Common\DTS.Common\lib\PrismLibrary\Unity.Container.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="StatusAndProgressBarModule.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ViewModel\StatusAndProgressFooterViewModel.cs" />
<Compile Include="ViewModel\StatusAndProgressBarViewModel.cs" />
<Compile Include="View\StatusAndProgressFooterView.xaml.cs">
<DependentUpon>StatusAndProgressFooterView.xaml</DependentUpon>
</Compile>
<Compile Include="View\StatusAndProgressBarView.xaml.cs">
<DependentUpon>StatusAndProgressBarView.xaml</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Common\DTS.Common.Utilities\DTS.Common.Utilities.csproj">
<Project>{03EACE47-EA59-44AC-B49D-956E4DC4D618}</Project>
<Name>DTS.Common.Utilities</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\Common\DTS.Common\DTS.Common.csproj">
<Project>{114edc77-f3b5-4576-a91b-40818d503b55}</Project>
<Name>DTS.Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Page Include="View\StatusAndProgressFooterView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="View\StatusAndProgressBarView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,161 @@
using System;
using System.ComponentModel.Composition;
using System.Windows.Media.Imaging;
using DTS.Common;
using DTS.Common.Interface;
using DTS.Common.Utilities.Logging;
using DTS.StatusAndProgressBar;
using Prism.Ioc;
using Prism.Modularity;
using StatusAndProgressBar;
using Unity;
// ReSharper disable UnusedParameter.Local
[assembly: StatusAndProgressBarPropertiesName()]
[assembly: StatusAndProgressBarPropertiesImage()]
namespace StatusAndProgressBar
{
[Export(typeof(IModule))]
[Module(ModuleName = "StatusAndProgressBarProperties")]
public class StatusAndProgressBarModule : IModule
{
/// <summary>
/// Injected unity container
/// </summary>
private readonly IUnityContainer _unityContainer;
/// <summary>
/// Initializes a new instance of the <see cref="StatusAndProgressBarModule"/> class.
/// </summary>
/// <param name="unityContainer">Obtained reference of the unity container by using dependency injection.</param>
public StatusAndProgressBarModule(IUnityContainer unityContainer)
{
_unityContainer = unityContainer;
}
public void Initialize()
{
try
{
// Register View & View-Model with Unity dependency injection container as a singleton.
_unityContainer.RegisterType<IStatusAndProgressBarView, StatusAndProgressBarView>();
_unityContainer.RegisterType<IStatusAndProgressBarViewModel, StatusAndProgressBarViewModel>();
_unityContainer.RegisterType<IStatusAndProgressFooterView, StatusAndProgressFooterView>();
_unityContainer.RegisterType<IStatusAndProgressBarFooterViewModel, StatusAndProgressFooterViewModel>();
}
catch (Exception ex)
{
APILogger.Log(ex.GetBaseException().ToString());
APILogger.Log(ex.InnerException);
APILogger.Log(ex.Message);
throw new Exception(ex.GetBaseException().ToString());
}
}
public void OnInitialized(IContainerProvider containerProvider)
{
}
public void RegisterTypes(IContainerRegistry containerRegistry)
{
Initialize();
}
}
/// <summary>
/// Attribute class contains assembly name
/// </summary>
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
public class StatusAndProgressBarPropertiesNameAttribute : TextAttribute
{
private readonly string _assemblyName;
public StatusAndProgressBarPropertiesNameAttribute() : this(null) { }
public StatusAndProgressBarPropertiesNameAttribute(string s)
{
_assemblyName = AssemblyNames.Filter.ToString();
}
public override string AssemblyName => _assemblyName;
public override Type GetAttributeType()
{
return typeof(TextAttribute);
}
public override string GetAssemblyName()
{
return AssemblyName;
}
}
/// <summary>
/// Attribute class contains assembly image and name - used on the Main screen to display available components
/// </summary>
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
public class StatusAndProgressBarPropertiesImageAttribute : ImageAttribute
{
private BitmapImage _img;
public StatusAndProgressBarPropertiesImageAttribute() : this(null) { }
public override BitmapImage AssemblyImage
{
get { _img = AssemblyInfo.GetImage(AssemblyNames.StatusAndProgressBar.ToString()); return _img; }
}
public StatusAndProgressBarPropertiesImageAttribute(string s)
{
_img = AssemblyInfo.GetImage(AssemblyNames.StatusAndProgressBar.ToString());
}
public override Type GetAttributeType()
{
return typeof(ImageAttribute);
}
public override BitmapImage GetAssemblyImage()
{
return AssemblyImage;
}
public override string GetAssemblyName()
{
return AssemblyName;
}
public override eAssemblyRegion GetAssemblyRegion()
{
return AssemblyRegion;
}
public override string GetAssemblyGroup()
{
return AssemblyGroup;
}
private string _name;
public override string AssemblyName
{
get { _name = AssemblyNames.StatusAndProgressBar.ToString(); return _name; }
}
private string _group;
public override string AssemblyGroup
{
get { _group = eAssemblyGroups.Viewer.ToString(); return _group; }
}
private eAssemblyRegion _region;
public override eAssemblyRegion AssemblyRegion
{
get { _region = eAssemblyRegion.StatusAndProgressBarRegion; return _region; }
}
}
}

View File

@@ -0,0 +1,73 @@
<base:BaseView x:Class="DTS.StatusAndProgressBar.StatusAndProgressBarView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:base="clr-namespace:DTS.Common.Base;assembly=DTS.Common"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" d:DesignWidth="800">
<base:BaseView.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Themes/CommonStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</base:BaseView.Resources>
<Grid HorizontalAlignment="Stretch" >
<Grid.Background>
<SolidColorBrush Color="{Binding AggregateStatusColor, FallbackValue=Yellow}" />
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Rectangle
Fill="{DynamicResource Brush_StatusRibbonErrorBackgroundDark}"
Grid.Row="0" Grid.RowSpan="2"
Visibility="{Binding AlertVisibility, FallbackValue=Hidden}"
/>
<Grid
Background="{DynamicResource Brush_StatusRibbonErrorBackgroundLight}"
Grid.Row="0" Grid.RowSpan="2"
Visibility="{Binding AlertVisibility, FallbackValue=Hidden}">
<Grid.Style>
<Style TargetType="{x:Type Grid}">
<Style.Resources>
<Storyboard x:Key="flashAnimation" >
<DoubleAnimation Storyboard.TargetProperty="Opacity" From="0.2" To="1" AutoReverse="True" Duration="0:0:0.3" RepeatBehavior="Forever" />
</Storyboard>
</Style.Resources>
<Style.Triggers>
<EventTrigger RoutedEvent="Window.Loaded">
<BeginStoryboard Name="flash" Storyboard="{StaticResource flashAnimation}" />
</EventTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
</Grid>
<ProgressBar
Margin="0"
Grid.Row="0"
Height="3"
Background="White"
VerticalAlignment="Bottom"
HorizontalContentAlignment="Stretch"
Visibility="{Binding ProgressBarVisibility}"
Value="{Binding ProgressBarValue,FallbackValue=55}"
/>
<TextBlock
FontFamily="Segoe UI"
FontSize="12"
Height="25"
Grid.Row="0"
Foreground="{Binding TextColor}"
Text="{Binding AggregateStatusText, FallbackValue=Connecting}"
HorizontalAlignment="Center"
Margin="0"
Padding="5,0"
x:Name="lblAggregateStatusText"
/>
</Grid>
</base:BaseView>

View File

@@ -0,0 +1,17 @@
using DTS.Common.Interface;
// ReSharper disable CheckNamespace
namespace DTS.StatusAndProgressBar
{
/// <summary>
/// Interaction logic for StatusAndProgressBarView.xaml
/// </summary>
public partial class StatusAndProgressBarView : IStatusAndProgressBarView
{
public StatusAndProgressBarView()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,43 @@
<base:BaseView x:Class="DTS.StatusAndProgressBar.StatusAndProgressFooterView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:base="clr-namespace:DTS.Common.Base;assembly=DTS.Common"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" d:DesignWidth="800">
<base:BaseView.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Themes/CommonStyles.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</base:BaseView.Resources>
<Grid HorizontalAlignment="Stretch" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>
<ProgressBar
Margin="0"
Grid.Column="0"
Height="3"
Background="White"
VerticalAlignment="Center"
HorizontalContentAlignment="Stretch"
Value="{Binding ProgressBarValue,FallbackValue=55}"
Visibility="{Binding ProgressBarVisiblity}"
/>
<TextBlock
FontFamily="Segoe UI"
FontSize="12"
Height="25"
Grid.Column="1"
Foreground="White"
Text="{Binding ProgressText, FallbackValue=Connecting}"
HorizontalAlignment="Center"
Margin="0"
Padding="5,0"
/>
</Grid>
</base:BaseView>

View File

@@ -0,0 +1,17 @@
using DTS.Common.Interface;
// ReSharper disable CheckNamespace
namespace DTS.StatusAndProgressBar
{
/// <summary>
/// Interaction logic for StatusAndProgressFooterView.xaml
/// </summary>
public partial class StatusAndProgressFooterView : IStatusAndProgressFooterView
{
public StatusAndProgressFooterView()
{
InitializeComponent();
}
}
}

View File

@@ -0,0 +1,135 @@
using System;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using DTS.Common.Base;
using DTS.Common.Classes;
using DTS.Common.Events;
using DTS.Common.Interactivity;
using DTS.Common.Interface;
using Prism.Events;
using Prism.Regions;
using Unity;
namespace DTS.StatusAndProgressBar
{
public class StatusAndProgressBarViewModel : BaseViewModel<IStatusAndProgressBarViewModel>, IStatusAndProgressBarViewModel
{
public IBaseView View { get; set; }
public IBaseViewModel Parent { get; set; }
private IEventAggregator _eventAggregator { get; set; }
private IUnityContainer _unityContainer { get; set; }
public InteractionRequest<Notification> NotificationRequest { get; private set; }
public new InteractionRequest<Confirmation> ConfirmationRequest { get; private set; }
/// <summary>
/// Creates a new instance of the FilterViewModel.
/// </summary>
/// <param name="view">The StatusAndProgressBar View interface.</param>
/// <param name="regionManager">The logical placeholder defined within the application's UI (in the shell or within views) into which views are displayed.</param>
/// <param name="eventAggregator">The EventAggregator which allows different components to publish/subscribe to events without being coupled to each other.</param>
/// <param name="unityContainer">The Unity container.</param>
public StatusAndProgressBarViewModel(IStatusAndProgressBarView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)
: base(regionManager, eventAggregator, unityContainer)
{
View = view;
View.DataContext = this;
NotificationRequest = new InteractionRequest<Notification>();
ConfirmationRequest = new InteractionRequest<Confirmation>();
_eventAggregator = eventAggregator;
_unityContainer = unityContainer;
_searchButtonVisability = false;
_eventAggregator.GetEvent<StatusAndProgressBarEvent>().Subscribe(OnUpdate, ThreadOption.PublisherThread, true);
}
#region Properties
public string ProgressBarName { get; set; }
public new bool IsMenuIncluded { get; set; }
public new bool IsNavigationIncluded { get; set; }
public new bool IsBusy { get; set; }
public new bool IsDirty { get; }
public object ContextSearchRegion { get; set; }
private bool _searchButtonVisability = false;
public bool SearchButtonVisability { get => _searchButtonVisability; set { _searchButtonVisability = value; OnPropertyChanged("SearchButtonVisability"); } }
private Visibility _alertVisibility = Visibility.Hidden;
public Visibility AlertVisibility
{
get => _alertVisibility;
set => SetProperty(ref _alertVisibility, value, "AlertVisibility");
}
private string _aggregateStatusText = "---";
public string AggregateStatusText { get => _aggregateStatusText; set { _aggregateStatusText = value; OnPropertyChanged("AggregateStatusText"); } }
private Color _aggregateStatusColor = Colors.AliceBlue;
public Color AggregateStatusColor { get => _aggregateStatusColor; set { _aggregateStatusColor = value; OnPropertyChanged("AggregateStatusColor"); } }
private Visibility _progressBarVisibility = Visibility.Hidden;
public Visibility ProgressBarVisibility { get => _progressBarVisibility; set { _progressBarVisibility = value; OnPropertyChanged("ProgressBarVisibility"); } }
private int _progressBarValue;
public int ProgressBarValue { get => _progressBarValue; set { _progressBarValue = value; OnPropertyChanged("ProgressBarValue"); } }
public new event PropertyChangedEventHandler PropertyChanged;
///<summary>
///Occurs when a property value changes.
///</summary>
private new void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
#endregion Properties
#region Methods
public override void Initialize()
{
}
public override void Initialize(object parameter)
{
Parent = (IBaseViewModel)parameter;
_eventAggregator.GetEvent<ProgressBarEvent>().Subscribe(OnProgressBarEvent, ThreadOption.UIThread);
}
private void OnProgressBarEvent(ProgressBarEventArg arg)
{
if (arg.ProgressBarName != ProgressBarName) { return; }
AggregateStatusColor = arg.ProgressBarColor;
AggregateStatusText = arg.ProgressBarText;
ProgressBarVisibility = arg.ProgressBarVisibility;
if (!double.IsNaN(arg.ProgressBarPercentage))
{
ProgressBarValue = Convert.ToInt32(arg.ProgressBarPercentage);
}
}
public override void Activated()
{
}
public override void Cleanup()
{
}
private void OnUpdate(StatusAndProgressBarEventArgs args)
{
//Since there may be multiple instances of this control, don't do anything if
//the requester is not our parent because it's just a waste of time and resources
if (args.Requester != Parent) return;
AggregateStatusText = args.StatusText;
if (!string.IsNullOrWhiteSpace(args.ErrorText))
{
AggregateStatusText += " - " + args.ErrorText;
}
AggregateStatusColor = args.StatusColor;
ProgressBarVisibility = args.ProgressBarVisibility;
ProgressBarValue = (int)args.ProgressValue;
}
#endregion Methods
}
}

View File

@@ -0,0 +1,104 @@
using System;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Windows;
using DTS.Common.Base;
using DTS.Common.Events;
using DTS.Common.Interactivity;
using DTS.Common.Interface;
using Prism.Events;
using Prism.Regions;
using Unity;
namespace DTS.StatusAndProgressBar
{
public class StatusAndProgressFooterViewModel : BaseViewModel<IStatusAndProgressBarFooterViewModel>, IStatusAndProgressBarFooterViewModel
{
public IStatusAndProgressFooterView View { get; set; }
public IBaseViewModel Parent { get; set; }
private IEventAggregator _eventAggregator { get; set; }
private IUnityContainer _unityContainer { get; set; }
public InteractionRequest<Notification> NotificationRequest { get; private set; }
public new InteractionRequest<Confirmation> ConfirmationRequest { get; private set; }
/// <summary>
/// Creates a new instance of the FilterViewModel.
/// </summary>
/// <param name="view">The StatusAndProgressBar View interface.</param>
/// <param name="regionManager">The logical placeholder defined within the application's UI (in the shell or within views) into which views are displayed.</param>
/// <param name="eventAggregator">The EventAggregator which allows different components to publish/subscribe to events without being coupled to each other.</param>
/// <param name="unityContainer">The Unity container.</param>
public StatusAndProgressFooterViewModel(IStatusAndProgressFooterView view, IRegionManager regionManager, IEventAggregator eventAggregator, IUnityContainer unityContainer)
: base(regionManager, eventAggregator, unityContainer)
{
View = view;
View.DataContext = this;
NotificationRequest = new InteractionRequest<Notification>();
ConfirmationRequest = new InteractionRequest<Confirmation>();
_eventAggregator = eventAggregator;
_unityContainer = unityContainer;
_eventAggregator.GetEvent<ProgressBarEvent>().Subscribe(OnStatusAndProgressBarEvent);
}
#region Properties
public new bool IsMenuIncluded { get; set; }
public new bool IsNavigationIncluded { get; set; }
public new bool IsBusy { get; set; }
public new bool IsDirty { get; }
public new event PropertyChangedEventHandler PropertyChanged;
///<summary>
///Occurs when a property value changes.
///</summary>
private new void OnPropertyChanged(string propertyName)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
public string ProgressText { get; set; }
public Visibility ProgressBarVisiblity { get; set; }
public int ProgressBarValue { get; set; }
#endregion Properties
#region Methods
private void SetProgressText(string value)
{
ProgressText = value;
OnPropertyChanged("ProgressText");
}
private void SetProgressBarVisibility(Visibility visibility)
{
ProgressBarVisiblity = visibility;
OnPropertyChanged("ProgressBarVisibility");
}
private void SetProgressBarValue(int value)
{
ProgressBarValue = value;
OnPropertyChanged("ProgressBarValue");
}
private void OnStatusAndProgressBarEvent(ProgressBarEventArg args)
{
if (args.ProgressBarName != "Footer") { return; }
if (args.SetPercentage)
{
SetProgressBarValue(Convert.ToInt32(args.ProgressBarPercentage));
}
if (args.SetText)
{
SetProgressText(args.ProgressBarText);
}
if (args.SetVisibility)
{
SetProgressBarVisibility(args.ProgressBarVisibility);
}
}
#endregion Methods
}
}

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = "")]

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]