public ClientViewModel() { fileManagerService = new FileWindowService(); Clients = new ObservableCollection <ClientInfo>(); ConnectedMessageQueue = new SnackbarMessageQueue(TimeSpan.FromMilliseconds(5000)); OpenFileManagerCommand = new RelayCommand <ClientInfo>(OpenFileManager); #if DEBUG if (DesignerProperties.GetIsInDesignMode(new DependencyObject())) { return; } #endif server = new PaceServer(); server.ClientConnected += Server_ClientConnected; server.ClientDisconnected += Server_ClientDisconnected; server.PacketChannel.RegisterHandler <GetSystemInfoResponsePacket>(HandleSystemInfo); server.Start(); }
public FileExplorerViewModel(PaceServer server, ClientInfo client) { Files = new ObservableCollection <FileSystemEntry>(); ForwardHistory = new Stack <FileSystemEntry>(); BackHistory = new Stack <FileSystemEntry>(); server.PacketChannel.RegisterHandler <GetDirectoryResponsePacket>(HandleGetDirectory); server.PacketChannel.RegisterHandler <GetDrivesResponsePacket>(HandleGetDrives); server.PacketChannel.RegisterHandler <NotifyStatusPacket>(HandleNotifyStatus); if (server.ConnectedClients.Count > 0) { client.Owner.SendPacket(new GetDirectoryRequestPacket(string.Empty)); client.Owner.SendPacket(new GetDrivesRequestPacket()); } Client = client; NavigateCommand = new RelayCommand <string>(Navigate); NavigateSelectedCommand = new RelayCommand <string>(NavigateSelected); NavigateUpCommand = new RelayCommand <string>(NavigateUp); NavigateForwardCommand = new RelayCommand <string>(NavigateForward); NavigateBackCommand = new RelayCommand <string>(NavigateBack); DeleteFileCommand = new RelayCommand <string>(DeleteFile); }
public FileExplorerViewModel(PaceServer server, ClientInfo client) { Files = new ObservableCollection <FileSystemEntry>(); server.PacketChannel.RegisterHandler <GetDirectoryResponsePacket>(HandleGetDirectory); if (server.ConnectedClients.Count > 0) { client.Owner.SendPacket(new GetDirectoryRequestPacket(string.Empty)); } Client = client; NavigateCommand = new RelayCommand <string>(Navigate); NavigateSelectedCommand = new RelayCommand <string>(NavigateSelected); }
public void ShowWindow(PaceServer server, ClientInfo client) { var window = new FileExplorerWindow(server, client); // TODO: Probably not an optimal place to put this in, remember to handle this somewhere else server.ClientDisconnected += (sender, args) => { if (args.Client == client.Owner) { Application.Current.Dispatcher.Invoke(() => { window.Close(); }); } }; window.Show(); }
public FileExplorerWindow(PaceServer server, ClientInfo client) { InitializeComponent(); DataContext = new FileExplorerViewModel(server, client); }