Closed maratoss closed 9 years ago
You did click on the Save button in both cases, and can confirm that your change from TxEditor is reflected in the .txd XML file, right?
Yes, right. TxEditor does changes in *.txd but despite of it WpfDemo didn't update own GUI.
Seems like that FileWatcher doesn't work properly If you add following code in MainViewModel.cs it works
MainViewModel.cs
...
private void WriteXmlToFile(XmlDocument xmlDoc, string fileName)
{
XmlWriterSettings xws = new XmlWriterSettings();
xws.Encoding = Encoding.UTF8;
xws.Indent = true;
xws.IndentChars = "\t";
xws.OmitXmlDeclaration = false;
using (XmlWriter xw = XmlWriter.Create(fileName + ".tmp", xws))
{
xmlDoc.Save(xw);
}
File.Delete(fileName);
File.Move(fileName + ".tmp", fileName);
// added code
using (StreamWriter streamWriter = File.AppendText(fileName))
{
streamWriter.Write(' ');
streamWriter.Flush();
}
}
...
Ah, that could be because another editor writes directly to the file, changing it, whereas TxEditor performs a safe write, renaming it. Maybe the FileSystemWatcher doesn't listen to that. I'll look into it.
Great, thanks!
Yep, that was exactly the cause. It's working now. Thanks for your report!
Hi! Great project :)
I have the problem with updating *.txd file via TxEditor. When i update it via TxEditor, MainWindow.xaml form of project WpfDemo doesn't update. If i do it via any text editor (e.g. notepad++) it works. Could you help me with this problem?