c9e6ad4e731c8d30726e1334e241b99c37285cf7
[pithos-ms-client] / trunk%2FPithos.Client.WPF%2FShell%2FMiniStatusViewModel.cs
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.ComponentModel.Composition;
5 using System.Linq;
6 using System.Text;
7 using Caliburn.Micro;
8
9 namespace Pithos.Client.WPF.Shell
10 {
11     [Export(typeof(MiniStatusViewModel)),PartCreationPolicy(CreationPolicy.Shared)]    
12     public class MiniStatusViewModel:Screen
13     {
14         public override string DisplayName
15         {
16             get
17             {
18                 return "Pithos+ Status";
19             }
20             set
21             {
22                 base.DisplayName = value;
23             }
24         }
25         
26         public string Status
27         {
28             get { return Shell.StatusMessage; }
29         }
30
31         private ShellViewModel _shell;
32         public ShellViewModel Shell
33         {
34             get { return _shell; }
35             set
36             {
37                 _shell = value;
38                 _shell.PropertyChanged += OnParentChanged;
39             }
40         }
41
42         private void OnParentChanged(object sender, PropertyChangedEventArgs e)
43         {
44             if (e.PropertyName=="StatusMessage")
45                 NotifyOfPropertyChange(()=>Status);
46         }
47     }
48 }