changeset 36:c8c79f05d76f

WORKING VERSION! HIGH FIVE!
author adminsh@apollo
date Tue, 27 Mar 2012 18:33:44 +0100
parents 83c1f62d9370
children 3783cb9b371f
files Messaging/Common/Common.csproj Messaging/Common/Controls/MetroTile.cs Messaging/Common/Controls/MetroTileDiagram.cd Messaging/Common/Themes/Generic.xaml Messaging/Common/Themes/SecondaryStyle.xaml Messaging/Server/UI/MainWindow.xaml
diffstat 6 files changed, 159 insertions(+), 84 deletions(-) [+]
line wrap: on
line diff
--- a/Messaging/Common/Common.csproj	Tue Mar 27 16:15:45 2012 +0100
+++ b/Messaging/Common/Common.csproj	Tue Mar 27 18:33:44 2012 +0100
@@ -61,6 +61,10 @@
     <Compile Include="Xaml\XamlHelper.cs" />
   </ItemGroup>
   <ItemGroup>
+    <Page Include="Themes\SecondaryStyle.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
     <Page Include="Themes\Generic.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
@@ -97,6 +101,9 @@
     <Resource Include="Icons\settings.png" />
     <Resource Include="Icons\upload.png" />
   </ItemGroup>
+  <ItemGroup>
+    <None Include="Controls\MetroTileDiagram.cd" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
--- a/Messaging/Common/Controls/MetroTile.cs	Tue Mar 27 16:15:45 2012 +0100
+++ b/Messaging/Common/Controls/MetroTile.cs	Tue Mar 27 18:33:44 2012 +0100
@@ -1,18 +1,17 @@
-using System;
+using System.ComponentModel;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Input;
 using System.Windows.Media;
