changeset 115:4de4e7829319

Working code, need to tidy up layout
author stevenh7776
date Sun, 20 May 2012 15:50:37 +0100
parents e51a6af1c98d
children d3380f499575
files SSRS/SSRS.Services.DTO/ReportInfo.cs SSRS/SSRS.Services.DTO/SSRS.Services.DTO.csproj SSRS/SSRS/MainPage.xaml SSRS/SSRS/MainPage.xaml.cs SSRS/SSRS/Styles.xaml SSRS/SSRS/ViewModels/MainPageViewModel.cs
diffstat 6 files changed, 100 insertions(+), 128 deletions(-) [+]
line wrap: on
line diff
--- a/SSRS/SSRS.Services.DTO/ReportInfo.cs	Sat May 19 16:53:34 2012 +0100
+++ b/SSRS/SSRS.Services.DTO/ReportInfo.cs	Sun May 20 15:50:37 2012 +0100
@@ -8,8 +8,6 @@
         public IList<Parameter> Parameters { get; set; }
         public string Path { get; set; }
 
-        public ReportInfo() { }
-
         public static ReportInfo Create(string name, IList<Parameter> parameters, string path)
         {
             return new ReportInfo()
--- a/SSRS/SSRS.Services.DTO/SSRS.Services.DTO.csproj	Sat May 19 16:53:34 2012 +0100
+++ b/SSRS/SSRS.Services.DTO/SSRS.Services.DTO.csproj	Sun May 20 15:50:37 2012 +0100
@@ -33,9 +33,6 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
-    <!-- A reference to the entire .NET Framework is automatically included -->
-  </ItemGroup>
-  <ItemGroup>
     <Compile Include="Parameter.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="ReportExecutionRequest.cs" />
@@ -44,6 +41,9 @@
     <Compile Include="ReportsRequest.cs" />
     <Compile Include="ReportsResponse.cs" />
   </ItemGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+  </ItemGroup>
   <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.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/SSRS/SSRS/MainPage.xaml	Sat May 19 16:53:34 2012 +0100
+++ b/SSRS/SSRS/MainPage.xaml	Sun May 20 15:50:37 2012 +0100
@@ -111,66 +111,77 @@
             </VisualStateGroup>
         </VisualStateManager.VisualStateGroups>
         <Grid x:Name="SideMenu"
-              Width="257"
+              Width="300"
               Margin="0,0,0,51"
               HorizontalAlignment="Left">
             <Grid.Projection>
                 <PlaneProjection CenterOfRotationX="0" RotationY="-98" />
             </Grid.Projection>
-            <Rectangle Height="20"
-                       VerticalAlignment="Top"
-                       Fill="{StaticResource Highlight}" />
+            <toolkit:BusyIndicator Name="busyIndicator"
+                                   HorizontalAlignment="Center"
+                                   VerticalAlignment="Center"
+                                   IsBusy="{Binding IsBusy}">
+
+                <StackPanel Width="300" VerticalAlignment="Top">
+                    <Rectangle Height="20"
+                               VerticalAlignment="Top"
+                               Fill="{StaticResource Highlight}" />
 
-            <ListBox x:Name="ReportsListbox"
-                     ItemsSource="{Binding Reports}"
-                     ScrollViewer.HorizontalScrollBarVisibility="Disabled"
-                     SelectedItem="{Binding SelectedReport}">
-                <ListBox.ItemsPanel>
-                    <ItemsPanelTemplate>
-                        <toolkit:WrapPanel ItemHeight="100"
-                                           ItemWidth="100"
-                                           Orientation="Horizontal" />
-                    </ItemsPanelTemplate>
-                </ListBox.ItemsPanel>
-                <ListBox.ItemTemplate>
-                    <DataTemplate>
-                        <StackPanel Margin="20" HorizontalAlignment="Center">
-                            <Viewbox>
-                                <Grid x:Name="backgroundGrid"
-                                      Width="48"
-                                      Height="48">
-                                    <Rectangle x:Name="Rect" Fill="Orange" />
-                                    <sdk:Label HorizontalContentAlignment="Center"
-                                               Content="{Binding Name}"
-                                               FontFamily="Segoe UI"
-                                               FontSize="24"
-                                               Foreground="White" />
-                                </Grid>
-                            </Viewbox>
-                        </StackPanel>
-                    </DataTemplate>
-                </ListBox.ItemTemplate>
-            </ListBox>
+                    <ListBox x:Name="ReportsListbox"
+                             Height="400"
+                             ItemsSource="{Binding Reports}"
+                             ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+                             SelectedItem="{Binding SelectedReport,
+                                                    Mode=TwoWay}">
+                        <ListBox.ItemsPanel>
+                            <ItemsPanelTemplate>
+                                <toolkit:WrapPanel ItemHeight="100"
+                                                   ItemWidth="100"
+                                                   Orientation="Horizontal" />
+                            </ItemsPanelTemplate>
+                        </ListBox.ItemsPanel>
+                        <ListBox.ItemTemplate>
+                            <DataTemplate>
+                                <StackPanel Margin="10" HorizontalAlignment="Center">
+                                    <Viewbox>
+                                        <Grid x:Name="backgroundGrid"
+                                              Width="80"
+                                              Height="80">
+                                            <Rectangle x:Name="Rect" Fill="Orange" />
+                                            <sdk:Label HorizontalContentAlignment="Center"
+                                                       Content="{Binding Name}"
+                                                       FontFamily="Segoe UI"
+                                                       FontSize="20"
+                                                       Foreground="White" />
+                                        </Grid>
+                                    </Viewbox>
+                                </StackPanel>
+                            </DataTemplate>
+                        </ListBox.ItemTemplate>
+                    </ListBox>
 
