init
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
using DTS.Common.Base;
|
||||
namespace DTS.Common.Interface
|
||||
{
|
||||
public interface INavigationView : IBaseView { }
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
using DTS.Common.Base;
|
||||
// ReSharper disable CheckNamespace
|
||||
namespace DTS.Common.Interface
|
||||
{
|
||||
public interface ITestSummaryListView : IBaseView { }
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using DTS.Common.Enums.Channels;
|
||||
using Microsoft.Practices.Prism.Events;
|
||||
|
||||
namespace DTS.Common.Events.ChannelCodes
|
||||
{
|
||||
public class ChannelCodeCommittedEvent: CompositePresentationEvent<ChannelCodeCommittedEventArgs []> { }
|
||||
|
||||
public class ChannelCodeCommittedEventArgs
|
||||
{
|
||||
public ChannelEnumsAndConstants.ChannelCodeType ChannelCodeType{ get; private set; }
|
||||
public string Code{ get; private set; }
|
||||
public string Name { get; private set; }
|
||||
// indicates whether the user submitting the event has write privilege
|
||||
// for channel codes
|
||||
public bool CanUserCommitChannelCodes { get; private set; }
|
||||
public ChannelCodeCommittedEventArgs(ChannelEnumsAndConstants.ChannelCodeType channelCodeType,
|
||||
string code,
|
||||
string name,
|
||||
bool canUserCommitChannelCodes)
|
||||
{
|
||||
ChannelCodeType = channelCodeType;
|
||||
Code = code;
|
||||
Name = name;
|
||||
CanUserCommitChannelCodes = canUserCommitChannelCodes;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
<UserControl x:Class="DTS.Common.Controls.CommonStatusRibbon"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d" d:DesignHeight="80" d:DesignWidth="1366" x:Name="commonStatusRibbon">
|
||||
<Grid>
|
||||
<Grid HorizontalAlignment="Stretch" Visibility="Visible" DataContext="{Binding ElementName=commonStatusRibbon}">
|
||||
<Grid.Background>
|
||||
<SolidColorBrush Color="{Binding AggregateStatusColor, FallbackValue=Yellow}" />
|
||||
</Grid.Background>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0">
|
||||
<Rectangle Fill="{DynamicResource Brush_StatusRibbonErrorBackgroundDark}" Visibility="{Binding AlertVisibility, FallbackValue=Hidden}" />
|
||||
<Grid Background="{DynamicResource Brush_StatusRibbonErrorBackgroundLight}" Visibility="{Binding AlertVisibility, FallbackValue=Visible}">
|
||||
<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>
|
||||
<TextBlock FontFamily="Segoe UI" FontSize="11"
|
||||
Foreground="{Binding TextColor}" Text="{Binding AggregateStatusText, FallbackValue=Connecting}" Margin="0" Width="200"/>
|
||||
</Grid>
|
||||
|
||||
<ProgressBar Grid.Column="1" Margin="0" HorizontalContentAlignment="Stretch" Visibility="{Binding ProgressBarVisibility}" Value="{Binding ProgressBarValue,FallbackValue=30}"/>
|
||||
</Grid>
|
||||
<Grid MinHeight="80" HorizontalAlignment="Stretch" Visibility="Collapsed" DataContext="{Binding ElementName=commonStatusRibbon}">
|
||||
<Grid.Background>
|
||||
<SolidColorBrush Color="{Binding AggregateStatusColor, FallbackValue=Yellow}" />
|
||||
</Grid.Background>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</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=Visible}">
|
||||
<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>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{Binding TextColor}"
|
||||
Text="{Binding AggregateStatusText, FallbackValue=Connecting}"
|
||||
HorizontalAlignment="Center"
|
||||
Margin="0"
|
||||
x:Name="lblAggregateStatusText"
|
||||
/>
|
||||
<ProgressBar
|
||||
Margin="0"
|
||||
Grid.Row="1"
|
||||
Height="40"
|
||||
VerticalAlignment="Bottom"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
Visibility="{Binding ProgressBarVisibility}"
|
||||
Value="{Binding ProgressBarValue,FallbackValue=30}"
|
||||
/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,171 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace DTS.Common.Utils
|
||||
{
|
||||
// Converts integral types to bytes but wraps the conversions so that
|
||||
// outgoing they are converted to network order and incoming they are
|
||||
// converted to host order.
|
||||
public class ByteConvertor
|
||||
{
|
||||
public static void Convert(byte[] input, int offset, out byte value)
|
||||
{
|
||||
// Nothing to do for single bytes
|
||||
value = input[offset];
|
||||
}
|
||||
|
||||
public static void Convert(byte[] input, int offset, out ushort value)
|
||||
{
|
||||
value = (ushort)(0 |
|
||||
input[offset + 0] << 8 |
|
||||
input[offset + 1] << 0);
|
||||
}
|
||||
|
||||
public static void Convert(byte[] input, int offset, out short value)
|
||||
{
|
||||
value = (short)(0 |
|
||||
input[offset + 0] << 8 |
|
||||
input[offset + 1] << 0);
|
||||
}
|
||||
|
||||
public static void Convert(byte[] input, int offset, out uint value)
|
||||
{
|
||||
value = 0 |
|
||||
(uint)input[offset + 0] << 24 |
|
||||
(uint)input[offset + 1] << 16 |
|
||||
(uint)input[offset + 2] << 8 |
|
||||
(uint)input[offset + 3] << 0;
|
||||
}
|
||||
|
||||
public static void Convert(byte[] input, int offset, out int value)
|
||||
{
|
||||
value =
|
||||
input[offset + 0] << 24 |
|
||||
input[offset + 1] << 16 |
|
||||
input[offset + 2] << 8 |
|
||||
input[offset + 3] << 0;
|
||||
}
|
||||
|
||||
public static void Convert(byte[] input, int offset, out ulong value)
|
||||
{
|
||||
value = 0 |
|
||||
(ulong)input[offset + 0] << 56 |
|
||||
(ulong)input[offset + 1] << 48 |
|
||||
(ulong)input[offset + 2] << 40 |
|
||||
(ulong)input[offset + 3] << 32 |
|
||||
(ulong)input[offset + 4] << 24 |
|
||||
(ulong)input[offset + 5] << 16 |
|
||||
(ulong)input[offset + 6] << 8 |
|
||||
(ulong)input[offset + 7] << 0;
|
||||
}
|
||||
|
||||
public static void Convert(byte[] input, int offset, out long value)
|
||||
{
|
||||
value = 0 |
|
||||
(long)input[offset + 0] << 56 |
|
||||
(long)input[offset + 1] << 48 |
|
||||
(long)input[offset + 2] << 40 |
|
||||
(long)input[offset + 3] << 32 |
|
||||
(long)input[offset + 4] << 24 |
|
||||
(long)input[offset + 5] << 16 |
|
||||
(long)input[offset + 6] << 8 |
|
||||
(long)input[offset + 7] << 0;
|
||||
}
|
||||
|
||||
public static void Convert(byte[] input, int offset, out float value)
|
||||
{
|
||||
value = BitConverter.ToSingle(input, offset);
|
||||
}
|
||||
|
||||
public static void Convert(byte[] input, int offset, out double value)
|
||||
{
|
||||
value = BitConverter.ToDouble(input, offset);
|
||||
}
|
||||
|
||||
public static void Convert(byte[] input, int offset, out string value)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
for (var i = offset; i < input.Length && input[i] != 0; i++)
|
||||
{
|
||||
sb.Append((char)input[i]);
|
||||
}
|
||||
value = sb.ToString();
|
||||
}
|
||||
|
||||
public static byte[] ToByteArray(string input)
|
||||
{
|
||||
var c = input.ToCharArray();
|
||||
var rv = new byte[c.Length + 1];
|
||||
for (var i = 0; i < c.Length; i++) rv[i] = (byte)c[i];
|
||||
rv[c.Length] = 0;
|
||||
return rv;
|
||||
}
|
||||
|
||||
public static byte[] ToByteArray(byte input)
|
||||
{
|
||||
var rv = new byte[1];
|
||||
rv[0] = input;
|
||||
return rv;
|
||||
}
|
||||
|
||||
public static byte[] ToByteArray(ushort input)
|
||||
{
|
||||
var rv = new byte[2];
|
||||
rv[0] = (byte)((input >> 8) & 0xFF);
|
||||
rv[1] = (byte)((input >> 0) & 0xFF);
|
||||
return rv;
|
||||
}
|
||||
|
||||
public static byte[] ToByteArray(short input)
|
||||
{
|
||||
var rv = new byte[2];
|
||||
rv[0] = (byte)((input >> 8) & 0xFF);
|
||||
rv[1] = (byte)((input >> 0) & 0xFF);
|
||||
return rv;
|
||||
}
|
||||
|
||||
public static byte[] ToByteArray(uint input)
|
||||
{
|
||||
var rv = new byte[4];
|
||||
rv[0] = (byte)((input >> 24) & 0xFF);
|
||||
rv[1] = (byte)((input >> 16) & 0xFF);
|
||||
rv[2] = (byte)((input >> 8) & 0xFF);
|
||||
rv[3] = (byte)((input >> 0) & 0xFF);
|
||||
return rv;
|
||||
}
|
||||
|
||||
public static byte[] ToByteArray(int input)
|
||||
{
|
||||
var rv = new byte[4];
|
||||
rv[0] = (byte)((input >> 24) & 0xFF);
|
||||
rv[1] = (byte)((input >> 16) & 0xFF);
|
||||
rv[2] = (byte)((input >> 8) & 0xFF);
|
||||
rv[3] = (byte)((input >> 0) & 0xFF);
|
||||
return rv;
|
||||
}
|
||||
|
||||
public static byte[] ToByteArray(ulong input)
|
||||
{
|
||||
var rv = new byte[8];
|
||||
rv[0] = (byte)((input >> 56) & 0xFF);
|
||||
rv[1] = (byte)((input >> 48) & 0xFF);
|
||||
rv[2] = (byte)((input >> 40) & 0xFF);
|
||||
rv[3] = (byte)((input >> 32) & 0xFF);
|
||||
rv[4] = (byte)((input >> 24) & 0xFF);
|
||||
rv[5] = (byte)((input >> 16) & 0xFF);
|
||||
rv[6] = (byte)((input >> 8) & 0xFF);
|
||||
rv[7] = (byte)((input >> 0) & 0xFF);
|
||||
return rv;
|
||||
}
|
||||
|
||||
public static byte[] ToByteArray(float input)
|
||||
{
|
||||
return BitConverter.GetBytes(input);
|
||||
}
|
||||
|
||||
public static byte[] ToByteArray(double input)
|
||||
{
|
||||
return BitConverter.GetBytes(input);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using DTS.Common.Enums.GroupTemplates;
|
||||
|
||||
namespace DTS.Common.Interface.GroupTemplate
|
||||
{
|
||||
public interface IGroupTemplateChannel
|
||||
{
|
||||
bool Custom { get; }
|
||||
int DisplayOrder { get; set; }
|
||||
string NameOfTheChannel{ get; set; }
|
||||
string Name { get; }
|
||||
bool Required { get; set; }
|
||||
bool Filter(string term);
|
||||
string ISOCode { get; }
|
||||
}
|
||||
|
||||
public class GroupTemplateChannelComparer : IComparer<IGroupTemplateChannel>
|
||||
{
|
||||
public GroupTemplateChannelFields SortField { get; set; }
|
||||
public bool Ascending { get; set; }
|
||||
public int Compare(IGroupTemplateChannel x, IGroupTemplateChannel y)
|
||||
{
|
||||
if (x == y)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (null == x)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (null == y)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
var left = x;
|
||||
var right = y;
|
||||
if(!Ascending) { left = y; right = x; }
|
||||
switch (SortField)
|
||||
{
|
||||
case GroupTemplateChannelFields.Required:
|
||||
return left.Required.CompareTo(right.Required);
|
||||
case GroupTemplateChannelFields.Name:
|
||||
return String.Compare(left.Name, right.Name, StringComparison.Ordinal);
|
||||
case GroupTemplateChannelFields.ISOCode:
|
||||
return String.Compare(left.ISOCode, right.ISOCode, StringComparison.Ordinal);
|
||||
case GroupTemplateChannelFields.Custom:
|
||||
return left.Custom.CompareTo(right.Custom);
|
||||
case GroupTemplateChannelFields.DisplayOrder:
|
||||
return left.DisplayOrder.CompareTo(right.DisplayOrder);
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user