-using System.Windows.Media.Imaging;
 
 namespace Common.Controls
 {
     [TemplatePart(Name="PART_DISPLAY_ICON", Type=typeof(Image))]
     [TemplatePart(Name = "PART_DISPLAY_COUNT_CONTAINER", Type = typeof(TextBlock))]
     [TemplatePart(Name = "PART_DISPLAY_TITLE_CONTAINER", Type = typeof(TextBlock))]
-    public class MetroTile : UserControl
+    [Description("Represents a metro styled tile that displays an icon, a count and a title")]
+    public class MetroTile : Control
     {
-
         #region Constructor
         
         static MetroTile()
@@ -31,33 +30,30 @@
 
         #region DisplayIcon
 
-        /// <summary>
-        /// Icon for the tile
-        /// </summary>
         public static readonly DependencyProperty DisplayIconProperty =
             DependencyProperty.Register("DisplayIcon",
-                                        typeof(Image),
-                                        typeof(MetroTile),
+                                        typeof (ImageSource),
+                                        typeof (MetroTile),
                                         new PropertyMetadata(null));
 
-        public Image DisplayIcon
+        [Description("The icon displayed in the tile."), Category("Common Properties")]
+        public ImageSource DisplayIcon
         {
-            get { return (Image) this.GetValue(DisplayIconProperty); }
+            get { return (ImageSource)this.GetValue(DisplayIconProperty); }
             set { this.SetValue(DisplayIconProperty, value); }
         }
+
         #endregion
 
         #region DisplayCount
 
-        /// <summary>
-        /// Display count for the tile
-        /// </summary>
         public static readonly DependencyProperty DisplayCountProperty =
             DependencyProperty.Register("DisplayCount",
                                         typeof(int),
                                         typeof(MetroTile),
                                         new UIPropertyMetadata(0));
 
+        [Description("The count displayed in the tile."), Category("Common Properties")]
         public int DisplayCount
         {
             get { return (int)this.GetValue(DisplayCountProperty); }
@@ -67,10 +63,8 @@
         #endregion
 
         #region DisplayText
-
-        /// <summary>
-        /// Main Display text for the tile
-        /// </summary>
+        
+        [Description("The text displayed in the tile."), Category("Common Properties")]
         public static readonly DependencyProperty DisplayTextProperty =
             DependencyProperty.Register("DisplayText",
                                         typeof(string),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Messaging/Common/Controls/MetroTileDiagram.cd	Tue Mar 27 18:33:44 2012 +0100
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ClassDiagram MajorVersion="1" MinorVersion="1">
+  <Class Name="Common.Controls.MetroTile">
+    <Position X="5.75" Y="0.5" Width="2.75" />
+    <TypeIdentifier>
+      <HashCode>EAAhQAAACIAACEAAAAAAAAAAAAAACQBAAAAAQACAAAA=</HashCode>
+      <FileName>Controls\MetroTile.cs</FileName>
+    </TypeIdentifier>
+  </Class>
+  <Font Name="Segoe UI" Size="9" />
+</ClassDiagram>
\ No newline at end of file
--- a/Messaging/Common/Themes/Generic.xaml	Tue Mar 27 16:15:45 2012 +0100
+++ b/Messaging/Common/Themes/Generic.xaml	Tue Mar 27 18:33:44 2012 +0100
@@ -10,64 +10,60 @@
         <Setter Property="Template">
             <Setter.Value>
                 <ControlTemplate TargetType="{x:Type c:MetroTile}">
-                    <Grid Background="Black">
-
-                        <Grid.RowDefinitions>
-                            <RowDefinition Height="*" />
-                            <RowDefinition Height="*" />
-                            <RowDefinition Height="1.25*" />
-                        </Grid.RowDefinitions>
-
-                        <Grid.ColumnDefinitions>
-                            <ColumnDefinition Width="*" />
-                            <ColumnDefinition Width="*" />
-                        </Grid.ColumnDefinitions>
+                    <Border Background="{StaticResource MetroPurpleBrush}">
+                        <Grid Background="{Binding Path=Background, RelativeSource={RelativeSource TemplatedParent}}">
 
-                        <Image x:Name="PART_DISPLAY_ICON"
-                               Grid.Row="0"
-                               Grid.Column="0"
-                               Margin="10,10,0,0"
-                               HorizontalAlignment="Left"
-                               VerticalAlignment="Top"
-                               Source="{Binding Path=DisplayIcon,
-                                                RelativeSource={RelativeSource FindAncestor,
-                                                                               AncestorType=c:MetroTile,
-                                                                               AncestorLevel=1},
-                                                UpdateSourceTrigger=PropertyChanged}"
-                               Stretch="None" />
+                            <Grid.RowDefinitions>
+                                <RowDefinition Height="*" />
+                                <RowDefinition Height="*" />
+                                <RowDefinition Height="1.25*" />
+                            </Grid.RowDefinitions>
 
-                        <TextBlock x:Name="PART_DISPLAY_COUNT_CONTAINER"
-                                   Grid.Row="1"
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition Width="*" />
+                                <ColumnDefinition Width="*" />
+                            </Grid.ColumnDefinitions>
+
+                            <Image x:Name="PART_DISPLAY_ICON"
+                                   Grid.Row="0"
                                    Grid.Column="0"
-                                   Grid.ColumnSpan="2"
-                                   Margin="0,0,10,0"
-                                   HorizontalAlignment="Right"
-                                   FontSize="48"
-                                   Foreground="White"
-                                   Text="{Binding Path=DisplayCount,
-                                                  StringFormat=N0,
-                                                  RelativeSource={RelativeSource FindAncestor,
-                                                                                 AncestorType=c:MetroTile,
-                                                                                 AncestorLevel=1},
-                                                  UpdateSourceTrigger=PropertyChanged}" />
+                                   Margin="10,10,0,0"
+                                   HorizontalAlignment="Left"
+                                   VerticalAlignment="Top"
+                                   Source="{Binding Path=DisplayIcon,
+                                                    RelativeSource={RelativeSource TemplatedParent},
+                                                    UpdateSourceTrigger=PropertyChanged}"
+                                   Stretch="None" />
 
-                        <TextBlock x:Name="PART_DISPLAY_TITLE_CONTAINER"
-                                   Grid.Row="2"
-                                   Grid.RowSpan="2"
-                                   Grid.Column="0"
-                                   Grid.ColumnSpan="3"
-                                   Margin="10"
-                                   HorizontalAlignment="Right"
-                                   VerticalAlignment="Bottom"
-                                   FontSize="24"
-                                   Foreground="White"
-                                   Text="{Binding Path=DisplayText,
-                                                  RelativeSource={RelativeSource FindAncestor,
-                                                                                 AncestorType=c:MetroTile,
-                                                                                 AncestorLevel=1},
-                                                  UpdateSourceTrigger=PropertyChanged}"
-                                   TextWrapping="Wrap" />
-                    </Grid>
+                            <TextBlock x:Name="PART_DISPLAY_COUNT_CONTAINER"
+                                       Grid.Row="1"
+                                       Grid.Column="0"
+                                       Grid.ColumnSpan="2"
+                                       Margin="0,0,10,0"
+                                       HorizontalAlignment="Right"
+                                       FontSize="48"
+                                       Foreground="White"
+                                       Text="{Binding Path=DisplayCount,
+                                                      StringFormat=N0,
+                                                      RelativeSource={RelativeSource TemplatedParent},
+                                                      UpdateSourceTrigger=PropertyChanged}" />
+
+                            <TextBlock x:Name="PART_DISPLAY_TITLE_CONTAINER"
+                                       Grid.Row="2"
+                                       Grid.RowSpan="2"
+                                       Grid.Column="0"
+                                       Grid.ColumnSpan="3"
+                                       Margin="10"
+                                       HorizontalAlignment="Right"
+                                       VerticalAlignment="Bottom"
+                                       FontSize="24"
+                                       Foreground="White"
+                                       Text="{Binding Path=DisplayText,
+                                                      RelativeSource={RelativeSource TemplatedParent},
+                                                      UpdateSourceTrigger=PropertyChanged}"
+                                       TextWrapping="Wrap" />
+                        </Grid>
+                    </Border>
                 </ControlTemplate>
             </Setter.Value>
         </Setter>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Messaging/Common/Themes/SecondaryStyle.xaml	Tue Mar 27 18:33:44 2012 +0100