-            <Button x:Name="WhatsThis"
-                    Width="110"
-                    Height="110"
-                    Margin="0,0,0,69"
-                    HorizontalAlignment="Right"
-                    VerticalAlignment="Bottom"
-                    Style="{StaticResource TileIcon_Btn}"
-                    Tag="What's This">
-                <i:Interaction.Triggers>
-                    <i:EventTrigger EventName="Click">
-                        <ei:GoToStateAction StateName="Page2" />
-                    </i:EventTrigger>
-                </i:Interaction.Triggers>
-            </Button>
+                    <Button x:Name="WhatsThis"
+                            Width="100"
+                            Height="40"
+                            Margin="20"
+                            HorizontalAlignment="Right"
+                            VerticalAlignment="Bottom"
+                            Style="{StaticResource TileIcon_Btn}"
+                            Tag="What's This">
+                        <i:Interaction.Triggers>
+                            <i:EventTrigger EventName="Click">
+                                <ei:GoToStateAction StateName="Page2" />
+                            </i:EventTrigger>
+                        </i:Interaction.Triggers>
+                    </Button>
+                </StackPanel>
+            </toolkit:BusyIndicator>
         </Grid>
+
         <TextBlock x:Name="HeaderText"
                    Width="309"
                    Height="119"
-                   Margin="0,29,-408,0"
+                   Margin="0,0,-408,0"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Top"
                    FontSize="96"
@@ -186,13 +197,13 @@
         <TextBlock x:Name="HeaderSubText"
                    Width="300"
                    Height="32"
-                   Margin="0,140,-402,0"
+                   Margin="0,130,-402,0"
                    HorizontalAlignment="Right"
                    VerticalAlignment="Top"
                    FontSize="16"
                    Foreground="{StaticResource DarkGray}"
                    RenderTransformOrigin="0.5,0.5"
-                   Text="Report Name Here"
+                   Text="{Binding Path=SelectedReport.Name}"
                    TextWrapping="Wrap">
             <TextBlock.RenderTransform>
                 <CompositeTransform />
@@ -240,8 +251,8 @@
                     </ItemsControl.ItemTemplate>
                 </ItemsControl>
                 <Button x:Name="SmallButton"
-                        Width="111"
-                        Height="30"
+                        Width="100"
+                        Height="40"
                         Margin="0,0,0,92"
                         HorizontalAlignment="Right"
                         VerticalAlignment="Bottom"
@@ -272,7 +283,7 @@
                         Orientation="Horizontal">
                 <HyperlinkButton Margin="20,0,0,0"
                                  VerticalAlignment="Center"
