Changeset 8393


Ignore:
Timestamp:
Sep 28, 2019, 3:45:58 PM (2 years ago)
Author:
Sven Rech
Message:

New CrypAnalysisViewControl:

  • Loading themes from code to avoid problem with AssemblyInfo in CT2 build process.
  • Made label elements bindable (by adding them to "logical tree").
  • Added event handler for result list context menu (copying to clipboard) and item double click.
Location:
trunk/LibSource/CrypAnalysisViewControl
Files:
2 added
2 deleted
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LibSource/CrypAnalysisViewControl/CrypAnalysisViewControl.cs

    r8367 r8393  
    11using System;
    22using System.Collections.Generic;
     3using System.Linq;
    34using System.Windows;
    45using System.Windows.Controls;
     
    4142        public List<SectionControl> AdditionalSections { get; } = new List<SectionControl>();
    4243
    43         static CrypAnalysisViewControl()
     44        public CrypAnalysisViewControl()
    4445        {
    45             DefaultStyleKeyProperty.OverrideMetadata(typeof(CrypAnalysisViewControl), new FrameworkPropertyMetadata(typeof(CrypAnalysisViewControl)));
     46            string packUri = @"CrypAnalysisViewControl;component/Themes/Generic.xaml";
     47            var resourceDictionary = Application.LoadComponent(new Uri(packUri, UriKind.Relative)) as ResourceDictionary;
     48            Resources.MergedDictionaries.Add(resourceDictionary);
     49
     50            Loaded += CrypAnalysisViewControl_Loaded;
     51        }
     52
     53        private void CrypAnalysisViewControl_Loaded(object sender, RoutedEventArgs e)
     54        {
     55            //Add non-component children as logical children to enable binding:
     56            foreach (var element in ResultHeaderLabels.Union<object>(ResultProgressLabels).Union(AdditionalSections))
     57            {
     58                AddLogicalChild(element);
     59            }
    4660        }
    4761    }
  • trunk/LibSource/CrypAnalysisViewControl/CrypAnalysisViewControl.csproj

    r8371 r8393  
    6969  </ItemGroup>
    7070  <ItemGroup>
    71     <Compile Include="CrypAnalysisResultListView.xaml.cs">
    72       <DependentUpon>CrypAnalysisResultListView.xaml</DependentUpon>
    73     </Compile>
     71    <Compile Include="CrypAnalysisResultListView.cs" />
    7472    <Compile Include="CrypAnalysisViewControl.cs" />
     73    <Compile Include="ICrypAnalysisResultListEntry.cs" />
    7574    <Compile Include="Properties\AssemblyInfo.cs">
    7675      <SubType>Code</SubType>
     
    9089    <Compile Include="ViewLabel.cs" />
    9190    <EmbeddedResource Include="Properties\Resources.resx">
    92       <Generator>ResXFileCodeGenerator</Generator>
     91      <Generator>PublicResXFileCodeGenerator</Generator>
    9392      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
    9493    </EmbeddedResource>
     
    9998  </ItemGroup>
    10099  <ItemGroup>
    101     <Page Include="CrypAnalysisResultListView.xaml">
    102       <SubType>Designer</SubType>
    103       <Generator>MSBuild:Compile</Generator>
    104     </Page>
    105100    <Page Include="Themes\Generic.xaml">
    106101      <Generator>MSBuild:Compile</Generator>
  • trunk/LibSource/CrypAnalysisViewControl/Properties/AssemblyInfo.cs

    r8370 r8393  
    11using System.Reflection;
    22using System.Runtime.InteropServices;
    3 using System.Windows;
    43
    54[assembly: AssemblyTitle("CrypAnalysisViewControl")]
     
    1413[assembly: ComVisible(false)]
    1514
    16 [assembly:ThemeInfo(
    17     ResourceDictionaryLocation.None,
    18     ResourceDictionaryLocation.SourceAssembly
    19 )]
     15//Theme info cannot be set here because of constraints in CT2 build system. Components will load themes in code instead.
     16//[assembly:ThemeInfo(
     17//    ResourceDictionaryLocation.None,
     18//    ResourceDictionaryLocation.SourceAssembly
     19//)]
    2020
    2121[assembly: AssemblyVersion("1.0.0.0")]
  • trunk/LibSource/CrypAnalysisViewControl/Properties/Resources.Designer.cs

    r8367 r8393  
    2020    // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
    2121    // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
    22     [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
     22    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
    2323    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    2424    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    25     internal class Resources {
     25    public class Resources {
    2626       
    2727        private static global::System.Resources.ResourceManager resourceMan;
     
    3737        /// </summary>
    3838        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
    39         internal static global::System.Resources.ResourceManager ResourceManager {
     39        public static global::System.Resources.ResourceManager ResourceManager {
    4040            get {
    4141                if (object.ReferenceEquals(resourceMan, null)) {
     
    5252        /// </summary>
    5353        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
    54         internal static global::System.Globalization.CultureInfo Culture {
     54        public static global::System.Globalization.CultureInfo Culture {
    5555            get {
    5656                return resourceCulture;
     
    6464        ///   Sucht eine lokalisierte Zeichenfolge, die Copy all lines ähnelt.
    6565        /// </summary>
    66         internal static string Copy_all {
     66        public static string Copy_all {
    6767            get {
    6868                return ResourceManager.GetString("Copy_all", resourceCulture);
     
    7373        ///   Sucht eine lokalisierte Zeichenfolge, die Copy key ähnelt.
    7474        /// </summary>
    75         internal static string Copy_key {
     75        public static string Copy_key {
    7676            get {
    7777                return ResourceManager.GetString("Copy_key", resourceCulture);
     
    8282        ///   Sucht eine lokalisierte Zeichenfolge, die Copy selected line ähnelt.
    8383        /// </summary>
    84         internal static string Copy_line {
     84        public static string Copy_line {
    8585            get {
    8686                return ResourceManager.GetString("Copy_line", resourceCulture);
     
    9191        ///   Sucht eine lokalisierte Zeichenfolge, die Copy text ähnelt.
    9292        /// </summary>
    93         internal static string Copy_text {
     93        public static string Copy_text {
    9494            get {
    9595                return ResourceManager.GetString("Copy_text", resourceCulture);
     
    100100        ///   Sucht eine lokalisierte Zeichenfolge, die Copy value ähnelt.
    101101        /// </summary>
    102         internal static string Copy_value {
     102        public static string Copy_value {
    103103            get {
    104104                return ResourceManager.GetString("Copy_value", resourceCulture);
  • trunk/LibSource/CrypAnalysisViewControl/SectionControl.xaml.cs

    r8367 r8393  
    1 using System.Windows;
     1using System;
     2using System.Windows;
    23using System.Windows.Controls;
    34using System.Windows.Media;
     
    4243        public static readonly DependencyProperty IsSectionVisibleProperty = DependencyProperty.Register(
    4344          "IsSectionVisible", typeof(bool), typeof(SectionControl), new PropertyMetadata(true));
    44 
    45         static SectionControl()
    46         {
    47             DefaultStyleKeyProperty.OverrideMetadata(typeof(SectionControl), new FrameworkPropertyMetadata(typeof(SectionControl)));
    48         }
    4945    }
    5046}
  • trunk/LibSource/CrypAnalysisViewControl/SectionViewLabelsControl.cs

    r8367 r8393  
    11using System;
    2 using System.Windows;
    32using System.Windows.Controls;
    43
     
    76    public class SectionViewLabelsControl : ItemsControl
    87    {
    9         static SectionViewLabelsControl()
    10         {
    11             DefaultStyleKeyProperty.OverrideMetadata(typeof(SectionViewLabelsControl), new FrameworkPropertyMetadata(typeof(SectionViewLabelsControl)));
    12         }
    138    }
    149}
  • trunk/LibSource/CrypAnalysisViewControl/Themes/Generic.xaml

    r8367 r8393  
    22    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    33    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     4    xmlns:properties="clr-namespace:Cryptool.CrypAnalysisViewControl.Properties"
    45    xmlns:local="clr-namespace:Cryptool.CrypAnalysisViewControl">
    56
     
    101102        </Setter>
    102103    </Style>
     104
     105    <ContextMenu x:Key="ItemContextMenu">
     106        <MenuItem Header="{x:Static properties:Resources.Copy_value}" CommandParameter="{Binding}" Command="{x:Static local:CrypAnalysisResultListView.ClickContextMenuCopyValue}" />
     107        <MenuItem Header="{x:Static properties:Resources.Copy_key}" CommandParameter="{Binding}" Command="{x:Static local:CrypAnalysisResultListView.ClickContextMenuCopyKey}" />
     108        <MenuItem Header="{x:Static properties:Resources.Copy_text}" CommandParameter="{Binding}" Command="{x:Static local:CrypAnalysisResultListView.ClickContextMenuCopyText}" />
     109        <MenuItem Header="{x:Static properties:Resources.Copy_line}" CommandParameter="{Binding}" Command="{x:Static local:CrypAnalysisResultListView.ClickContextMenuCopyLine}" />
     110        <MenuItem Header="{x:Static properties:Resources.Copy_all}" CommandParameter="{Binding}" Command="{x:Static local:CrypAnalysisResultListView.ClickContextMenuCopyAll}" />
     111    </ContextMenu>
     112
     113    <Style TargetType="{x:Type ListViewItem}" x:Key="ListViewItemContainerStyle">
     114        <Setter Property="ContextMenu" Value="{StaticResource ItemContextMenu}"/>
     115    </Style>
     116
     117    <Style TargetType="{x:Type local:CrypAnalysisResultListView}">
     118        <Setter Property="Background" Value="Transparent" />
     119        <Setter Property="FontSize" Value="10" />
     120        <Setter Property="Height" Value="250" />
     121        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
     122        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
     123        <Setter Property="ItemContainerStyle" Value="{StaticResource ListViewItemContainerStyle}" />
     124    </Style>
    103125</ResourceDictionary>
  • trunk/LibSource/CrypAnalysisViewControl/ViewLabel.cs

    r8367 r8393  
    44namespace Cryptool.CrypAnalysisViewControl
    55{
    6     public class ViewLabel : DependencyObject
     6    public class ViewLabel : FrameworkContentElement
    77    {
    88        public string Caption
     
    2323        public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(
    2424          "Value", typeof(string), typeof(ViewLabel), new PropertyMetadata(""));
    25 
    26         public ViewLabel()
    27         {
    28         }
    2925    }
    3026}
Note: See TracChangeset for help on using the changeset viewer.