Esempio n. 1
0
        private async static void OnSaveXamlCommand(object sender, RoutedEventArgs e)
        {
            var fileName = DialogUtil.ShowSaveFileDialog("MyXaml.xaml", "XAML|*.xaml");

            if (string.IsNullOrEmpty(fileName))
            {
                return;
            }

            var ctrl = sender as LiveXaml;

            using (var fs = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.Read))
            {
                using (var sw = new StreamWriter(fs, Encoding.UTF8))
                {
                    await sw.WriteAsync(ctrl.Text);
                }
            }
        }