init
This commit is contained in:
1
DataPRO/Modules/Channels/ChannelCodes/.svn/entries
Normal file
1
DataPRO/Modules/Channels/ChannelCodes/.svn/entries
Normal file
@@ -0,0 +1 @@
|
||||
12
|
||||
1
DataPRO/Modules/Channels/ChannelCodes/.svn/format
Normal file
1
DataPRO/Modules/Channels/ChannelCodes/.svn/format
Normal file
@@ -0,0 +1 @@
|
||||
12
|
||||
@@ -0,0 +1,262 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.OleDb;
|
||||
using System.Data.SqlClient;
|
||||
using System.IO;
|
||||
using System.Windows.Input;
|
||||
using DTS.Common.Classes.ChannelCodes;
|
||||
using DTS.Common.Enums;
|
||||
using DTS.Common.Enums.Channels;
|
||||
using DTS.Common.Interface.Channels.ChannelCodes;
|
||||
using DTS.Common.Storage;
|
||||
|
||||
namespace ChannelCodes.Model
|
||||
{
|
||||
public class ChannelCode : DTS.Common.Classes.ChannelCodes.ChannelCode, IChannelCode
|
||||
{
|
||||
//in case this object is held onto longer before cleanup, attempt to empty
|
||||
//private storage
|
||||
~ChannelCode()
|
||||
{
|
||||
_code = null;
|
||||
_name = null;
|
||||
PossibleChannels?.Clear();
|
||||
PasteCommand = null;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// whether the current id is valid or not
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool HasValidId()
|
||||
{
|
||||
return Id >= 0;
|
||||
}
|
||||
|
||||
public bool IsBlank()
|
||||
{
|
||||
return string.IsNullOrEmpty(Name) && string.IsNullOrEmpty(Code);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// this dates back from when there was a dropdown to select the type of code,
|
||||
/// I'm not sure it's used anymore (2019-04-11)
|
||||
/// </summary>
|
||||
public int SelectedChannelType
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (CodeType)
|
||||
{
|
||||
case ChannelEnumsAndConstants.ChannelCodeType.ISO:
|
||||
return 0;
|
||||
case ChannelEnumsAndConstants.ChannelCodeType.User:
|
||||
return 1;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
set
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 0: CodeType = ChannelEnumsAndConstants.ChannelCodeType.ISO; break;
|
||||
case 1: CodeType = ChannelEnumsAndConstants.ChannelCodeType.User; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RegisterCommands()
|
||||
{
|
||||
PasteCommand = new PasteCommandClass(PASTE_ID);
|
||||
CommandManager.RegisterClassCommandBinding(GetType(),
|
||||
new CommandBinding(PasteCommand, Paste));
|
||||
}
|
||||
public ChannelCode(IChannelCode channelCode)
|
||||
: base(channelCode)
|
||||
{
|
||||
RegisterCommands();
|
||||
}
|
||||
|
||||
private void Paste(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
}
|
||||
|
||||
public ChannelCode()
|
||||
{
|
||||
CodeType = ChannelEnumsAndConstants.ChannelCodeType.ISO;
|
||||
RegisterCommands();
|
||||
}
|
||||
|
||||
public ChannelCode(IDataRecord sqlReader, IDictionary<short, string> channelCodeLookup)
|
||||
{
|
||||
RegisterCommands();
|
||||
Id = Convert.ToInt32(sqlReader["Id"]);
|
||||
Code = (string)sqlReader["Code"];
|
||||
Name = (string)sqlReader["Name"];
|
||||
var codeType = Convert.ToInt16(sqlReader["CodeTypeInt"]);
|
||||
if (channelCodeLookup.ContainsKey(codeType))
|
||||
{
|
||||
var key = channelCodeLookup[codeType];
|
||||
switch (key)
|
||||
{
|
||||
case ChannelEnumsAndConstants.UserCodeTypeString:
|
||||
CodeType = ChannelEnumsAndConstants.ChannelCodeType.User;
|
||||
break;
|
||||
case ChannelEnumsAndConstants.IsoCodeTypeString:
|
||||
CodeType = ChannelEnumsAndConstants.ChannelCodeType.ISO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// get all existing channel codes from the db
|
||||
/// </summary>
|
||||
/// <param name="lookup">a lookup from channel code type (short) to channel code type string as in the db</param>
|
||||
/// <returns></returns>
|
||||
public static ChannelCode[] GetExistingChannelCodes(IDictionary<short, string> lookup)
|
||||
{
|
||||
var channelCodes = new List<ChannelCode>();
|
||||
using (var cmd = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.CommandText = @"sp_ChannelCodesGet";
|
||||
cmd.Parameters.Add(new SqlParameter("@Id", SqlDbType.Int) { Value = null });
|
||||
cmd.Parameters.Add(new SqlParameter("@Code", SqlDbType.NVarChar, 255) { Value = null });
|
||||
cmd.Parameters.Add(new SqlParameter("@Name", SqlDbType.NVarChar, 255) { Value = null });
|
||||
cmd.Parameters.Add(new SqlParameter("@CodeType", SqlDbType.SmallInt) { Value = null });
|
||||
|
||||
var reader = cmd.ExecuteReader();
|
||||
while (reader.Read())
|
||||
{
|
||||
channelCodes.Add(new ChannelCode(reader, lookup));
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
return channelCodes.ToArray();
|
||||
}
|
||||
/// <summary>
|
||||
/// retrieves all channel codes and returns as a list
|
||||
/// </summary>
|
||||
public static IList<IChannelCode> ChannelCodes
|
||||
{
|
||||
get
|
||||
{
|
||||
var lookup = ChannelCodeType.GetChannelCodeTypeLookup();
|
||||
var channelCodes = new List<IChannelCode>();
|
||||
channelCodes.AddRange(GetExistingChannelCodes(lookup));
|
||||
channelCodes.AddRange(ISOChannelCodes);
|
||||
|
||||
return channelCodes;
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly object RefreshLock = new object();
|
||||
|
||||
public Dictionary<string, string> PossibleChannels { get; private set; }
|
||||
|
||||
|
||||
private static IList<IChannelCode> _isoChannelCodes;
|
||||
|
||||
/// <summary>
|
||||
/// retrieves a list of iso channel codes from the db
|
||||
/// </summary>
|
||||
public static IList<IChannelCode> ISOChannelCodes
|
||||
{
|
||||
get
|
||||
{
|
||||
if (null != _isoChannelCodes) return _isoChannelCodes;
|
||||
//we only need to fetch these values once, they're not going to change.
|
||||
var channelCodes = new List<IChannelCode>();
|
||||
|
||||
lock (RefreshLock)
|
||||
{
|
||||
var sourceFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ISOPossibleChannels.txt");
|
||||
using (StreamReader sr = File.OpenText(sourceFile))
|
||||
{
|
||||
string s = string.Empty;
|
||||
while ((s = sr.ReadLine()) != null)
|
||||
{
|
||||
var splitString = s.Split(',');
|
||||
var isoCode = splitString[0];
|
||||
var textL1 = splitString[1];
|
||||
var newChannelCode = new ChannelCode()
|
||||
{
|
||||
Code = isoCode,
|
||||
Name = textL1,
|
||||
CodeType = ChannelEnumsAndConstants.ChannelCodeType.ISO
|
||||
};
|
||||
if (!channelCodes.Contains(newChannelCode))
|
||||
{
|
||||
channelCodes.Add(newChannelCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_isoChannelCodes = channelCodes;
|
||||
return _isoChannelCodes;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// not used? maybe was a part of migration?
|
||||
/// </summary>
|
||||
/// <param name="reader"></param>
|
||||
/// <param name="field"></param>
|
||||
/// <returns></returns>
|
||||
protected static long GetLong(OleDbDataReader reader, string field)
|
||||
{
|
||||
return DBNull.Value == reader[field] ? long.MinValue : Convert.ToInt64(reader[field]);
|
||||
}
|
||||
/// <summary>
|
||||
/// not used, maybe was a part of migration?
|
||||
/// </summary>
|
||||
/// <param name="reader"></param>
|
||||
/// <param name="field"></param>
|
||||
/// <returns></returns>
|
||||
protected static DateTime GetDate(OleDbDataReader reader, string field)
|
||||
{
|
||||
return DBNull.Value != reader[field] ? (DateTime)reader[field] : DateTime.MinValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// deletes channel code
|
||||
/// deleting a channel code only removes it from the lookup, doesn't remove it from any existing channels
|
||||
/// </summary>
|
||||
public void Delete()
|
||||
{
|
||||
_ = DbOperations.ChannelCodesDelete(Id, null, null, null);
|
||||
}
|
||||
/// <summary>
|
||||
/// commits any channel codes to the db
|
||||
/// this only affects the channel code lookup, not any existing channels
|
||||
/// </summary>
|
||||
/// <param name="lookup"></param>
|
||||
public void Save(IDictionary<ChannelEnumsAndConstants.ChannelCodeType, short> lookup)
|
||||
{
|
||||
var restrictedLookup = (IReadOnlyDictionary<ChannelEnumsAndConstants.ChannelCodeType, short>)lookup;
|
||||
_ = DbOperations.ChannelCodesUpdate(restrictedLookup, this);
|
||||
}
|
||||
/// <summary>
|
||||
/// inserts a new channel code into the db
|
||||
/// </summary>
|
||||
/// <param name="lookup"></param>
|
||||
public void Insert(IDictionary<ChannelEnumsAndConstants.ChannelCodeType, short> lookup)
|
||||
{
|
||||
var restrictedLookup = (IReadOnlyDictionary<ChannelEnumsAndConstants.ChannelCodeType, short>)lookup;
|
||||
var hr = DbOperations.ChannelCodesInsert(restrictedLookup, this, out var id);
|
||||
if (0 == hr)
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
<?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>{266B86D0-6A3F-4B52-8749-FA87ECB0230F}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ChannelCodes</RootNamespace>
|
||||
<AssemblyName>ChannelCodes</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>CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<RunCodeAnalysis>false</RunCodeAnalysis>
|
||||
<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>CODE_ANALYSIS;DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<RunCodeAnalysis>true</RunCodeAnalysis>
|
||||
<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.Practices.ServiceLocation">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\PrismLibrary\Microsoft.Practices.ServiceLocation.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualBasic" />
|
||||
<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.Core" />
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xaml" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<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" />
|
||||
<Reference Include="Xceed.Wpf.Toolkit">
|
||||
<HintPath>..\..\..\..\Common\DTS.Common\lib\Xceed.Wpf.Toolkit\Xceed.Wpf.Toolkit.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Model\ChannelCode.cs" />
|
||||
<Compile Include="Model\ChannelCodeType.cs" />
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ChannelCodesModule.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Resources\StringResources.Designer.cs">
|
||||
<DependentUpon>StringResources.resx</DependentUpon>
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<Compile Include="Resources\TranslateExtension.cs" />
|
||||
<Compile Include="ViewModel\ChannelCodesListViewModel.cs" />
|
||||
<Compile Include="View\ChannelCodesListView.xaml.cs">
|
||||
<DependentUpon>ChannelCodesListView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\StringResources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>StringResources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.Core\DTS.Common.Core.csproj">
|
||||
<Project>{fab1f470-1574-4301-b56e-d3364aa93679}</Project>
|
||||
<Name>DTS.Common.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.DAS.Concepts\DTS.Common.DAS.Concepts.csproj">
|
||||
<Project>{03D8C736-36EB-4CD1-A6D9-130452B23239}</Project>
|
||||
<Name>DTS.Common.DAS.Concepts</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.ISO\DTS.Common.ISO.csproj">
|
||||
<Project>{4dccddd1-032f-430c-9a6f-231daca4fbd0}</Project>
|
||||
<Name>DTS.Common.ISO</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\Common\DTS.Common.Storage\DTS.Common.Storage.csproj">
|
||||
<Project>{e0d1a7d0-dce8-403d-ba85-5a5d66ba1313}</Project>
|
||||
<Name>DTS.Common.Storage</Name>
|
||||
</ProjectReference>
|
||||
<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>
|
||||
<ProjectReference Include="..\..\..\IService\IService.csproj">
|
||||
<Project>{c9c45b72-05a3-4962-bc13-a78b1f4b1925}</Project>
|
||||
<Name>IService</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\SensorDB\SensorDB.csproj">
|
||||
<Project>{444ef10c-046e-47ad-a9a5-17318d488723}</Project>
|
||||
<Name>SensorDB</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Users\Users.csproj">
|
||||
<Project>{BE8D217D-6DA9-4BCA-B62A-A82325B33979}</Project>
|
||||
<Name>Users</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="View\ChannelCodesListView.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources\ISOPossibleChannels.txt">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,279 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ChannelCodes.Resources {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class StringResources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal StringResources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ChannelCodes.Resources.StringResources", typeof(StringResources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to All.
|
||||
/// </summary>
|
||||
internal static string All {
|
||||
get {
|
||||
return ResourceManager.GetString("All", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Channel code.
|
||||
/// </summary>
|
||||
internal static string ChannelCode {
|
||||
get {
|
||||
return ResourceManager.GetString("ChannelCode", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Type.
|
||||
/// </summary>
|
||||
internal static string ChannelType {
|
||||
get {
|
||||
return ResourceManager.GetString("ChannelType", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Display name.
|
||||
/// </summary>
|
||||
internal static string DisplayName {
|
||||
get {
|
||||
return ResourceManager.GetString("DisplayName", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error: ISO channel {0} is duplicated.
|
||||
/// </summary>
|
||||
internal static string DuplicateISOChannelCode {
|
||||
get {
|
||||
return ResourceManager.GetString("DuplicateISOChannelCode", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error: {0} does not have a unique ISO channel name.
|
||||
/// </summary>
|
||||
internal static string DuplicateISOChannelName {
|
||||
get {
|
||||
return ResourceManager.GetString("DuplicateISOChannelName", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error: {0} does not have a unique ISO code.
|
||||
/// </summary>
|
||||
internal static string DuplicateISOCode {
|
||||
get {
|
||||
return ResourceManager.GetString("DuplicateISOCode", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error: User channel {0} is duplicated.
|
||||
/// </summary>
|
||||
internal static string DuplicateUserChannelCode {
|
||||
get {
|
||||
return ResourceManager.GetString("DuplicateUserChannelCode", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error: {0} does not have a unique user channel name.
|
||||
/// </summary>
|
||||
internal static string DuplicateUserChannelName {
|
||||
get {
|
||||
return ResourceManager.GetString("DuplicateUserChannelName", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Warning: {0} does not have a unique user code.
|
||||
/// </summary>
|
||||
internal static string DuplicateUserCode {
|
||||
get {
|
||||
return ResourceManager.GetString("DuplicateUserCode", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Invalid pasted channel code, line: {0}.
|
||||
/// </summary>
|
||||
internal static string InvalidLine {
|
||||
get {
|
||||
return ResourceManager.GetString("InvalidLine", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to ISO 13499.
|
||||
/// </summary>
|
||||
internal static string ISO {
|
||||
get {
|
||||
return ResourceManager.GetString("ISO", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to ISO 13499 channel name.
|
||||
/// </summary>
|
||||
internal static string ISOChannelName {
|
||||
get {
|
||||
return ResourceManager.GetString("ISOChannelName", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to ISO 13499 code.
|
||||
/// </summary>
|
||||
internal static string ISOCode {
|
||||
get {
|
||||
return ResourceManager.GetString("ISOCode", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Warning: {0} has an ISO code that is not unique.
|
||||
/// </summary>
|
||||
internal static string ISOConflict {
|
||||
get {
|
||||
return ResourceManager.GetString("ISOConflict", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error: {0} missing ISO channel name.
|
||||
/// </summary>
|
||||
internal static string MissingISOChannelName {
|
||||
get {
|
||||
return ResourceManager.GetString("MissingISOChannelName", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error: {0} is missing an ISO code.
|
||||
/// </summary>
|
||||
internal static string MissingISOCode {
|
||||
get {
|
||||
return ResourceManager.GetString("MissingISOCode", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error: {0} is missing a user channel name.
|
||||
/// </summary>
|
||||
internal static string MissingUserChannelName {
|
||||
get {
|
||||
return ResourceManager.GetString("MissingUserChannelName", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Error: {0} is missing a user code.
|
||||
/// </summary>
|
||||
internal static string MissingUserCode {
|
||||
get {
|
||||
return ResourceManager.GetString("MissingUserCode", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Remove.
|
||||
/// </summary>
|
||||
internal static string Remove {
|
||||
get {
|
||||
return ResourceManager.GetString("Remove", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to User.
|
||||
/// </summary>
|
||||
internal static string User {
|
||||
get {
|
||||
return ResourceManager.GetString("User", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to User channel name.
|
||||
/// </summary>
|
||||
internal static string UserChannelName {
|
||||
get {
|
||||
return ResourceManager.GetString("UserChannelName", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to User code.
|
||||
/// </summary>
|
||||
internal static string UserCode {
|
||||
get {
|
||||
return ResourceManager.GetString("UserCode", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to There are multiple entries with the same user code and channel name.
|
||||
/// </summary>
|
||||
internal static string UserConflict {
|
||||
get {
|
||||
return ResourceManager.GetString("UserConflict", resourceCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="ChannelCodes.Properties" GeneratedClassName="Settings">
|
||||
<Profiles />
|
||||
<Settings>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
@@ -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("ChannelCodes")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("DTS")]
|
||||
[assembly: AssemblyProduct("ChannelCodes")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[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("fceac9fc-ac16-4e58-a64f-e4778846ac26")]
|
||||
|
||||
// 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")]
|
||||
@@ -0,0 +1,156 @@
|
||||
<base:BaseView x:Class="ChannelCodes.ChannelCodesListView"
|
||||
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:converters="clr-namespace:DTS.Common.Converters;assembly=DTS.Common"
|
||||
xmlns:controls="clr-namespace:DTS.Common.Controls;assembly=DTS.Common"
|
||||
xmlns:behaviors="clr-namespace:DTS.Common.Behaviors;assembly=DTS.Common"
|
||||
xmlns:strings="clr-namespace:ChannelCodes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="768" d:DesignWidth="1366"
|
||||
x:Name="ChannelListView">
|
||||
<base:BaseView.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Themes/CommonStyles.xaml"/>
|
||||
<ResourceDictionary Source="pack://application:,,,/DTS.Common;component/Controls/combobox.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<Style TargetType="ListView">
|
||||
<Setter Property="ItemContainerStyle" Value="{StaticResource TTS_ListViewItemStyle}"/>
|
||||
</Style>
|
||||
<Style TargetType="TextBox" BasedOn="{StaticResource TTS_TextBoxStyle}"/>
|
||||
<Style TargetType="TextBlock" BasedOn="{StaticResource TTS_TextBlockStyle}"/>
|
||||
<Style TargetType="CheckBox" BasedOn="{StaticResource PageContentCheckBoxStyle}" />
|
||||
<Style TargetType="ComboBox" BasedOn="{StaticResource TTS_ComboBoxStyle}"/>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource TTS_ButtonStyle}"/>
|
||||
<Style TargetType="GridViewColumnHeader" BasedOn="{StaticResource Gray_GridViewColumnHeaderStyle}"/>
|
||||
<Style TargetType="RadioButton" BasedOn="{StaticResource FlatRadioButtonStyle}" >
|
||||
<Setter Property="Height" Value="24" />
|
||||
<Setter Property="Margin" Value="5" />
|
||||
</Style>
|
||||
<converters:StatusToBorderThicknessConverter x:Key="StatusToBorderThickness" />
|
||||
<converters:StatusToColorConverter x:Key="StatusToColor" />
|
||||
<converters:InverseBooleanConverter x:Key="InverseBooleanConverter" />
|
||||
</ResourceDictionary>
|
||||
</base:BaseView.Resources>
|
||||
<Grid Background="{DynamicResource Brush_ApplicationContentBackground}" ScrollViewer.CanContentScroll="True" ScrollViewer.VerticalScrollBarVisibility="Auto">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="0">
|
||||
<RadioButton GroupName="Filters" Content="{strings:TranslateExtension ISO}" Checked="ISO_Checked" IsChecked="True" AutomationProperties.AutomationId="btnChannelCodeDetailsISO"/>
|
||||
<RadioButton GroupName="Filters" Content="{strings:TranslateExtension User}" Checked="User_Checked" AutomationProperties.AutomationId="btnChannelCodeDetailsUser"/>
|
||||
</StackPanel>
|
||||
<ListView ItemsSource="{Binding ISOChannelCodes, UpdateSourceTrigger=PropertyChanged}" Grid.Row="1"
|
||||
AutomationProperties.AutomationId="ISOChannelCodeListView" Visibility="{Binding ISOVisibility}" SelectionMode="Extended" SelectionChanged="ISOCodes_SelectionChanged"
|
||||
KeyboardNavigation.TabNavigation="Continue" x:Name="ISOChannelCodesListView" PreviewMouseLeftButtonUp="ISOChannelCodesListView_PreviewMouseLeftButtonUp">
|
||||
<ListView.ItemContainerStyle>
|
||||
<Style TargetType="{x:Type ListViewItem}">
|
||||
<Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>
|
||||
<ListView.View>
|
||||
<controls:AutoSizedGridView AutomationProperties.AutomationId="ChannelCodesListGridView">
|
||||
<GridViewColumn AutomationProperties.AutomationId="ChannelCodeColumn" Width="315">
|
||||
<GridViewColumn.Header>
|
||||
<controls:GridViewColumnHeaderSearchable Tag="ISOCode" HeaderTitle="{strings:TranslateExtension ISOCode}" Search="GridViewColumnHeaderSearchable_OnSearch"
|
||||
x:Name="ISOCodeColumnHeader" ClickHandler="GridViewColumnHeader_OnClick"/>
|
||||
</GridViewColumn.Header>
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<controls:ChannelCodeBuilder Width="300" AutomationProperties.AutomationId="ChannelCodeTextBox" Code="{Binding Code, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
KeyDown="ChannelCodeTextBox_KeyDown" TextChanged="ChannelCodeTextBoxIso_TextChanged" CodeType="ISO"
|
||||
ChannelCodeSelected="ChannelCodeBuilder_OnChannelCodeSelected"
|
||||
SelectionChanged="ChannelCodeBuilder_SelectionChanged"
|
||||
ChannelCodesFunc="{Binding DataContext.ChannelCodesFunc, RelativeSource={RelativeSource AncestorType={x:Type ListView}}}"
|
||||
ShowChannelCodeLookupHelper="{Binding DataContext.ShowChannelCodeLookupHelper, RelativeSource={RelativeSource AncestorType={x:Type ListView}}}"
|
||||
ShowISOStringBuilder="{Binding DataContext.ShowISOStringBuilder, RelativeSource={RelativeSource AncestorType={x:Type ListView}}}"
|
||||
UniqueISOCodesRequired="{Binding DataContext.UniqueISOCodesRequired, RelativeSource={RelativeSource AncestorType={x:Type ListView}}}"
|
||||
PasteId="ChannelCode" behaviors:TextBoxPasteBehavior.PasteCommand="{Binding PasteCommand}" Tag="ISOCode"
|
||||
BorderBrush="{Binding ItemStatus, Converter={StaticResource StatusToColor}}"
|
||||
BorderThickness="{Binding ItemStatus, Converter={StaticResource StatusToBorderThickness}}"
|
||||
IsEnabled="{Binding DataContext.IsReadOnly, Converter={StaticResource InverseBooleanConverter}, RelativeSource={RelativeSource AncestorType={x:Type ListView}}}"/>
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn AutomationProperties.AutomationId="DisplayNameColumn" Width="315">
|
||||
<GridViewColumn.Header>
|
||||
<controls:GridViewColumnHeaderSearchable Tag="ISOChannelName" HeaderTitle="{strings:TranslateExtension ISOChannelName}"
|
||||
Search="GridViewColumnHeaderSearchable_OnSearch" x:Name="ISOChannelNameColumnHeader"/>
|
||||
</GridViewColumn.Header>
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBox Width="300" AutomationProperties.AutomationId="DisplayNameTextBox"
|
||||
Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" KeyDown="DisplayNameTextBox_KeyDown" SelectionChanged="DisplayNameTextBoxIso_SelectionChanged" TextChanged="DisplayNameTextBoxIso_TextChanged" MaxLength="250"
|
||||
behaviors:TextBoxPasteBehavior.PasteCommand="{Binding PasteCommand}" Tag="ISOChannelName"
|
||||
BorderBrush="{Binding ItemStatus, Converter={StaticResource StatusToColor}}"
|
||||
BorderThickness="{Binding ItemStatus, Converter={StaticResource StatusToBorderThickness}}"
|
||||
IsEnabled="{Binding DataContext.IsReadOnly, Converter={StaticResource InverseBooleanConverter}, RelativeSource={RelativeSource AncestorType={x:Type ListView}}}" />
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</controls:AutoSizedGridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
|
||||
|
||||
<ListView ItemsSource="{Binding UserChannelCodes, UpdateSourceTrigger=PropertyChanged}" Grid.Row="1"
|
||||
AutomationProperties.AutomationId="UserChannelCodeListView" Visibility="{Binding UserVisibility}" SelectionMode="Extended" SelectionChanged="UserCodes_SelectionChanged"
|
||||
KeyboardNavigation.TabNavigation="Continue" x:Name="UserChannelCodesListView" PreviewMouseLeftButtonUp="UserChannelCodesListView_PreviewMouseLeftButtonUp">
|
||||
<ListView.ItemContainerStyle>
|
||||
<Style>
|
||||
<Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>
|
||||
<ListView.View>
|
||||
<controls:AutoSizedGridView AutomationProperties.AutomationId="ChannelCodesListGridView">
|
||||
<GridViewColumn AutomationProperties.AutomationId="ChannelCodeColumn" Width="315">
|
||||
<GridViewColumn.Header>
|
||||
<controls:GridViewColumnHeaderSearchable Tag="UserCode" HeaderTitle="{strings:TranslateExtension UserCode}" Search="GridViewColumnHeaderSearchable_OnSearch"
|
||||
ListviewId="{Binding ListViewId}" x:Name="UserCodeColumnHeader" ClickHandler="GridViewColumnHeader_OnClick"/>
|
||||
</GridViewColumn.Header>
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<controls:ChannelCodeBuilder Width="300" AutomationProperties.AutomationId="ChannelCodeTextBox" Code="{Binding Code, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
KeyDown="ChannelCodeTextBox_KeyDown" TextChanged="ChannelCodeTextBoxUser_TextChanged" CodeType="User"
|
||||
ChannelCodeSelected="ChannelCodeBuilder_OnChannelCodeSelected"
|
||||
ChannelCodesFunc="{Binding DataContext.ChannelCodesFunc, RelativeSource={RelativeSource AncestorType={x:Type ListView}}}"
|
||||
ShowChannelCodeLookupHelper="{Binding DataContext.ShowChannelCodeLookupHelper, RelativeSource={RelativeSource AncestorType={x:Type ListView}}}"
|
||||
ShowISOStringBuilder="{Binding DataContext.ShowISOStringBuilder, RelativeSource={RelativeSource AncestorType={x:Type ListView}}}"
|
||||
UniqueISOCodesRequired="{Binding DataContext.UniqueISOCodesRequired, RelativeSource={RelativeSource AncestorType={x:Type ListView}}}"
|
||||
PasteId="ChannelCode" behaviors:TextBoxPasteBehavior.PasteCommand="{Binding PasteCommand}" Tag="UserCode"
|
||||
BorderBrush="{Binding ItemStatus, Converter={StaticResource StatusToColor}}"
|
||||
SelectionChanged="ChannelCodeTextBoxUser_SelectionChanged"
|
||||
BorderThickness="{Binding ItemStatus, Converter={StaticResource StatusToBorderThickness}}"
|
||||
IsEnabled="{Binding DataContext.IsReadOnly, Converter={StaticResource InverseBooleanConverter}, RelativeSource={RelativeSource AncestorType={x:Type ListView}}}" />
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn AutomationProperties.AutomationId="DisplayNameColumn" Width="315">
|
||||
<GridViewColumn.Header>
|
||||
<controls:GridViewColumnHeaderSearchable Tag="UserChannelName" HeaderTitle="{strings:TranslateExtension UserChannelName}" Search="GridViewColumnHeaderSearchable_OnSearch"
|
||||
ListviewId="{Binding ListViewId}" x:Name="UserChannelNameColumnHeader"/>
|
||||
</GridViewColumn.Header>
|
||||
<GridViewColumn.CellTemplate>
|
||||
<ItemContainerTemplate>
|
||||
<TextBox Width="300" AutomationProperties.AutomationId="DisplayNameTextBox"
|
||||
Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" KeyDown="DisplayNameTextBox_KeyDown"
|
||||
TextChanged="DisplayNameTextBoxUser_TextChanged" MaxLength="250"
|
||||
behaviors:TextBoxPasteBehavior.PasteCommand="{Binding PasteCommand}" Tag="UserChannelName"
|
||||
BorderBrush="{Binding ItemStatus, Converter={StaticResource StatusToColor}}"
|
||||
BorderThickness="{Binding ItemStatus, Converter={StaticResource StatusToBorderThickness}}"
|
||||
SelectionChanged="DisplayNameTextBoxUser_SelectionChanged"
|
||||
IsEnabled="{Binding DataContext.IsReadOnly, Converter={StaticResource InverseBooleanConverter}, RelativeSource={RelativeSource AncestorType={x:Type ListView}}}" />
|
||||
</ItemContainerTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</controls:AutoSizedGridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</Grid>
|
||||
</base:BaseView>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<section name="ChannelCodes.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<userSettings>
|
||||
<ChannelCodes.Properties.Settings>
|
||||
</ChannelCodes.Properties.Settings>
|
||||
</userSettings>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>
|
||||
@@ -0,0 +1,140 @@
|
||||
using System;
|
||||
using System.ComponentModel.Composition;
|
||||
using System.Windows.Media.Imaging;
|
||||
using DTS.Common;
|
||||
using Prism.Modularity;
|
||||
using Unity;
|
||||
using ChannelCodes;
|
||||
using DTS.Common.Interface;
|
||||
using DTS.Common.Interface.Channels.ChannelCodes;
|
||||
using Prism.Ioc;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
// ReSharper disable RedundantAttributeUsageProperty
|
||||
// ReSharper disable UnusedParameter.Local
|
||||
|
||||
[assembly: ChannelCodesModuleName]
|
||||
[assembly: ChannelCodesModuleImageAttribute]
|
||||
namespace ChannelCodes
|
||||
{
|
||||
[Export(typeof(IModule))]
|
||||
[Module(ModuleName = "ChannelCodesModule")]
|
||||
public class ChannelCodesModule : IModule
|
||||
{
|
||||
/// <summary>
|
||||
/// Injected unity container
|
||||
/// </summary>
|
||||
private readonly IUnityContainer _unityContainer;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ChannelCodesModule"/> class.
|
||||
/// </summary>
|
||||
/// <param name="unityContainer">Obtained reference of the unity container by using dependency injection.</param>
|
||||
public ChannelCodesModule(IUnityContainer unityContainer)
|
||||
{
|
||||
_unityContainer = unityContainer;
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
// Register View & View-Model with Unity dependency injection container as a singleton.
|
||||
_unityContainer.RegisterType<IChannelCodesListViewModel, ChannelCodesListViewModel>();
|
||||
_unityContainer.RegisterType<IChannelCodesListView, ChannelCodesListView>();
|
||||
|
||||
}
|
||||
|
||||
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 ChannelCodesModuleNameAttribute : TextAttribute
|
||||
{
|
||||
public ChannelCodesModuleNameAttribute() : this(null) { }
|
||||
|
||||
public ChannelCodesModuleNameAttribute(string s)
|
||||
{
|
||||
AssemblyName = AssemblyNames.ChannelCodes.ToString();
|
||||
}
|
||||
|
||||
public override string AssemblyName { get; }
|
||||
|
||||
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 SummaryModule available components
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)]
|
||||
public class ChannelCodesModuleImageAttribute : ImageAttribute
|
||||
{
|
||||
private BitmapImage _img;
|
||||
|
||||
public ChannelCodesModuleImageAttribute() : this(null) { }
|
||||
public override BitmapImage AssemblyImage
|
||||
{
|
||||
get { _img = AssemblyInfo.GetImage(AssemblyNames.ChannelCodes.ToString()); return _img; }
|
||||
}
|
||||
public ChannelCodesModuleImageAttribute(string s)
|
||||
{
|
||||
_img = AssemblyInfo.GetImage(AssemblyNames.ChannelCodes.ToString());
|
||||
}
|
||||
|
||||
public override Type GetAttributeType()
|
||||
{
|
||||
return typeof(ImageAttribute);
|
||||
}
|
||||
public override BitmapImage GetAssemblyImage()
|
||||
{
|
||||
return AssemblyImage;
|
||||
}
|
||||
private string _name;
|
||||
public override string AssemblyName
|
||||
{
|
||||
get { _name = AssemblyNames.ChannelCodes.ToString(); return _name; }
|
||||
}
|
||||
|
||||
public override string GetAssemblyName()
|
||||
{
|
||||
return AssemblyName;
|
||||
}
|
||||
private string _group;
|
||||
public override string AssemblyGroup
|
||||
{
|
||||
get { _group = eAssemblyGroups.Prepare.ToString(); return _group; }
|
||||
}
|
||||
|
||||
public override string GetAssemblyGroup()
|
||||
{
|
||||
return AssemblyGroup;
|
||||
}
|
||||
|
||||
private eAssemblyRegion _region;
|
||||
public override eAssemblyRegion AssemblyRegion
|
||||
{
|
||||
get { _region = eAssemblyRegion.ChannelCodesRegion; return _region; }
|
||||
}
|
||||
public override eAssemblyRegion GetAssemblyRegion()
|
||||
{
|
||||
return AssemblyRegion;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using DTS.Common.Storage;
|
||||
|
||||
namespace ChannelCodes.Model
|
||||
{
|
||||
public abstract class ChannelCodeType
|
||||
{
|
||||
/// <summary>
|
||||
/// retrieves all possible channel code types
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static IDictionary<short, string> GetChannelCodeTypeLookup()
|
||||
{
|
||||
var lookup = new Dictionary<short, string>();
|
||||
using (var cmd = DbOperations.GetSQLCommand(true))
|
||||
{
|
||||
try
|
||||
{
|
||||
cmd.CommandType = CommandType.StoredProcedure;
|
||||
cmd.CommandText = @"sp_ChannelCodeTypeGet";
|
||||
cmd.Parameters.Add(new SqlParameter("@Id", SqlDbType.TinyInt) { Value = null });
|
||||
cmd.Parameters.Add(new SqlParameter("@CodeType", SqlDbType.NVarChar, 50) { Value = null });
|
||||
|
||||
var reader = cmd.ExecuteReader();
|
||||
|
||||
while (reader.Read())
|
||||
{
|
||||
var id = Convert.ToInt16(reader["Id"]);
|
||||
var codeType = (string)reader["CodeType"];
|
||||
lookup[id] = codeType;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
cmd.Connection.Dispose();
|
||||
}
|
||||
}
|
||||
return lookup;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="All" xml:space="preserve">
|
||||
<value>All</value>
|
||||
</data>
|
||||
<data name="ChannelCode" xml:space="preserve">
|
||||
<value>Channel code</value>
|
||||
</data>
|
||||
<data name="ChannelType" xml:space="preserve">
|
||||
<value>Type</value>
|
||||
</data>
|
||||
<data name="DisplayName" xml:space="preserve">
|
||||
<value>Display name</value>
|
||||
</data>
|
||||
<data name="InvalidLine" xml:space="preserve">
|
||||
<value>Invalid pasted channel code, line: {0}</value>
|
||||
</data>
|
||||
<data name="ISO" xml:space="preserve">
|
||||
<value>ISO 13499</value>
|
||||
</data>
|
||||
<data name="ISOChannelName" xml:space="preserve">
|
||||
<value>ISO 13499 channel name</value>
|
||||
</data>
|
||||
<data name="ISOCode" xml:space="preserve">
|
||||
<value>ISO 13499 code</value>
|
||||
</data>
|
||||
<data name="ISOConflict" xml:space="preserve">
|
||||
<value>Warning: {0} has an ISO code that is not unique</value>
|
||||
</data>
|
||||
<data name="MissingISOChannelName" xml:space="preserve">
|
||||
<value>Error: {0} missing ISO channel name</value>
|
||||
</data>
|
||||
<data name="MissingISOCode" xml:space="preserve">
|
||||
<value>Error: {0} is missing an ISO code</value>
|
||||
</data>
|
||||
<data name="MissingUserChannelName" xml:space="preserve">
|
||||
<value>Error: {0} is missing a user channel name</value>
|
||||
</data>
|
||||
<data name="MissingUserCode" xml:space="preserve">
|
||||
<value>Error: {0} is missing a user code</value>
|
||||
</data>
|
||||
<data name="Remove" xml:space="preserve">
|
||||
<value>Remove</value>
|
||||
</data>
|
||||
<data name="User" xml:space="preserve">
|
||||
<value>User</value>
|
||||
</data>
|
||||
<data name="UserChannelName" xml:space="preserve">
|
||||
<value>User channel name</value>
|
||||
</data>
|
||||
<data name="UserCode" xml:space="preserve">
|
||||
<value>User code</value>
|
||||
</data>
|
||||
<data name="UserConflict" xml:space="preserve">
|
||||
<value>There are multiple entries with the same user code and channel name</value>
|
||||
</data>
|
||||
<data name="DuplicateISOChannelName" xml:space="preserve">
|
||||
<value>Error: {0} does not have a unique ISO channel name</value>
|
||||
</data>
|
||||
<data name="DuplicateISOCode" xml:space="preserve">
|
||||
<value>Error: {0} does not have a unique ISO code</value>
|
||||
</data>
|
||||
<data name="DuplicateUserChannelName" xml:space="preserve">
|
||||
<value>Error: {0} does not have a unique user channel name</value>
|
||||
</data>
|
||||
<data name="DuplicateUserCode" xml:space="preserve">
|
||||
<value>Warning: {0} does not have a unique user code</value>
|
||||
</data>
|
||||
<data name="DuplicateISOChannelCode" xml:space="preserve">
|
||||
<value>Error: ISO channel {0} is duplicated</value>
|
||||
</data>
|
||||
<data name="DuplicateUserChannelCode" xml:space="preserve">
|
||||
<value>Error: User channel {0} is duplicated</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -0,0 +1,279 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using DTS.Common.Controls;
|
||||
using DTS.Common.Enums.Channels;
|
||||
using DTS.Common.Interface.Channels.ChannelCodes;
|
||||
using DTS.Common.Utils;
|
||||
|
||||
// ReSharper disable CheckNamespace
|
||||
|
||||
namespace ChannelCodes
|
||||
{
|
||||
/// <inheritdoc cref="IChannelCodesListView" />
|
||||
/// <summary>
|
||||
/// Interaction logic for ChannelCodesListView.xaml
|
||||
/// </summary>
|
||||
public partial class ChannelCodesListView : IChannelCodesListView
|
||||
{
|
||||
public ChannelCodesListView()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
private void GridViewColumnHeaderSearchable_OnSearch(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var searchTerm = (string)e.OriginalSource;
|
||||
var columnTag = (sender as GridViewColumnHeaderSearchable)?.Tag;
|
||||
var viewModel = (IChannelCodesListViewModel)DataContext;
|
||||
viewModel.Filter(columnTag, searchTerm);
|
||||
}
|
||||
//private void ChannelType_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
//{
|
||||
// if( e.RemovedItems.Count == 0) { return; }
|
||||
// if( !(DataContext is ChannelCodesListViewModel vm)) { return; }
|
||||
// if( !(((System.Windows.Controls.Control) e.Source).DataContext is IChannelCode channelCode)) { return; }
|
||||
|
||||
// vm.MarkModified(channelCode);
|
||||
//}
|
||||
private void GridViewColumnHeader_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var vm = (IChannelCodesListViewModel)DataContext;
|
||||
var columnTag = (sender as GridViewColumnHeaderSearchable)?.Tag ?? Utils.FindChild<GridViewColumnHeaderSearchable>((DependencyObject)e.OriginalSource, null)?.Tag;
|
||||
vm?.Sort(columnTag, true);
|
||||
}
|
||||
private void ChannelCodeTextBox_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
|
||||
{
|
||||
if (!(DataContext is ChannelCodesListViewModel vm)) { return; }
|
||||
if (!(((System.Windows.Controls.Control)e.Source).DataContext is IChannelCode channelCode)) { return; }
|
||||
|
||||
vm.MarkModified(channelCode);
|
||||
}
|
||||
|
||||
private void ChannelCodeTextBoxUser_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (!(DataContext is ChannelCodesListViewModel vm)) { return; }
|
||||
if (!(sender is Control control)) { return; }
|
||||
if (!(control.DataContext is IChannelCode channelCode)) { return; }
|
||||
var notUsed1 = new List<string>();
|
||||
var notUsed2 = new List<string>();
|
||||
vm.MarkModified(channelCode);
|
||||
vm.ValidateUser(ref notUsed1, ref notUsed2);
|
||||
}
|
||||
|
||||
private void ChannelCodeTextBoxIso_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (!(DataContext is ChannelCodesListViewModel vm)) { return; }
|
||||
if (!(sender is Control control)) { return; }
|
||||
if (!(control.DataContext is IChannelCode channelCode)) { return; }
|
||||
vm.MarkModified(channelCode);
|
||||
var notUsed1 = new List<string>();
|
||||
var notUsed2 = new List<string>();
|
||||
vm.ValidateISO(ref notUsed1, ref notUsed2);
|
||||
}
|
||||
|
||||
private void DisplayNameTextBox_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
|
||||
{
|
||||
if (!(DataContext is ChannelCodesListViewModel vm)) { return; }
|
||||
if (!(((System.Windows.Controls.Control)e.Source).DataContext is IChannelCode channelCode)) { return; }
|
||||
|
||||
vm.MarkModified(channelCode);
|
||||
}
|
||||
|
||||
private void DisplayNameTextBoxUser_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (!(DataContext is ChannelCodesListViewModel vm)) { return; }
|
||||
if (!(e.Source is TextBox textBox)) { return; }
|
||||
if (!(textBox.DataContext is IChannelCode channelCode)) { return; }
|
||||
|
||||
vm.MarkModified(channelCode);
|
||||
var notUsed1 = new List<string>();
|
||||
var notUsed2 = new List<string>();
|
||||
vm.ValidateUser(ref notUsed1, ref notUsed2);
|
||||
}
|
||||
|
||||
private void DisplayNameTextBoxIso_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
if (!(DataContext is ChannelCodesListViewModel vm)) { return; }
|
||||
if (!(e.Source is TextBox textBox)) { return; }
|
||||
if (!(textBox.DataContext is IChannelCode channelCode)) { return; }
|
||||
|
||||
vm.MarkModified(channelCode);
|
||||
var notUsed1 = new List<string>();
|
||||
var notUsed2 = new List<string>();
|
||||
vm.ValidateISO(ref notUsed1, ref notUsed2);
|
||||
}
|
||||
|
||||
private void ISO_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!(DataContext is ChannelCodesListViewModel vm)) { return; }
|
||||
|
||||
vm.ViewMode = ChannelCodesListViewModel.ViewModes.ISO;
|
||||
}
|
||||
|
||||
private void User_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!(DataContext is ChannelCodesListViewModel vm)) { return; }
|
||||
|
||||
vm.ViewMode = ChannelCodesListViewModel.ViewModes.User;
|
||||
}
|
||||
|
||||
private void ISOCodes_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!(DataContext is ChannelCodesListViewModel vm)) { return; }
|
||||
if (!(sender is ListView lv)) { return; }
|
||||
|
||||
var list = new List<IChannelCode>();
|
||||
foreach (var item in lv.SelectedItems)
|
||||
{
|
||||
if (!(item is IChannelCode code))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
list.Add(code);
|
||||
}
|
||||
vm.SetISOSelection(list.ToArray());
|
||||
}
|
||||
|
||||
private void UserCodes_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (!(DataContext is ChannelCodesListViewModel vm)) { return; }
|
||||
if (!(sender is ListView lv)) { return; }
|
||||
|
||||
var list = new List<IChannelCode>();
|
||||
foreach (var item in lv.SelectedItems)
|
||||
{
|
||||
if (!(item is IChannelCode code))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
list.Add(code);
|
||||
}
|
||||
vm.SetUserSelection(list.ToArray());
|
||||
}
|
||||
|
||||
private void ChannelCodeBuilder_OnChannelCodeSelected(object sender, string code, string name, ChannelEnumsAndConstants.ChannelCodeType codetype)
|
||||
{
|
||||
if (!(DataContext is ChannelCodesListViewModel viewModel)) { return; }
|
||||
|
||||
if (!(sender is Control control)) { return; }
|
||||
|
||||
if (!(control.DataContext is IChannelCode channelCode)) { return; }
|
||||
|
||||
channelCode.Code = code;
|
||||
if (string.IsNullOrWhiteSpace(channelCode.Name))
|
||||
{
|
||||
channelCode.Name = name;
|
||||
}
|
||||
viewModel.MarkModified(channelCode);
|
||||
}
|
||||
|
||||
private void ISOChannelCodesListView_PreviewMouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
var point = e.GetPosition(ISOChannelCodesListView);
|
||||
|
||||
//we have to do multiple hittests unfortunately, because borders and rectangles...
|
||||
var result = VisualTreeHelper.HitTest((UIElement)sender, point);
|
||||
if (null == result) { return; }
|
||||
if (!(result.VisualHit is UIElement element)) { return; }
|
||||
var result2 = ISOChannelCodesListView.InputHitTest(point);
|
||||
if (!(result2 is UIElement element2)) { return; }
|
||||
|
||||
//clicking on the bottom of the listview produces a scrollviewer, if we get that we can return
|
||||
if (element is ScrollViewer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var vm = (IChannelCodesListViewModel)DataContext;
|
||||
if (element is TextBlock tb)
|
||||
{
|
||||
if (tb.Text == ChannelCodes.Resources.StringResources.ISOCode) { vm?.Sort(ISOCodeColumnHeader.Tag, true); }
|
||||
if (tb.Text == ChannelCodes.Resources.StringResources.ISOChannelName) { vm?.Sort(ISOChannelNameColumnHeader.Tag, true); }
|
||||
return;
|
||||
}
|
||||
if (ISOCodeColumnHeader.IsDescendantOf(element) || ISOCodeColumnHeader.IsDescendantOf(element2))
|
||||
{
|
||||
vm?.Sort(ISOCodeColumnHeader.Tag, true);
|
||||
return;
|
||||
}
|
||||
if (ISOChannelNameColumnHeader.IsDescendantOf(element) || ISOChannelNameColumnHeader.IsDescendantOf(element2))
|
||||
{
|
||||
vm?.Sort(ISOChannelNameColumnHeader.Tag, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void UserChannelCodesListView_PreviewMouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
var point = e.GetPosition(UserChannelCodesListView);
|
||||
|
||||
//we have to do multiple hittests unfortunately, because borders and rectangles...
|
||||
var result = VisualTreeHelper.HitTest((UIElement)sender, point);
|
||||
if (null == result) { return; }
|
||||
if (!(result.VisualHit is UIElement element)) { return; }
|
||||
var result2 = UserChannelCodesListView.InputHitTest(point);
|
||||
if (!(result2 is UIElement element2)) { return; }
|
||||
|
||||
//clicking on the bottom of the listview produces a scrollviewer, if we get that we can return
|
||||
if (element is ScrollViewer)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var vm = (IChannelCodesListViewModel)DataContext;
|
||||
if (element is TextBlock tb)
|
||||
{
|
||||
if (tb.Text == ChannelCodes.Resources.StringResources.UserCode) { vm?.Sort(UserCodeColumnHeader.Tag, true); }
|
||||
if (tb.Text == ChannelCodes.Resources.StringResources.UserChannelName) { vm?.Sort(UserChannelNameColumnHeader.Tag, true); }
|
||||
return;
|
||||
}
|
||||
if (UserCodeColumnHeader.IsDescendantOf(element) || UserCodeColumnHeader.IsDescendantOf(element2))
|
||||
{
|
||||
vm?.Sort(UserCodeColumnHeader.Tag, true);
|
||||
return;
|
||||
}
|
||||
if (UserChannelNameColumnHeader.IsDescendantOf(element) || UserChannelNameColumnHeader.IsDescendantOf(element2))
|
||||
{
|
||||
vm?.Sort(UserChannelNameColumnHeader.Tag, true);
|
||||
}
|
||||
}
|
||||
|
||||
//FB 25725 ISO selection has been changed, update the iso selection
|
||||
private void DisplayNameTextBoxIso_SelectionChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!(DataContext is ChannelCodesListViewModel vm)) { return; }
|
||||
if (!(((Control)e.Source).DataContext is IChannelCode channelCode)) { return; }
|
||||
|
||||
vm.SetISOSelection(new List<IChannelCode> { channelCode }.ToArray());
|
||||
}
|
||||
|
||||
//FB 25725 ISO selection has been changed, update the iso selection
|
||||
private void ChannelCodeBuilder_SelectionChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!(DataContext is ChannelCodesListViewModel vm)) { return; }
|
||||
if (!(sender is Control control)) { return; }
|
||||
if (!(control.DataContext is IChannelCode channelCode)) { return; }
|
||||
|
||||
vm.SetISOSelection(new List<IChannelCode> { channelCode }.ToArray());
|
||||
}
|
||||
|
||||
//FB 25725 User code selection has been changed, update the user code selection
|
||||
private void DisplayNameTextBoxUser_SelectionChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!(DataContext is ChannelCodesListViewModel vm)) { return; }
|
||||
if (!(((Control)e.Source).DataContext is IChannelCode channelCode)) { return; }
|
||||
|
||||
vm.SetUserSelection(new List<IChannelCode> { channelCode }.ToArray());
|
||||
}
|
||||
|
||||
//FB 25725 User code selection has been changed, update the user code selection
|
||||
private void ChannelCodeTextBoxUser_SelectionChanged(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!(DataContext is ChannelCodesListViewModel vm)) { return; }
|
||||
if (!(sender is Control control)) { return; }
|
||||
if (!(control.DataContext is IChannelCode channelCode)) { return; }
|
||||
|
||||
vm.SetUserSelection(new List<IChannelCode> { channelCode }.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace ChannelCodes.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Windows.Markup;
|
||||
using ChannelCodes.Resources;
|
||||
|
||||
namespace ChannelCodes
|
||||
{
|
||||
[MarkupExtensionReturnType(typeof(string))]
|
||||
public class TranslateExtension : MarkupExtension
|
||||
{
|
||||
private readonly string _key;
|
||||
public TranslateExtension(string key) { _key = key; }
|
||||
|
||||
private const string NotFound = "#stringnotfound#";
|
||||
|
||||
public override object ProvideValue(IServiceProvider serviceProvider)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_key)) { return NotFound; }
|
||||
return StringResources.ResourceManager.GetString(_key) ?? NotFound + " " + _key;
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
DataPRO/Modules/Channels/ChannelCodes/.svn/wc.db
Normal file
BIN
DataPRO/Modules/Channels/ChannelCodes/.svn/wc.db
Normal file
Binary file not shown.
Reference in New Issue
Block a user