-                                 Content="StevenHollidge.com"
+                                 Content="stevenhollidge.com"
                                  NavigateUri="http://www.stevenhollidge.com"
                                  Style="{StaticResource HyperlinkButtonStyle1}" />
             </StackPanel>
@@ -305,15 +316,14 @@
                 <CompositeTransform />
             </Grid.RenderTransform>
             <TextBlock Width="524"
-                       Margin="333,35,0,0"
+                       Margin="333,140,0,0"
                        HorizontalAlignment="Left"
                        FontSize="16"
                        Foreground="{StaticResource DarkGray}"
-                       TextWrapping="Wrap"><Run Text="Quick Metro demo for accessing SSRS reports from Silverlight. " />
+                       Style="{StaticResource TextBlockStyle1}"
+                       TextWrapping="Wrap"><Run Text="Quick demo for accessing SSRS reports from Silverlight." />
                 <LineBreak /><Run />
-                <LineBreak /><Run Text="Their are various great libraries around for Metro UI on both Silverlight and WPF. " />
-                <LineBreak /><Run />
-                <LineBreak /><Run Text="If anyone is interested get in contact with me and we can talk through the options." />
+                <LineBreak /><Run Text="If anyone is interested get in contact with me via my blog." />
                 <LineBreak /><Run />
                 <LineBreak /><Run Text="Happy coding!" />
                 <LineBreak /><Run />
@@ -328,14 +338,14 @@
                        Text="About"
                        TextWrapping="Wrap" />
             <StackPanel x:Name="LinksStack"
-                        Width="210"
+                        Width="300"
                         Margin="0,138,0,158"
                         HorizontalAlignment="Left"
                         Orientation="Vertical">
                 <Button x:Name="HomePageLink"
                         Height="30"
                         Margin="0,0,0,10"
-                        Content="StevenHollidge.com"
+                        Content="stevenhollidge.com"
                         Style="{StaticResource TextArrow_Btn}">
                     <i:Interaction.Triggers>
                         <i:EventTrigger EventName="Click">
@@ -344,9 +354,10 @@
                     </i:Interaction.Triggers>
                 </Button>
                 <Button x:Name="BlogLink"
+                        Width="300"
                         Height="30"
                         Margin="0,0,0,10"
-                        Content="StevenHollidge.BlogSpot.com"
+                        Content="stevenhollidge.blogspot.com"
                         Style="{StaticResource TextArrow_Btn}">
                     <i:Interaction.Triggers>
                         <i:EventTrigger EventName="Click">
@@ -354,18 +365,8 @@
                         </i:EventTrigger>
                     </i:Interaction.Triggers>
                 </Button>
-                <Button x:Name="SilverbladeTechnologyLink"
-                        Height="30"
-                        Margin="0,0,0,10"
-                        Content="SilverbladeTechnology.com"
-                        Style="{StaticResource TextArrow_Btn}">
-                    <i:Interaction.Triggers>
-                        <i:EventTrigger EventName="Click">
-                            <ei:HyperlinkAction NavigateUri="http://silverbladetechnology.com" />
-                        </i:EventTrigger>
-                    </i:Interaction.Triggers>
-                </Button>
             </StackPanel>
         </Grid>
+
     </Grid>
 </UserControl>
\ No newline at end of file
--- a/SSRS/SSRS/MainPage.xaml.cs	Sat May 19 16:53:34 2012 +0100
+++ b/SSRS/SSRS/MainPage.xaml.cs	Sun May 20 15:50:37 2012 +0100
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Net;
-using SSRS.ViewModels;
-using ServiceStack.ServiceClient.Web;
+using SSRS.ViewModels;
 
 namespace SSRS
 {
@@ -13,28 +9,5 @@
             InitializeComponent();
             DataContext = new MainPageViewModel();
         }
