PageRenderTime 9ms CodeModel.GetById 2ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/V2/trunk/RI/Silverlight/StockTraderRI/Shell.xaml.cs

#
C# | 50 lines | 30 code | 4 blank | 16 comment | 4 complexity | 549c078a6fc36ecd819fd76d8e5e3584 MD5 | raw file
 1//===================================================================================
 2// Microsoft patterns & practices
 3// Composite Application Guidance for Windows Presentation Foundation and Silverlight
 4//===================================================================================
 5// Copyright (c) Microsoft Corporation.  All rights reserved.
 6// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
 7// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
 8// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 9// FITNESS FOR A PARTICULAR PURPOSE.
10//===================================================================================
11// The example companies, organizations, products, domain names,
12// e-mail addresses, logos, people, places, and events depicted
13// herein are fictitious.  No association with any real company,
14// organization, product, domain name, email address, logo, person,
15// places, or events is intended or should be inferred.
16//===================================================================================
17using System.Windows;
18using System.Windows.Controls;
19using System.Windows.Media.Animation;
20using StockTraderRI.Resources;
21
22namespace StockTraderRI
23{
24    public partial class Shell : UserControl, IShellView
25    {
26        private const int VisibleGridDefaultHeight = 5;
27
28        public Shell()
29        {
30            InitializeComponent();
31        }
32
33        public void ShowView()
34        {
35            Application.Current.RootVisual = this;
36            var story = (Storyboard)this.Resources[ResourceNames.EntryStoryboardName];
37            story.Begin();
38        }
39
40        private void ActionControl_LayoutUpdated(object sender, System.EventArgs e)
41        {
42            Visibility newVisibility = (this.ActionControl.Content != null) ? Visibility.Visible : Visibility.Collapsed;
43            if (this.ActionControl.Visibility != newVisibility)
44            {
45                this.ActionControl.Visibility = newVisibility;
46                this.ActionRow.Height = new GridLength(newVisibility == Visibility.Visible ? VisibleGridDefaultHeight : 0, GridUnitType.Star);
47            }
48        }
49    }
50}