diff --git a/DeFRaG_Helper/Behaviors/ListBoxBehavior.cs b/DeFRaG_Helper/Behaviors/ListBoxBehavior.cs
new file mode 100644
index 0000000..5190779
--- /dev/null
+++ b/DeFRaG_Helper/Behaviors/ListBoxBehavior.cs
@@ -0,0 +1,47 @@
+using System.Collections;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace DeFRaG_Helper.Behaviors
+{
+ public static class ListBoxBehavior
+ {
+ public static readonly DependencyProperty BindableSelectedItemsProperty =
+ DependencyProperty.RegisterAttached("BindableSelectedItems", typeof(IList), typeof(ListBoxBehavior), new PropertyMetadata(null, OnBindableSelectedItemsChanged));
+
+ public static IList GetBindableSelectedItems(DependencyObject obj)
+ {
+ return (IList)obj.GetValue(BindableSelectedItemsProperty);
+ }
+
+ public static void SetBindableSelectedItems(DependencyObject obj, IList value)
+ {
+ obj.SetValue(BindableSelectedItemsProperty, value);
+ }
+
+ private static void OnBindableSelectedItemsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ if (d is ListBox listBox)
+ {
+ listBox.SelectionChanged -= ListBox_SelectionChanged;
+ listBox.SelectionChanged += ListBox_SelectionChanged;
+ }
+ }
+
+ private static void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if (sender is ListBox listBox)
+ {
+ IList selectedItems = GetBindableSelectedItems(listBox);
+ if (selectedItems != null)
+ {
+ selectedItems.Clear();
+ foreach (var item in listBox.SelectedItems)
+ {
+ selectedItems.Add(item);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/DeFRaG_Helper/Helpers/DbActions.cs b/DeFRaG_Helper/Helpers/DbActions.cs
index 2ecef4c..7f65a22 100644
--- a/DeFRaG_Helper/Helpers/DbActions.cs
+++ b/DeFRaG_Helper/Helpers/DbActions.cs
@@ -2,8 +2,12 @@
namespace DeFRaG_Helper
{
+ ///
+ /// This file is meant to do the complex database action when loading maps from the web
+ ///
internal class DbActions
{
+
//initialize dbqueue
private static DbActions _instance;
private static readonly object _lock = new object();
diff --git a/DeFRaG_Helper/Objects/Map.cs b/DeFRaG_Helper/Objects/Map.cs
index e54ab85..23fdb81 100644
--- a/DeFRaG_Helper/Objects/Map.cs
+++ b/DeFRaG_Helper/Objects/Map.cs
@@ -623,6 +623,22 @@ public ObservableCollection GenerateFunctionIcons()
return newFunctionIcons;
}
+
+ private List tags = new List();
+ public List Tags
+ {
+ get => tags;
+ set
+ {
+ if (tags != value)
+ {
+ tags = value;
+ OnPropertyChanged(nameof(Tags));
+ }
+ }
+ }
+
+
}
diff --git a/DeFRaG_Helper/UserControls/MapCardBig.xaml b/DeFRaG_Helper/UserControls/MapCardBig.xaml
index 81223d7..ae3d96c 100644
--- a/DeFRaG_Helper/UserControls/MapCardBig.xaml
+++ b/DeFRaG_Helper/UserControls/MapCardBig.xaml
@@ -248,8 +248,8 @@
Width="60" Height="60" Style="{StaticResource FavoriteCheckBoxStyle}" VerticalAlignment="Top" Margin="0,0,240,0"
Checked="FavoriteCheckBox_Checked" Unchecked="FavoriteCheckBox_Unchecked"/>
+
+
diff --git a/DeFRaG_Helper/UserControls/MapCardBig.xaml.cs b/DeFRaG_Helper/UserControls/MapCardBig.xaml.cs
index 94ffc38..c657bc0 100644
--- a/DeFRaG_Helper/UserControls/MapCardBig.xaml.cs
+++ b/DeFRaG_Helper/UserControls/MapCardBig.xaml.cs
@@ -11,6 +11,7 @@
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
+using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
@@ -25,11 +26,66 @@ public partial class MapCardBig : UserControl
public Map CurrentMap { get; set; }
public static readonly DependencyProperty IconsProperty = DependencyProperty.Register(
"Icons", typeof(IEnumerable), typeof(MapCardBig), new PropertyMetadata(null));
+
+ public ICommand OpenTagManagerCommand { get; }
+
+
public MapCardBig()
{
InitializeComponent();
//DataContext = MapViewModel.GetInstanceAsync().Result;
+ OpenTagManagerCommand = new RelayCommand(OpenTagManager);
+
}
+
+
+
+ private void OpenTagManager(object parameter)
+ {
+ if (parameter is Button triggerButton)
+ {
+ var map = triggerButton.DataContext as Map;
+ if (map != null)
+ {
+ var viewModel = new TagManagerViewModel(map);
+ var tagManager = new TagManager(viewModel);
+
+ var window = new Window
+ {
+ Content = tagManager,
+ Width = 400,
+ Height = 300,
+ Title = "Manage Tags",
+ WindowStyle = WindowStyle.None,
+ AllowsTransparency = true,
+ Background = new SolidColorBrush(Color.FromArgb(204, 17, 17, 17)) // 80% alpha and color #111
+ };
+
+ // Set the owner of the window to the main application window
+ window.Owner = Application.Current.MainWindow;
+
+ // Get the position of the button that triggered the popup
+ Point buttonPosition = triggerButton.PointToScreen(new Point(0, 0));
+ window.Left = buttonPosition.X;
+ window.Top = buttonPosition.Y;
+
+ // Handle Deactivated event to close the window
+ window.Deactivated += (s, e) => window.Close();
+
+ // Add fade-in animation
+ var fadeInAnimation = new DoubleAnimation(0, 1, TimeSpan.FromSeconds(0.3));
+ window.BeginAnimation(Window.OpacityProperty, fadeInAnimation);
+
+ window.Show();
+ }
+ }
+ }
+
+
+
+
+
+
public IEnumerable Icons
{
get { return (IEnumerable)GetValue(IconsProperty); }
diff --git a/DeFRaG_Helper/UserControls/TagManager.xaml b/DeFRaG_Helper/UserControls/TagManager.xaml
new file mode 100644
index 0000000..98fb316
--- /dev/null
+++ b/DeFRaG_Helper/UserControls/TagManager.xaml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/DeFRaG_Helper/UserControls/TagManager.xaml.cs b/DeFRaG_Helper/UserControls/TagManager.xaml.cs
new file mode 100644
index 0000000..3a5ac6c
--- /dev/null
+++ b/DeFRaG_Helper/UserControls/TagManager.xaml.cs
@@ -0,0 +1,24 @@
+using System.Windows.Controls;
+using System.Windows;
+using DeFRaG_Helper.ViewModels;
+
+namespace DeFRaG_Helper.UserControls
+{
+ public partial class TagManager : UserControl
+ {
+ public TagManager(TagManagerViewModel viewModel)
+ {
+ InitializeComponent();
+ DataContext = viewModel;
+
+ viewModel.RequestClose += (sender, e) =>
+ {
+ var window = Window.GetWindow(this);
+ if (window != null)
+ {
+ window.Close();
+ }
+ };
+ }
+ }
+}
diff --git a/DeFRaG_Helper/ViewModels/BaseViewModel.cs b/DeFRaG_Helper/ViewModels/BaseViewModel.cs
new file mode 100644
index 0000000..1eaa0e3
--- /dev/null
+++ b/DeFRaG_Helper/ViewModels/BaseViewModel.cs
@@ -0,0 +1,14 @@
+using System.ComponentModel;
+
+namespace DeFRaG_Helper.ViewModels
+{
+ public class BaseViewModel : INotifyPropertyChanged
+ {
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void OnPropertyChanged(string propertyName)
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+}
diff --git a/DeFRaG_Helper/ViewModels/MapViewModel.cs b/DeFRaG_Helper/ViewModels/MapViewModel.cs
index 54c31fa..f7c185a 100644
--- a/DeFRaG_Helper/ViewModels/MapViewModel.cs
+++ b/DeFRaG_Helper/ViewModels/MapViewModel.cs
@@ -500,12 +500,13 @@ private async Task> GetLastPlayedMaps()
return lastPlayedMaps;
}
- public async Task