@@ -0,0 +1,73 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+                    xmlns:c="clr-namespace:Common.Controls">
+
+    <ResourceDictionary.MergedDictionaries>
+        <ResourceDictionary Source="/Elysium.Theme;component/Themes/SharedResources.xaml" />
+    </ResourceDictionary.MergedDictionaries>
+
+    <Style TargetType="{x:Type c:MetroTile}">
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type c:MetroTile}">
+                    <Border Background="{StaticResource MetroLightBlueBrush}">
+                        <Grid Background="{Binding Path=Background, RelativeSource={RelativeSource TemplatedParent}}">
+
+                            <Grid.RowDefinitions>
+                                <RowDefinition Height="*" />
+                                <RowDefinition Height="*" />
+                                <RowDefinition Height="1.25*" />
+                            </Grid.RowDefinitions>
+
+                            <Grid.ColumnDefinitions>
+                                <ColumnDefinition Width="*" />
+                                <ColumnDefinition Width="*" />
+                            </Grid.ColumnDefinitions>
+
+                            <TextBlock x:Name="PART_DISPLAY_TITLE_CONTAINER"
+                                       Grid.Row="0"
+                                       Grid.RowSpan="0"
+                                       Grid.Column="0"
+                                       Grid.ColumnSpan="2"
+                                       Margin="10"
+                                       HorizontalAlignment="Right"
+                                       VerticalAlignment="Bottom"
+                                       FontSize="10"
+                                       Foreground="White"
+                                       Text="{Binding Path=DisplayText,
+                                                      RelativeSource={RelativeSource TemplatedParent},
+                                                      UpdateSourceTrigger=PropertyChanged}"
+                                       TextWrapping="Wrap" />
+
+                            <Image x:Name="PART_DISPLAY_ICON"
+                                   Grid.Row="1"
+                                   Grid.Column="0"
+                                   Grid.ColumnSpan="2"
+                                   Margin="10,10,0,0"
+                                   HorizontalAlignment="Left"
+                                   VerticalAlignment="Top"
+                                   Source="{Binding Path=DisplayIcon,
+                                                    RelativeSource={RelativeSource TemplatedParent},
+                                                    UpdateSourceTrigger=PropertyChanged}"
+                                   Stretch="None" />
+
+                            <TextBlock x:Name="PART_DISPLAY_COUNT_CONTAINER"
+                                       Grid.Row="2"
+                                       Grid.Column="0"
+                                       Grid.ColumnSpan="2"
+                                       Margin="0,0,10,0"
+                                       HorizontalAlignment="Right"
+                                       FontSize="14"
+                                       Foreground="White"
+                                       Text="{Binding Path=DisplayCount,
+                                                      StringFormat=N0,
+                                                      RelativeSource={RelativeSource TemplatedParent},
+                                                      UpdateSourceTrigger=PropertyChanged}" />
+                        </Grid>
+                    </Border>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+
+</ResourceDictionary>
\ No newline at end of file
--- a/Messaging/Server/UI/MainWindow.xaml	Tue Mar 27 16:15:45 2012 +0100
+++ b/Messaging/Server/UI/MainWindow.xaml	Tue Mar 27 18:33:44 2012 +0100
@@ -11,11 +11,9 @@
               MinWidth="700"
               MinHeight="475"
               DataContext="{Binding MainWindowViewModel,
