Revision f4f39ccb trunk/Pithos.Client.WPF/Preferences/PreferencesViewModel.cs
b/trunk/Pithos.Client.WPF/Preferences/PreferencesViewModel.cs | ||
---|---|---|
113 | 113 |
|
114 | 114 |
[ImportingConstructor] |
115 | 115 |
public PreferencesViewModel(IWindowManager windowManager, IEventAggregator events, ShellViewModel shell, PithosSettings settings) |
116 |
:this(windowManager,events,shell,settings,null) |
|
117 | 116 |
{ |
118 | 117 |
this.DisplayName = "Pithos+ Preferences"; |
119 |
} |
|
120 | 118 |
|
121 |
public PreferencesViewModel(IWindowManager windowManager, IEventAggregator events, ShellViewModel shell, PithosSettings settings, string currentTab) |
|
122 |
{ |
|
123 | 119 |
// ReSharper disable DoNotCallOverridableMethodsInConstructor |
124 | 120 |
//Caliburn.Micro uses DisplayName for the view's title |
125 | 121 |
DisplayName = "Pithos+ Preferences"; |
... | ... | |
132 | 128 |
|
133 | 129 |
Settings=settings; |
134 | 130 |
Accounts = new ObservableConcurrentCollection<AccountViewModel>(); |
135 |
if (settings.Accounts == null) |
|
136 |
{ |
|
137 |
settings.Accounts=new AccountsCollection(); |
|
138 |
settings.Save(); |
|
139 |
} |
|
140 |
var accountVMs = from account in settings.Accounts |
|
141 |
select new AccountViewModel(account); |
|
142 |
|
|
143 |
Accounts.AddFromEnumerable(accountVMs); |
|
131 |
|
|
144 | 132 |
|
145 | 133 |
var startupPath = Environment.GetFolderPath(Environment.SpecialFolder.Startup); |
146 | 134 |
_shortcutPath = Path.Combine(startupPath, "Pithos.lnk"); |
... | ... | |
148 | 136 |
|
149 | 137 |
StartOnSystemStartup = File.Exists(_shortcutPath); |
150 | 138 |
|
151 |
SelectedTab = currentTab; |
|
139 |
//SelectedTab = currentTab; |
|
140 |
} |
|
141 |
|
|
142 |
protected override void OnViewLoaded(object view) |
|
143 |
{ |
|
144 |
base.OnViewLoaded(view); |
|
145 |
Settings.Reload(); |
|
146 |
Accounts.Clear(); |
|
147 |
|
|
148 |
if (Settings.Accounts == null) |
|
149 |
{ |
|
150 |
Settings.Accounts = new AccountsCollection(); |
|
151 |
Settings.Save(); |
|
152 |
} |
|
153 |
var accountVMs = from account in Settings.Accounts |
|
154 |
select new AccountViewModel(account); |
|
155 |
|
|
156 |
Accounts.AddFromEnumerable(accountVMs); |
|
152 | 157 |
} |
153 | 158 |
|
154 | 159 |
private string _selectedTab="General"; |
... | ... | |
232 | 237 |
{ |
233 | 238 |
//var monitor = Shell.Monitors[CurrentAccount.AccountKey]; |
234 | 239 |
|
235 |
|
|
240 |
|
|
236 | 241 |
var model = new SelectiveSynchViewModel(_events,CurrentAccount.Account,CurrentAccount.ApiKey,false); |
237 | 242 |
if (_windowManager.ShowDialog(model) == true) |
238 | 243 |
{ |
Also available in: Unified diff