PageRenderTime 49ms CodeModel.GetById 24ms RepoModel.GetById 0ms 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. //===================================================================================
  17. using System.Windows;
  18. using System.Windows.Controls;
  19. using System.Windows.Media.Animation;
  20. using StockTraderRI.Resources;
  21. namespace StockTraderRI
  22. {
  23. public partial class Shell : UserControl, IShellView
  24. {
  25. private const int VisibleGridDefaultHeight = 5;
  26. public Shell()
  27. {
  28. InitializeComponent();
  29. }
  30. public void ShowView()
  31. {
  32. Application.Current.RootVisual = this;
  33. var story = (Storyboard)this.Resources[ResourceNames.EntryStoryboardName];
  34. story.Begin();
  35. }
  36. private void ActionControl_LayoutUpdated(object sender, System.EventArgs e)
  37. {
  38. Visibility newVisibility = (this.ActionControl.Content != null) ? Visibility.Visible : Visibility.Collapsed;
  39. if (this.ActionControl.Visibility != newVisibility)
  40. {
  41. this.ActionControl.Visibility = newVisibility;
  42. this.ActionRow.Height = new GridLength(newVisibility == Visibility.Visible ? VisibleGridDefaultHeight : 0, GridUnitType.Star);
  43. }
  44. }
  45. }
  46. }