-                                    Source={StaticResource Locator}}">
+                                    Source={StaticResource Locator}}"
+              Icon="mail.ico">
 
-    <Window.Resources>
-        <Image x:Key="MailIcon" Source="mail.ico" />
-    </Window.Resources>
 
     <TabControl Margin="{Binding Source={x:Static metro:Parameters.Instance}, Path=BoldPadding, Mode=OneWay}">
         <TabItem Header="dashboard">
@@ -59,11 +57,10 @@
 
                 <c:MetroTile Grid.Row="1"
                              Grid.Column="0"
+                             Margin="10"
                              DisplayCount="{Binding MsmqEndPoint.DisplayCount}"
-                             DisplayIcon="{StaticResource Mail}"
+                             DisplayIcon="mail.ico"
                              DisplayText="{Binding MsmqEndPoint.DisplayText}"
-                             Margin="10"
-                             Foreground="White"
                              ToolTip="{Binding MsmqEndPoint.ToolTip}" />
 
 
@@ -72,9 +69,8 @@
                              Margin="10"
                              Background="{StaticResource MetroGreenBrush}"
                              DisplayCount="{Binding RabbitEndPoint.DisplayCount}"
-                             DisplayIcon="{StaticResource Mail}"
+                             DisplayIcon="mail.ico"
                              DisplayText="{Binding RabbitEndPoint.DisplayText}"
-                             Foreground="White"
                              ToolTip="{Binding RabbitEndPoint.ToolTip}" />
 
                 <c:MetroTile Grid.Row="1"
@@ -82,10 +78,8 @@
                              Margin="10"
                              Background="{StaticResource MetroOrangeBrush}"
                              DisplayCount="{Binding ZeroMqEndPoint.DisplayCount}"
-                             DisplayIcon="{StaticResource Mail}"
+                             DisplayIcon="mail.ico"
                              DisplayText="{Binding ZeroMqEndPoint.DisplayText}"
-                             Foreground="White"
-                             RenderTransformOrigin="0.5,0.5"
                              ToolTip="{Binding ZeroMqEndPoint.ToolTip}" />
 
                 <ScrollViewer Grid.Row="2"