BlackHole.Master.FileManagerWindow.OnEvent C# (CSharp) Method

OnEvent() public method

public OnEvent ( SlaveEvent ev ) : void
ev SlaveEvent
return void
        public override async void OnEvent(SlaveEvent ev)
        {
            base.OnEvent(ev);
            await this.ExecuteInDispatcher(() =>
            {
                switch ((SlaveEventType)ev.EventType)
                {
                    case SlaveEventType.IncommingMessage:
                    {
                        ev.Data.Match()
                            .With<FolderNavigationMessage>(m =>
                            {
                                TxtBoxDirectory.Text = m.Path;
                                ViewModelFiles.Items.Clear();
                                m.Files.ForEach(ViewModelFiles.AddItem);
                            })
                            .With<DownloadedFilePartMessage>(m =>
                            {
                                UpdateCommand(m, command =>
                                {
                                    command.Completed = m.CurrentPart >= m.TotalPart;
                                    command.UpdateProgression(m.CurrentPart + 1, m.TotalPart);
                                });
                            })
                            .With<UploadProgressMessage>(m =>
                            {
                                // will be received when the slave download the file
                                UpdateCommand(m, command =>
                                {
                                    command.Completed = m.Percentage == -1;
                                    if (!command.Completed)
                                        command.UpdateProgression(m.Percentage, 100);
                                });
                            })
                            .With<FileDeletionMessage>(m => NavigateToTypedFolder());
                        break;
                    }
                }
            });
        }
    }