|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.ComponentModel;
using ManagedMAPI;
namespace NewMailNotification.ViewModel
{
class SettingsViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private ObservableCollection<StoreInfo> stores_;
public SettingsViewModel()
{
stores_ = new ObservableCollection<StoreInfo>(SessionSingleton.Instance.Session.GetMessageStores());
if (stores_.Count > 0)
SelectedStore = stores_[0];
OpenStore = new OpenCommand(this);
stores_.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(OnStoreCollectionChanged);
}
public ObservableCollection<StoreInfo> Stores { get { return stores_; } }
public StoreInfo SelectedStore
{
get;
set;
}
public OpenCommand OpenStore { get; private set; }
private void OnStoreCollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
NotifyPropertyChanged("Stores");
}
public void NotifyPropertyChanged(string PropertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(PropertyName));
}
public void NotifyStoreInfoPropertiesChanged()
{
foreach (StoreInfo si in Stores)
{
si.NotifyPropertiesChanged();
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Fred is a senior software developer who lives in Melbourne, Australia. In 1993, he started Programming using Visual C++, Visual Basic, Java, and Oracle Developer Tools. From 2003, He started with .Net using C#, and then expertise .Net development.
Fred is often working with software projects in different business domains based on different Microsoft Technologies like SQL-Server, C#, VC++, ASP.NET, ASP.Net MVC, WCF,WPF, Silverlight, .Net Core and Angular, although he also did some development works on IBM AS400.