private void SendCommand_Execute(object o) { SendView sendView = new SendView() { Owner = mainView }; SendViewModel sendViewModel = new SendViewModel(sendView); sendView.DataContext = sendViewModel; if (sendView.ShowDialog() == true) { Thread createFSThread = new Thread(() => { xmlfs = new XMLFileSystem(); server.Action = Resource.CreateFileSystem; foreach (FSItem fsItem in sendViewModel.Items) { if (fsItem.Type == FSItemType.Folder) { xmlfs.AddFolder(fsItem.Path); } else { xmlfs.AddFile(fsItem.Path); } } xmlfs.Save("fs.xml", true); App.Current.Dispatcher.Invoke(new Action(() => { server.Send(new System.Net.IPEndPoint(System.Net.IPAddress.Parse(sendViewModel.Address), int.Parse(sendViewModel.Port)), xmlfs); })); }); createFSThread.Start(); } }
private void SendCommand_Execute(object o) { SendView sendView = new SendView() { Owner = mainView }; SendViewModel sendViewModel = new SendViewModel(sendView); sendView.DataContext = sendViewModel; if (sendView.ShowDialog() == true) { Thread createFSThread = new Thread(() => { xmlfs = new XMLFileSystem(); server.Action = Resource.CreateFileSystem; foreach (FSItem fsItem in sendViewModel.Items) { if (fsItem.Type == FSItemType.Folder) xmlfs.AddFolder(fsItem.Path); else xmlfs.AddFile(fsItem.Path); } xmlfs.Save("fs.xml", true); App.Current.Dispatcher.Invoke(new Action(() => { server.Send(new System.Net.IPEndPoint(System.Net.IPAddress.Parse(sendViewModel.Address), int.Parse(sendViewModel.Port)), xmlfs); })); }); createFSThread.Start(); } }