-
-        //private void btnExcel_Click(object sender, System.Windows.RoutedEventArgs e)
-        //{
-        //    //var client = new WebClient();
-        //    //client.OpenReadAsync(new Uri("/services/Reports", UriKind.Relative));
-        //}
-
-        //private void btnPdf_Click(object sender, System.Windows.RoutedEventArgs e)
-        //{
-
-        //}
-
-        //public static string ReportServer { get { return "http://localhost/reportserver_sql2008"; } }
-
-        //public static string ReportPath { get { return ReportServer + "/"; } }
-
-        //protected static char[] pathSeparatorArray = { pathSeparator };
-        //public static char[] PathSeparatorArray { get { return pathSeparatorArray; } }
-
-        //protected static char pathSeparator = '/';
-        //protected static string pathSeparatorString = new string(pathSeparator, 1);
-        //public static string PathSeparatorString { get { return pathSeparatorString; } }
-
     }
 }
--- a/SSRS/SSRS/Styles.xaml	Sat May 19 16:53:34 2012 +0100
+++ b/SSRS/SSRS/Styles.xaml	Sun May 20 15:50:37 2012 +0100
@@ -58,9 +58,9 @@
                                 </LinearGradientBrush>
                             </Rectangle.Fill>
                         </Rectangle>
-                        <TextBlock Margin="10,0,0,10"
-                                   HorizontalAlignment="Left"
-                                   VerticalAlignment="Bottom"
+                        <TextBlock HorizontalAlignment="Center"
+                                   VerticalAlignment="Center"
+                                   Style="{StaticResource TextBlockStyle1}"
                                    Text="{TemplateBinding Tag}"
                                    TextWrapping="Wrap" />
                     </Grid>
--- a/SSRS/SSRS/ViewModels/MainPageViewModel.cs	Sat May 19 16:53:34 2012 +0100
+++ b/SSRS/SSRS/ViewModels/MainPageViewModel.cs	Sun May 20 15:50:37 2012 +0100
@@ -18,6 +18,8 @@
 
         public MainPageViewModel()
         {
+            IsBusy = true;
+
             Init();
             InitAndExecuteReportsService();
             InitAndExecuteReportExecutionService();
@@ -25,6 +27,7 @@
 
         private void Init()
         {
+            Reports = new ObservableCollection<ReportInfo>();
             Fields = new ObservableCollection<DynamicFormField>();
             SelectedExportFileTypes = ExportFileTypes[0];
 
@@ -69,9 +72,16 @@
 
                     var result = args.Response.Result;
                     if (result == null) return;
-                    Reports = new ObservableCollection<ReportInfo>(result);
+
+                    foreach (var reportInfo in result)
+                    {
+                        Reports.Add(reportInfo);
+                    }
+
                     if (Reports.Count > 0)
-                        SelectedReport = Reports[0];
+                        SelectedReport = Reports[1];
+
+                    IsBusy = false;
                 };
 
             client.Post("/reports", new ReportsRequest() {IncludeParameters = true});
@@ -99,7 +109,6 @@
                 var filename = string.Concat(SelectedReport.Name, ".", SelectedExportFileTypes);
                 userSettings.Add(filename, args.Response.Result);
             };
-
         }
 
         public string SelectedExportFileTypes { get; set; }
@@ -117,13 +126,14 @@
         public ObservableCollection<ReportInfo> Reports { get; set; }
 
         private ReportInfo selectedReport;
+
         public ReportInfo SelectedReport
         {
             get { return selectedReport; }
-            private set
+            set
             {
-                if (selectedReport == value) return; 
-                selectedReport = value; 
+                if (selectedReport == value) return;
+                selectedReport = value;
                 OnPropertyChanged("SelectedReport");
                 SetFields();
             }
@@ -148,7 +158,7 @@
         public bool IsBusy
         {
             get { return isBusy; }
-            private set 
+            set 
             { 
                 if (isBusy == value) 
                 return; isBusy = value; 
@@ -156,18 +166,8 @@
             }
         }
 
-        private ObservableCollection<DynamicFormField> fields;
-        public ObservableCollection<DynamicFormField> Fields
-        {
-            get { return fields; }
-            private set
-            {
-                if (fields == value) return; 
-                fields = value; 
-                OnPropertyChanged("Fields");
-            }
-        }
-
+        public ObservableCollection<DynamicFormField> Fields { get; set; }
+        
         private string errorText;
         public string ErrorText
         {