mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 18:11:27 -07:00
also moved server location info logic to the activity handler itself as i plan to also use it in an informational window accessible from the context menu
106 lines
3.4 KiB
C#
106 lines
3.4 KiB
C#
using System.Collections.ObjectModel;
|
|
using System.Windows.Input;
|
|
|
|
using CommunityToolkit.Mvvm.Input;
|
|
|
|
namespace Bloxstrap.UI.ViewModels.Menu
|
|
{
|
|
public class IntegrationsViewModel : NotifyPropertyChangedViewModel
|
|
{
|
|
public ICommand AddIntegrationCommand => new RelayCommand(AddIntegration);
|
|
public ICommand DeleteIntegrationCommand => new RelayCommand(DeleteIntegration);
|
|
|
|
private void AddIntegration()
|
|
{
|
|
CustomIntegrations.Add(new CustomIntegration()
|
|
{
|
|
Name = "New Integration"
|
|
});
|
|
|
|
SelectedCustomIntegrationIndex = CustomIntegrations.Count - 1;
|
|
|
|
OnPropertyChanged(nameof(SelectedCustomIntegrationIndex));
|
|
OnPropertyChanged(nameof(IsCustomIntegrationSelected));
|
|
}
|
|
|
|
private void DeleteIntegration()
|
|
{
|
|
if (SelectedCustomIntegration is null)
|
|
return;
|
|
|
|
CustomIntegrations.Remove(SelectedCustomIntegration);
|
|
|
|
if (CustomIntegrations.Count > 0)
|
|
{
|
|
SelectedCustomIntegrationIndex = CustomIntegrations.Count - 1;
|
|
OnPropertyChanged(nameof(SelectedCustomIntegrationIndex));
|
|
}
|
|
|
|
OnPropertyChanged(nameof(IsCustomIntegrationSelected));
|
|
}
|
|
|
|
public bool ActivityTrackingEnabled
|
|
{
|
|
get => App.Settings.Prop.EnableActivityTracking;
|
|
set
|
|
{
|
|
App.Settings.Prop.EnableActivityTracking = value;
|
|
|
|
if (!value)
|
|
{
|
|
ShowServerDetailsEnabled = value;
|
|
DiscordActivityEnabled = value;
|
|
DiscordActivityJoinEnabled = value;
|
|
|
|
OnPropertyChanged(nameof(ShowServerDetailsEnabled));
|
|
OnPropertyChanged(nameof(DiscordActivityEnabled));
|
|
OnPropertyChanged(nameof(DiscordActivityJoinEnabled));
|
|
}
|
|
}
|
|
}
|
|
|
|
public bool ShowServerDetailsEnabled
|
|
{
|
|
get => App.Settings.Prop.ShowServerDetails;
|
|
set => App.Settings.Prop.ShowServerDetails = value;
|
|
}
|
|
|
|
public bool DiscordActivityEnabled
|
|
{
|
|
get => App.Settings.Prop.UseDiscordRichPresence;
|
|
set
|
|
{
|
|
App.Settings.Prop.UseDiscordRichPresence = value;
|
|
|
|
if (!value)
|
|
{
|
|
DiscordActivityJoinEnabled = value;
|
|
OnPropertyChanged(nameof(DiscordActivityJoinEnabled));
|
|
}
|
|
}
|
|
}
|
|
|
|
public bool DiscordActivityJoinEnabled
|
|
{
|
|
get => !App.Settings.Prop.HideRPCButtons;
|
|
set => App.Settings.Prop.HideRPCButtons = !value;
|
|
}
|
|
|
|
public bool MultiInstanceLaunchingEnabled
|
|
{
|
|
get => App.Settings.Prop.MultiInstanceLaunching;
|
|
set => App.Settings.Prop.MultiInstanceLaunching = value;
|
|
}
|
|
|
|
public ObservableCollection<CustomIntegration> CustomIntegrations
|
|
{
|
|
get => App.Settings.Prop.CustomIntegrations;
|
|
set => App.Settings.Prop.CustomIntegrations = value;
|
|
}
|
|
|
|
public CustomIntegration? SelectedCustomIntegration { get; set; }
|
|
public int SelectedCustomIntegrationIndex { get; set; }
|
|
public bool IsCustomIntegrationSelected => SelectedCustomIntegration is not null;
|
|
}
|
|
}
|