public void OnColourBtnClick(Button btn) { if (SelectedAudioClip != null) { ResetColourButtonBorders(); switch (btn.Tag) { case "LightBlue": SelectedAudioClip.ButtonColour = ColourHelper.StatementColour; LightBlueSquare.BorderThickness = new Thickness(2); break; case "Beige": SelectedAudioClip.ButtonColour = ColourHelper.QuestionColour; BeigeSquare.BorderThickness = new Thickness(2); break; case "Orange": SelectedAudioClip.ButtonColour = ColourHelper.ActionColour; OrangeSquare.BorderThickness = new Thickness(2); break; case "LightGreen": SelectedAudioClip.ButtonColour = ColourHelper.ConditionColour; LightGreenSquare.BorderThickness = new Thickness(2); break; } ButtonColour = SelectedAudioClip.ButtonColour; AudioclipsView.Refresh(); } }
private void UpdateAudioClips() { // Order alphabetically AudioClips = new ObservableCollection <AudioClip>(AudioClipsMgr.AudioClips.OrderBy(AudioClip => AudioClip.Label)); AudioclipsView = CollectionViewSource.GetDefaultView(AudioClips); AudioclipsView.Filter = AudioClipsFilter; AudioclipsView.Refresh(); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(AudioClips))); }
private void RefreshAudioClips() { // Order alphabetically AudioClips = new ObservableCollection <AudioClip>(AudioClipsMgr.AudioClips .OrderBy(AudioClip => !AudioClip.IsVisible) .ThenBy(AudioClip => AudioClip.Label)); AudioclipsView = CollectionViewSource.GetDefaultView(AudioClips); AudioclipsView.Filter = AudioClipsFilter; AudioclipsView.Refresh(); }
private void RemoveAudioClips(object obj) { foreach (var btn in SelectedSessionClipButtons) { if (btn.DataContext != BindingOperations.DisconnectedSource) { btn.Background = (SolidColorBrush)(new BrushConverter().ConvertFrom(ColourHelper.GetBtnInverseColour(btn.Background.ToString()))); var sessionClip = SessionClips.Single(x => x.Label.Equals(btn.Content?.ToString())); SessionClips.Remove(sessionClip); AudioclipsView.Refresh(); } } }
private void DeleteMessageResponse(object sender, string e) { messageDialogWin.MessageResponse -= DeleteMessageResponse; if (e.Equals("Yes")) { SessionsMgr.DeleteClipFromAllSessions(SelectedAudioClip.ClipId); AudioClipsMgr.DeleteAudioClip(SelectedAudioClip.Label, out string outcome); RefreshAudioClips(); SelectedAudioClip = new AudioClip(); newAudioClip = true; AudioclipsView.Refresh(); Reset(); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(AudioClips))); EventSystem.Publish(new AudioClipsInventoryChanged()); } messageDialogWin.Close(); }