public void HandlePropertiesChangedEvent(ContextPropertiesChangedEvent propertiesChangedEvent) { if (!propertiesChangedEvent.Key.Equals("selectedFile")) { return; } string filePath = propertiesChangedEvent.NewValue.ToString(); string fileExtansion = Path.GetExtension(filePath).ToUpper(); bool playButtonEnabled = fileExtansion.Equals(".MP3"); Application.Current.Dispatcher.Invoke( () => { ButtonPlay.IsEnabled = playButtonEnabled; menuItem.IsEnabled = playButtonEnabled; }); }
public void HandlePropertiesChangedEvent(ContextPropertiesChangedEvent propertiesChangedEvent) { if (!propertiesChangedEvent.Key.Equals(SelectFileAction.ActionContextKey)) { return; } string simpleFileName = FileHelper.GetFileName(propertiesChangedEvent.NewValue.ToString()); if (simpleFileName == null || simpleFileName.Equals("")) { simpleFileName = Properties.Resources.Text_Select_File_To_Upload; } Application.Current.Dispatcher.Invoke( () => { UploadButton.Content = simpleFileName; }); }
public void SetContextObject(string key, object value) { object oldValue = GetContextObject(key); ContextPropertiesChangedEvent contextPropertiesChangedEvent = new ContextPropertiesChangedEvent(key, oldValue, value); if (_contextData.ContainsKey(key)) { _contextData[key] = value; } else { _contextData.Add(key, value); } SimpleEventBus.GetDefaultEventBus().Post(contextPropertiesChangedEvent, TimeSpan.Zero); }