public PinViewModel(BestVpnServerConnector connector, IEventAggregator eventAggregator, IAnalyticsManager appEventManager, double leftOffset, double topOffset, Country country) : base(eventAggregator) { this.LeftOffset = leftOffset; this.TopOffset = topOffset; this.Coutry = country; this.Width = 34.0; this.Height = 55.0; this._state = PinViewModel.Map(connector.GetState(country.get_Identifier())); this.PinClick = new RelayCommand(new Action(this.PinClickCommand)); this._connector = connector; this._appEventManager = appEventManager; this._connector.GeoServerConnectionStatusChanged += new ConnectionEventHandler <GeographicalServer>(this.AppStateChanged); this.PlaceTooltipRight(); this.PlaceTooltipBottom(); }
private void AppStateChanged(object sender, ConnectionChangedEventArgs <GeographicalServer> e) { if (this.Coutry.get_Identifier().Equals(e.Server.get_Country())) { this.State = PinViewModel.Map(e.State); return; } if (e.State != null) { if (e.State != 1) { this.State = PinStates.Dimmed; return; } } this.State = PinStates.Disconnected; }