Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
$ tree Engine/
Engine/
├── API
│ ├── IClientAPI.cs
│ ├── IClientAPICommand.cs
│ ├── IServerAPI.cs
│ ├── IServerAPICommand.cs
│ └── StandardAPI
│ ├── BaseCommand.cs
│ ├── ClientCommands
│ │ ├── ClientCommand.cs
│ │ ├── Files
│ │ │ ├── ClientFilePostedCommand.cs
│ │ │ ├── ClientPostedFileDeletedCommand.cs
│ │ │ ├── ClientReadFilePartCommand.cs
│ │ │ └── ClientWriteFilePartCommand.cs
│ │ ├── Messages
│ │ │ ├── ClientOutPrivateMessageCommand.cs
│ │ │ ├── ClientOutRoomMessageCommand.cs
│ │ │ └── ClientOutSystemMessageCommand.cs
│ │ ├── Others
│ │ │ ├── ClientEmptyCommand.cs
│ │ │ ├── ClientPingResponceCommand.cs
│ │ │ └── ClientReceiveUserOpenKeyCommand.cs
│ │ ├── P2P
│ │ │ ├── ClientConnectToP2PServiceCommand.cs
│ │ │ ├── ClientConnectToPeerCommand.cs
│ │ │ └── ClientWaitPeerConnectionCommand.cs
│ │ ├── Registrations
│ │ │ └── ClientRegistrationResponseCommand.cs
│ │ ├── Rooms
│ │ │ ├── ClientRoomClosedCommand.cs
│ │ │ ├── ClientRoomOpenedCommand.cs
│ │ │ └── ClientRoomRefreshedCommand.cs
│ │ └── Voice
│ │ └── ClientPlayVoiceCommand.cs
│ ├── ServerCommands
│ │ ├── BaseServerCommand.cs
│ │ ├── Files
│ │ │ ├── ServerAddFileToRoomCommand.cs
│ │ │ └── ServerRemoveFileFormRoomCommand.cs
│ │ ├── Messages
│ │ │ ├── ServerSendPrivateMessageCommand.cs
│ │ │ └── ServerSendRoomMessageCommand.cs
│ │ ├── Others
│ │ │ ├── ServerEmptyCommand.cs
│ │ │ ├── ServerGetUserOpenKeyCommand.cs
│ │ │ └── ServerPingRequestCommand.cs
│ │ ├── P2P
│ │ │ ├── ServerP2PConnectRequestCommand.cs
│ │ │ └── ServerP2PReadyAcceptCommand.cs
│ │ ├── Registrations
│ │ │ ├── ServerRegisterCommand.cs
│ │ │ └── ServerUnregisterCommand.cs
│ │ ├── Rooms
│ │ │ ├── ServerCreateRoomCommand.cs
│ │ │ ├── ServerDeleteRoomCommand.cs
│ │ │ ├── ServerExitFormRoomCommand.cs
│ │ │ ├── ServerInviteUsersCommand.cs
│ │ │ ├── ServerKickUsersCommand.cs
│ │ │ ├── ServerRefreshRoomCommand.cs
│ │ │ └── ServerSetRoomAdminCommand.cs
│ │ └── ServerCommand.cs
│ ├── StandardClientAPI.cs
│ └── StandardServerAPI.cs
├── Audio
│ ├── IPlayer.cs
│ ├── IRecorder.cs
│ └── OpenAL
│ ├── OpenALPlayer.cs
│ └── OpenALRecorder.cs
├── Containers
│ ├── RequestPair.cs
│ ├── WaitingCommandContainer.cs
│ └── WaitingPrivateMessage.cs
├── Engine.csproj
├── EventArgs
│ ├── AddressReceivedEventArgs.cs
│ ├── AsyncErrorEventArgs.cs
│ ├── ConnectEventArgs.cs
│ ├── DataReceivedEventArgs.cs
│ ├── DataSendedEventArgs.cs
│ ├── FileDownloadEventArgs.cs
│ ├── ReceiveMessageEventArgs.cs
│ ├── RecordedEventArgs.cs
│ ├── RegistrationEventArgs.cs
│ └── RoomEventArgs.cs
├── Exceptions
│ ├── ErrorCode.cs
│ └── ModelException.cs
├── Helpers
│ ├── Crypter.cs
│ └── Logger.cs
├── Model
│ ├── Client
│ │ ├── ClientContext.cs
│ │ └── ClientModel.cs
│ ├── Common
│ │ └── ModelContext.cs
│ ├── Entities
│ │ ├── DownloadingFile.cs
│ │ ├── FileDescription.cs
│ │ ├── PostedFile.cs
│ │ ├── Room.cs
│ │ ├── RoomType.cs
│ │ ├── SoundPack.cs
│ │ ├── User.cs
│ │ └── VoiceRoom.cs
│ └── Server
│ ├── ServerContext.cs
│ └── ServerModel.cs
├── Network
│ ├── AsyncClient.cs
│ ├── AsyncPeer.cs
│ ├── AsyncServer.cs
│ ├── Conections
│ │ ├── Connection.cs
│ │ ├── IConnection.cs
│ │ └── ServerConnection.cs
│ └── P2PService.cs
└── Properties
└── AssemblyInfo.cs
31 directories, 89 filesА они как и положено находятся в MessageViewModel.А вот здесь вы не правы, проценты у вас считаются в файле Engine/API/StandardAPI/ClientCommands/Files/ClientWriteFilePartCommand.cs#L71
downloadEventArgs.Progress = (int)((downloadingFile.WriteStream.Position * 100) / receivedContent.File.Size);
private void ClientDownloadProgress(object sender, FileDownloadEventArgs e)
{
roomViewModel.MainViewModel.Dispatcher.Invoke(new Action<FileDownloadEventArgs>(args =>
{
.....
if (args.Progress >= 100)
И куда, кстати, вы собрались привязываться если не установите DataContext view'y?
Вы смешиваете в кучу просто неструктурированный код и нормальный, модульный код, но без MVVM наворотов. в вашем случае вы имеете тривиальную задачу доставки сообщений. Ну, пяток классов я бы там накидал, показал на формах — MVVM там делать нечего.
На WPF можно писать под любую архитектуру
Я говорю, что привязки и шаблоны наиболее удобно использовать с MVVM
Как я писал свой чат