private void openThePublishedFiles(string selStr) { string selStrFP = System.IO.Path.GetFullPath(workingDir + "/" + selStr); if (File.Exists(selStrFP)) { if (browserRadio.IsChecked == true) { System.Diagnostics.Process.Start(selStrFP); } else { swin = new SelectionWindow(); swin.setMainWindow(this); swin.Show(); swin.Add(selStrFP); } } else { openOnce = true; CsEndPoint serverEndPoint = new CsEndPoint(); serverEndPoint.machineAddress = serverAddress; serverEndPoint.port = serverPort; CsMessage getConFileMsg = new CsMessage(); getConFileMsg.add("conFileName", selStr); getConFileMsg.add("to", CsEndPoint.toString(serverEndPoint)); getConFileMsg.add("from", CsEndPoint.toString(endPoint_)); getConFileMsg.add("command", "getConFiles"); translater.postMessage(getConFileMsg); } }
//----< load getConFiles processing into dispatcher dictionary >------ private void DispatcherGetPublishedFiles() { Action <CsMessage> getConFiles = (CsMessage rcvMsg) => { var enumer = rcvMsg.attributes.GetEnumerator(); while (enumer.MoveNext()) { string key = enumer.Current.Key; if (key.Contains("sentConFile")) { Action <string> doFile = (string file) => { file = System.IO.Path.GetFullPath(workingDir + "/" + file); if (openOnce) { if (browserRadio.IsChecked == true) { System.Diagnostics.Process.Start(file); } else { swin = new SelectionWindow(); swin.setMainWindow(this); swin.Show(); swin.Add(file); } openOnce = false; } }; Dispatcher.Invoke(doFile, new Object[] { enumer.Current.Value }); } } }; addClientProc("getConFiles", getConFiles); }