Jack 4d94fbf54f
All checks were successful
Build and push image / Build (push) Successful in 49s
i live in spain but the S is silent
2023-09-28 00:53:27 +01:00

54 lines
1.9 KiB
C#
Executable File

using ksBroadcastingNetwork;
using ksBroadcastingTestClient.Autopilot;
using ksBroadcastingTestClient.Broadcasting;
using ksBroadcastingTestClient.ClientConnections;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ksBroadcastingTestClient
{
public class MainViewModel : KSObservableObject
{
public int ActiveIndexPage { get => Get<int>(); set => Set(value); }
public ClientPanelViewModel ClientPanelVM { get; }
public BroadcastingViewModel BroadcastingVM { get; }
public AutopilotViewModel AutopilotVM { get; }
public SessionInfoViewModel SessionInfoVM { get; }
public ReplayControlViewModel ReplayVM { get; }
public KSRelayCommand OnCloseWindowCommand { get; }
public MainViewModel()
{
ClientPanelVM = new ClientPanelViewModel(OnClientConnected);
BroadcastingVM = new BroadcastingViewModel();
AutopilotVM = new AutopilotViewModel();
SessionInfoVM = new SessionInfoViewModel();
ReplayVM = new ReplayControlViewModel();
OnCloseWindowCommand = new KSRelayCommand(Shutdown);
}
public void OnClientConnected(ACCUdpRemoteClient newClient)
{
BroadcastingVM.RegisterNewClient(newClient);
AutopilotVM.RegisterNewClient(newClient);
SessionInfoVM.RegisterNewClient(newClient);
ReplayVM.RegisterNewClient(newClient);
// in case we are still on the first page and this was a realtime updating client,
// we can move on
if (newClient.MsRealtimeUpdateInterval > 0 && ActiveIndexPage == 0)
ActiveIndexPage = 1;
}
private void Shutdown(object obj = null)
{
ClientPanelVM.Shutdown();
}
}
}