예제 #1
0
        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();
            }
        }
예제 #2
0
파일: MainViewModel.cs 프로젝트: sys27/SRF
        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();
            }
        }