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