Changeset 2772


Ignore:
Timestamp:
Feb 22, 2011, 6:40:12 AM (11 years ago)
Author:
matkovic
Message:

-WorkspaceManager_BinFunctionVisual: Added Several Features (not complete)

Location:
trunk/CrypPlugins/WorkspaceManager/View
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/WorkspaceManager/View/Base/Interfaces/IRouting.cs

    r2738 r2772  
    33using System.Linq;
    44using System.Text;
    5 using System.Drawing;
     5using System.Windows;
    66
    77namespace WorkspaceManager.View.Base.Interfaces
     
    99    interface IRouting
    1010    {
    11         public ObjectSize ObjectSize { get; set; }
    12         public Point Position { get; private set; }
    13         public Point[] RoutingPoints { get; }
     11        ObjectSize ObjectSize { get; }
     12        Point Position { get; set; }
     13        Point[] RoutingPoints{ get; }
    1414    }
    1515
  • trunk/CrypPlugins/WorkspaceManager/View/BinVisual/BinFunctionVisual.xaml

    r2738 r2772  
    1 <UserControl x:Class="WorkspaceManager.View.Bin.BinFunctionVisual"
     1<UserControl x:Class="WorkspaceManager.View.BinVisual.BinFunctionVisual"
    22             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    33             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     
    55             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    66             xmlns:converter="clr-namespace:WorkspaceManager.View.Converter"
     7             xmlns:state="clr-namespace:WorkspaceManager.View.Base"
     8             xmlns:local="clr-namespace:WorkspaceManager.View.BinVisual"
    79             mc:Ignorable="d"
    8              d:DesignHeight="300" d:DesignWidth="300">
     10             Width="200" Height="200"
     11             DataContext="{Binding RelativeSource={x:Static RelativeSource.Self}}">
    912    <UserControl.Resources>
    10         <ResourceDictionary>
    11             <ResourceDictionary.MergedDictionaries>
    12                 <ResourceDictionary Source="../Resource/Styles.xaml"/>
    13                 <ResourceDictionary Source="../Resource/Animations.xaml"/>
    14             </ResourceDictionary.MergedDictionaries>
    15         </ResourceDictionary>
     13
     14        <local:testconverter x:Key="testconverter"></local:testconverter>
     15
     16        <ControlTemplate x:Key="CtrlTemplate" TargetType="{x:Type Button}">
     17            <Border x:Name="Border" BorderThickness="1">
     18                <Image Source="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Tag.Source}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"></Image>
     19            </Border>
     20            <ControlTemplate.Triggers>
     21                <Trigger Property="IsMouseOver" Value="true">
     22                    <Setter Property="Background" Value="#55222222" TargetName="Border" />
     23                    <Setter Property="BorderBrush" Value="#aa222222" TargetName="Border" />
     24                </Trigger>
     25                <Trigger Property="IsPressed" Value="true">
     26                    <Setter Property="Background" Value="#77222222" TargetName="Border" />
     27                    <Setter Property="BorderBrush" Value="#cc222222" TargetName="Border" />
     28                </Trigger>
     29            </ControlTemplate.Triggers>
     30        </ControlTemplate>
     31
     32        <Style TargetType="{x:Type Button}" x:Key="ActionBasicStyle">
     33            <Setter Property="Height" Value="30"></Setter>
     34            <Setter Property="Width" Value="30"></Setter>
     35            <Setter Property="Template" Value="{StaticResource ResourceKey=CtrlTemplate}"></Setter>
     36        </Style>
     37
     38        <Style TargetType="{x:Type Button}" x:Key="OperationBasicStyle">
     39            <Setter Property="Height" Value="20"></Setter>
     40            <Setter Property="Width" Value="20"></Setter>
     41            <Setter Property="VerticalAlignment" Value="Bottom"></Setter>
     42            <Setter Property="HorizontalAlignment" Value="Left"></Setter>
     43            <Setter Property="Template" Value="{StaticResource ResourceKey=CtrlTemplate}"></Setter>
     44        </Style>
     45
     46        <Style TargetType="{x:Type Button}" x:Key="OperationMaxMinStyle">
     47            <Style.Triggers>
     48                <DataTrigger Binding="{Binding Path=State, Mode=OneWay}">
     49                    <DataTrigger.Value>
     50                        <state:BinFuctionState>Min</state:BinFuctionState>
     51                    </DataTrigger.Value>
     52                    <Setter Property="ToolTip" Value="Maximize"></Setter>
     53                    <Setter Property="Tag">
     54                        <Setter.Value>
     55                            <Image Source="/WorkspaceManager;component/View/Image/maxi.png" HorizontalAlignment="Center" SnapsToDevicePixels="True"></Image>
     56                        </Setter.Value>
     57                    </Setter>
     58                </DataTrigger>
     59            </Style.Triggers>
     60            <Setter Property="Tag">
     61                <Setter.Value>
     62                    <Image Source="/WorkspaceManager;component/View/Image/minimize.png" HorizontalAlignment="Center" SnapsToDevicePixels="True"></Image>
     63                </Setter.Value>
     64            </Setter>
     65            <Setter Property="ToolTip" Value="Minimize"></Setter>
     66            <Setter Property="Height" Value="20"></Setter>
     67            <Setter Property="Width" Value="20"></Setter>
     68            <Setter Property="VerticalAlignment" Value="Bottom"></Setter>
     69            <Setter Property="HorizontalAlignment" Value="Left"></Setter>
     70            <Setter Property="Template" Value="{StaticResource ResourceKey=CtrlTemplate}"></Setter>
     71        </Style>
     72
     73        <x:Array Type="{x:Type Button}" x:Key="Actions">
     74            <Button ToolTip="Settings" Style="{StaticResource ResourceKey=ActionBasicStyle}" Click="ActionHandler" Height="30" Width="30">
     75                <Button.Tag>
     76                    <Image Source="/WorkspaceManager;component/View/Image/setting.png" HorizontalAlignment="Center" SnapsToDevicePixels="True"></Image>
     77                </Button.Tag>
     78                <state:BinFuctionState>Setting</state:BinFuctionState>
     79            </Button>
     80
     81            <Button ToolTip="Log" Style="{StaticResource ResourceKey=ActionBasicStyle}" Click="ActionHandler" Height="30" Width="30">
     82                <Button.Tag>
     83                    <Image Source="/WorkspaceManager;component/View/Image/log.png" HorizontalAlignment="Center" SnapsToDevicePixels="True"></Image>
     84                </Button.Tag>
     85                <state:BinFuctionState>Log</state:BinFuctionState>
     86            </Button>
     87
     88            <Button ToolTip="Data" Style="{StaticResource ResourceKey=ActionBasicStyle}" Click="ActionHandler" Height="30" Width="30">
     89                <Button.Tag>
     90                    <Image Source="/WorkspaceManager;component/View/Image/data.png" HorizontalAlignment="Center" SnapsToDevicePixels="True"></Image>
     91                </Button.Tag>
     92                <state:BinFuctionState>Data</state:BinFuctionState>
     93            </Button>
     94
     95            <Button ToolTip="Presentation" Style="{StaticResource ResourceKey=ActionBasicStyle}" Click="ActionHandler" Height="30" Width="30">
     96                <Button.Tag>
     97                    <Image Source="/WorkspaceManager;component/View/Image/presentation.png" HorizontalAlignment="Center" SnapsToDevicePixels="True"></Image>
     98                </Button.Tag>
     99                <state:BinFuctionState>Presentation</state:BinFuctionState>
     100            </Button>
     101        </x:Array>
    16102
    17103        <x:Array Type="{x:Type Button}" x:Key="Operations">
    18             <Button Name="SettingButton" ToolTip="Settings" Style="{StaticResource ResourceKey=BottomBoxBtnStyle}" Height="30" Width="30" Click="OptionChooseHandler">
    19                 <Image Source="/WorkspaceManager;component/View/Image/setting.png" HorizontalAlignment="Center" SnapsToDevicePixels="True" Height="30" Width="30"></Image>
     104            <Button Style="{StaticResource ResourceKey=OperationBasicStyle}">
     105                <Image Source="/WorkspaceManager;component/View/Image/icm.png" HorizontalAlignment="Left" SnapsToDevicePixels="True"/>
    20106            </Button>
    21107
    22             <Button Name="LogButton" ToolTip="Notification" Style="{StaticResource ResourceKey=BottomBoxBtnStyle}" Height="30" Width="30" Click="OptionChooseHandler">
    23                 <Image Source="/WorkspaceManager;component/View/Image/log.png" HorizontalAlignment="Center" SnapsToDevicePixels="True" Height="30" Width="30"></Image>
     108            <Button Style="{StaticResource ResourceKey=OperationBasicStyle}">
     109                <Button.Tag>
     110                    <Image Source="/WorkspaceManager;component/View/Image/play.png" HorizontalAlignment="Left" SnapsToDevicePixels="True"/>
     111                </Button.Tag>
    24112            </Button>
    25113
    26             <Button Name="MaxButton" ToolTip="Full View" Style="{StaticResource ResourceKey=BottomBoxBtnStyle}" Height="30" Width="30" Visibility="{Binding Path=ViewState, Converter={StaticResource ResourceKey=ViewStateConverter}, ConverterParameter=Fullscreen}" Click="OptionChooseHandler">
    27                 <Image Source="/WorkspaceManager;component/View/Image/max.png" HorizontalAlignment="Center" SnapsToDevicePixels="True" Height="30" Width="30"></Image>
     114            <Button x:Name="MinMaxBtn" Style="{StaticResource ResourceKey=OperationMaxMinStyle}" Click="ActionHandler">
     115                <state:BinFuctionState>Min</state:BinFuctionState>
    28116            </Button>
    29117
    30             <Button Name="DataButton" ToolTip="Data" Style="{StaticResource ResourceKey=BottomBoxBtnStyle}" MouseEnter="SettingButton_MouseEnter" Height="30" Width="30" Click="OptionChooseHandler">
    31                 <Image Source="/WorkspaceManager;component/View/Image/data.png" HorizontalAlignment="Center" SnapsToDevicePixels="True" Height="30" Width="30">
    32                 </Image>
    33             </Button>
    34 
    35             <Button Name="PresentationButton" ToolTip="Presentation" Style="{StaticResource ResourceKey=BottomBoxBtnStyle}" Height="30" Width="30" Click="OptionChooseHandler">
    36                 <Image Source="/WorkspaceManager;component/View/Image/presentation.png" HorizontalAlignment="Center" SnapsToDevicePixels="True" Height="30" Width="30"></Image>
    37             </Button>
    38 
    39             <Button ToolTip="Minimize" Style="{StaticResource ResourceKey=BottomBoxBtnStyle}" MouseEnter="SettingButton_MouseEnter" Height="30" Width="30" Click="OptionChooseHandler">
    40                 <Image Source="/WorkspaceManager;component/View/Image/minimize.png" HorizontalAlignment="Center" SnapsToDevicePixels="True" Height="30" Width="30"/>
     118            <Button Style="{StaticResource ResourceKey=OperationBasicStyle}">
     119                <Button.Tag>
     120                    <Image Source="/WorkspaceManager;component/View/Image/delete.png" HorizontalAlignment="Center" SnapsToDevicePixels="True"/>
     121                </Button.Tag>
    41122            </Button>
    42123        </x:Array>
    43124    </UserControl.Resources>
    44125   
    45     <Grid>
    46            
     126    <Grid x:Name="Root">
     127        <!--##########Definitions##########-->
     128        <Grid.ColumnDefinitions>
     129            <ColumnDefinition Width="18"></ColumnDefinition>
     130            <ColumnDefinition Width="*"></ColumnDefinition>
     131            <ColumnDefinition Width="18"></ColumnDefinition>
     132        </Grid.ColumnDefinitions>
     133        <Grid.RowDefinitions>
     134            <RowDefinition Height="18"></RowDefinition>
     135            <RowDefinition Height="*"></RowDefinition>
     136            <RowDefinition Height="18"></RowDefinition>
     137        </Grid.RowDefinitions>
     138        <!--##########/Definitions##########-->
     139       
     140        <!--##########Docking Panels##########-->
     141        <StackPanel x:Name="West" Background="Black" Orientation="Vertical" HorizontalAlignment="Left" Width="18" Grid.Column="0" Grid.Row="1"></StackPanel>
     142        <StackPanel x:Name="East" Background="Black" Orientation="Vertical" HorizontalAlignment="Right" Width="18" Grid.Column="2" Grid.Row="1"></StackPanel>
     143        <StackPanel x:Name="North" Background="Black" Orientation="Horizontal" VerticalAlignment="Top" Height="18" Grid.Column="1" Grid.Row="0"></StackPanel>
     144        <StackPanel x:Name="South" Background="Black" Orientation="Horizontal" VerticalAlignment="Bottom" Height="18" Grid.Column="1" Grid.Row="2"></StackPanel>
     145        <!--##########/Docking Panels##########-->
     146
     147
     148        <!--####################################################-->
     149        <ItemsControl x:Name="OperationsItemsControl" ItemsSource="{StaticResource ResourceKey=Operations}">
     150            <ItemsControl.ItemsPanel>
     151                <ItemsPanelTemplate>
     152                    <StackPanel HorizontalAlignment="Left" Orientation="Horizontal"></StackPanel>
     153                </ItemsPanelTemplate>
     154            </ItemsControl.ItemsPanel>
     155        </ItemsControl>
     156        <ItemsControl x:Name="ActionsItemsControl" ItemsSource="{StaticResource ResourceKey=Actions}">
     157            <ItemsControl.ItemsPanel>
     158                <ItemsPanelTemplate>
     159                    <StackPanel HorizontalAlignment="Left" Orientation="Horizontal"></StackPanel>
     160                </ItemsPanelTemplate>
     161            </ItemsControl.ItemsPanel>
     162        </ItemsControl>
     163        <!--####################################################-->
    47164    </Grid>
    48165</UserControl>
  • trunk/CrypPlugins/WorkspaceManager/View/BinVisual/BinFunctionVisual.xaml.cs

    r2738 r2772  
    2929
    3030        #region IRouting
    31         private ObjectSize objectSize;
    3231        public ObjectSize ObjectSize
    3332        {
    3433            get
    3534            {
    36                 return objectSize;
    37             }
    38             set
    39             {
    40                 objectSize = value;
     35                return new ObjectSize(this.ActualWidth, this.ActualHeight);
    4136            }
    4237        }
     
    8176
    8277        #region DependencyProperties
    83         public static readonly DependencyProperty StateProperty = DependencyProperty.Register("ViewState",
    84             typeof(BinFuctionState), typeof(BinFunctionVisual), new FrameworkPropertyMetadata(BinFuctionState.Min));
     78        public static readonly DependencyProperty StateProperty = DependencyProperty.Register("State",
     79            typeof(BinFuctionState), typeof(BinFunctionVisual), new FrameworkPropertyMetadata(BinFuctionState.Presentation));
    8580
    8681        public BinFuctionState State
     
    9388            {
    9489                base.SetValue(StateProperty, value);
    95                 this.Model.BinState = value;
     90                //this.Model.BinState = value;
    9691            }
    9792        }
     
    10297            InitializeComponent();
    10398        }
     99
     100        #region Event Handler
     101        private void ActionHandler(object sender, RoutedEventArgs e)
     102        {
     103            Button b = (Button)sender;
     104            State = (BinFuctionState) b.Content;
     105        }
     106        #endregion
     107
     108    }
     109
     110    public class testconverter : IValueConverter
     111    {
     112        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
     113        {
     114            return null;
     115        }
     116
     117        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
     118        {
     119            throw new NotImplementedException();
     120        }
    104121    }
    105122}
Note: See TracChangeset for help on using the changeset viewer.