public VisionViewModel(INavigationServiceFacade navigationServiceFacade, IIsolatedStorageServiceFacade isolatedStorageServiceFacade, IRelayServiceFacade relayServiceFacade) { if (navigationServiceFacade == null) throw new ArgumentNullException("navigationServiceFacade"); if (isolatedStorageServiceFacade == null) throw new ArgumentNullException("isolatedStorageServiceFacade"); if (relayServiceFacade == null) throw new ArgumentNullException("relayServiceFacade"); this.navigationServiceFacade = navigationServiceFacade; this.isolatedStorageServiceFacade = isolatedStorageServiceFacade; this.relayServiceFacade = relayServiceFacade; }
public MainViewModel(INavigationServiceFacade navigationServiceFacade, IIsolatedStorageServiceFacade isolatedStorageServiceFacade, IRelayServiceFacade relayServiceFacade) { if (navigationServiceFacade == null) throw new ArgumentNullException("navigationServiceFacade"); if (isolatedStorageServiceFacade == null) throw new ArgumentNullException("isolatedStorageServiceFacade"); if (relayServiceFacade == null) throw new ArgumentNullException("relayServiceFacade"); this.navigationServiceFacade = navigationServiceFacade; this.isolatedStorageServiceFacade = isolatedStorageServiceFacade; this.relayServiceFacade = relayServiceFacade; this.FavoriteModules = new ObservableCollection<ModuleModel>(); this.AvailableModules = new ObservableCollection<ModuleModel>(); this.LoadSettings(); this.LoadModules(); // Set connection info this.IsConnected = this.relayServiceFacade.Proxy.IsConnected; this.relayServiceFacade.Proxy.OnOpened += proxy => this.IsConnecting = false; this.relayServiceFacade.Proxy.OnClosed += proxy => this.IsConnecting = true; this.timer = new DispatcherTimer() {Interval = TimeSpan.FromSeconds(10)}; this.timer.Tick += (sender, args) => { this.IsConnecting = !this.relayServiceFacade.Proxy.IsConnected; // Show error message if got disconnected if (!this.IsConnected) { MessageBox.Show( "Couldn't connect to server. Check your internet connection...", "SyncUp", MessageBoxButton.OK); this.timer.Stop(); } }; this.timer.Start(); this.log.Info("View model created"); }
public LightsViewModel(INavigationServiceFacade navigationServiceFacade, IIsolatedStorageServiceFacade isolatedStorageServiceFacade, IRelayServiceFacade relayServiceFacade) { if (navigationServiceFacade == null) throw new ArgumentNullException("navigationServiceFacade"); if (isolatedStorageServiceFacade == null) throw new ArgumentNullException("isolatedStorageServiceFacade"); if (relayServiceFacade == null) throw new ArgumentNullException("relayServiceFacade"); this.navigationServiceFacade = navigationServiceFacade; this.isolatedStorageServiceFacade = isolatedStorageServiceFacade; this.relayServiceFacade = relayServiceFacade; // Set initial values this.Lights = new List<Light>(); this.IsLoadingLights = true; // Initiate first lights list request this.RefreshLightsListAsync(); }
public PlayViewModel(INavigationServiceFacade navigationServiceFacade, IIsolatedStorageServiceFacade isolatedStorageServiceFacade, IRelayServiceFacade relayServiceFacade) { if (navigationServiceFacade == null) throw new ArgumentNullException("navigationServiceFacade"); if (isolatedStorageServiceFacade == null) throw new ArgumentNullException("isolatedStorageServiceFacade"); if (relayServiceFacade == null) throw new ArgumentNullException("relayServiceFacade"); this.navigationServiceFacade = navigationServiceFacade; this.isolatedStorageServiceFacade = isolatedStorageServiceFacade; this.relayServiceFacade = relayServiceFacade; this.IsPlaying = false; this.IsShuffleEnabled = false; this.IsRepeatEnabled = false; this.SongName = "Unknown"; this.ArtistName = "Unknown"; this.SongLength = 0; this.SongPosition = 0; // TODO remove, only sample this.IsPlaying = false; this.IsShuffleEnabled = false; this.IsRepeatEnabled = false; this.SongName = "I Need A Dollar"; this.ArtistName = "Aloe Blacc"; this.SongLength = 258; this.SongPosition = 47; var timer = new DispatcherTimer() { Interval = TimeSpan.FromMilliseconds(1000) }; timer.Tick += (sender, args) => this.SongPosition++; timer.Start(); }