PageRenderTime 52ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/V2.2/trunk/RI/Desktop/StockTraderRI.Modules.News/Article/ArticleView.xaml.cs

#
C# | 77 lines | 51 code | 7 blank | 19 comment | 4 complexity | 3a4c1e2dfcedd9ef094e5076c3977b4f 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;
  18. using System.Windows;
  19. using System.Windows.Controls;
  20. using System.Windows.Media.Animation;
  21. namespace StockTraderRI.Modules.News.Article
  22. {
  23. /// <summary>
  24. /// Interaction logic for ArticleView.xaml
  25. /// </summary>
  26. public partial class ArticleView : UserControl, IArticleView
  27. {
  28. public ArticleView()
  29. {
  30. InitializeComponent();
  31. }
  32. public ArticlePresentationModel Model
  33. {
  34. get
  35. {
  36. return this.DataContext as ArticlePresentationModel;
  37. }
  38. set
  39. {
  40. this.DataContext = value;
  41. }
  42. }
  43. public event EventHandler<EventArgs> ShowNewsReader;
  44. private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
  45. {
  46. if (this.NewsList.SelectedItem != null)
  47. {
  48. var storyboard = (Storyboard)this.Resources["Details"];
  49. storyboard.Begin();
  50. }
  51. else
  52. {
  53. var storyboard = (Storyboard)this.Resources["List"];
  54. storyboard.Begin();
  55. }
  56. }
  57. private void BackButton_Click(object sender, RoutedEventArgs e)
  58. {
  59. this.Model.SelectedArticle = null;
  60. }
  61. private void OpenButton_Click(object sender, RoutedEventArgs e)
  62. {
  63. EventHandler<EventArgs> showNewsReaderHandler = this.ShowNewsReader;
  64. if (showNewsReaderHandler != null)
  65. {
  66. showNewsReaderHandler(this, EventArgs.Empty);
  67. }
  68. }
  69. }
  70. }