Ejemplo n.º 1
0
        private void menuLoad_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (_container == null) _container = new DeltaContainer();
                // Configure open file dialog box
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.FileName = "Document"; // Default file name
                dlg.DefaultExt = ".xml"; // Default file extension
                dlg.Filter = "Xml files (.xml)|*.xml"; // Filter files by extension
                if (!Directory.Exists(System.Configuration.ConfigurationSettings.AppSettings["OutputDirectory"]))
                {
                    Directory.CreateDirectory(System.Configuration.ConfigurationSettings.AppSettings["OutputDirectory"]);
                }
                dlg.InitialDirectory = System.Configuration.ConfigurationSettings.AppSettings["OutputDirectory"];

                // Show open file dialog box
                Nullable<bool> result = dlg.ShowDialog();

                // Process open file dialog box results
                if (result == true)
                {
                    // Open document
                    string filename = dlg.FileName;
                    using (StreamReader sr = new StreamReader(filename))
                    {
                        string xml = sr.ReadToEnd();
                        _container = _container.FromString(xml);
                    }
                }
                populateXmlText();
            }
            catch (Exception ex)
            {
                handleException(ex);
            }
        }
Ejemplo n.º 2
0
 private void SaveMenuItem_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         _container = _container.FromString(eTextBlock.Text);
         saveFiles();
     }
     catch (Exception ex)
     {
         handleException(ex);
     }
 }
Ejemplo n.º 3
0
 private void menuDraw_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         _container = _container.FromString(eTextBlock.Text);
         drawImage();
         //TODO: share objects between threads
         //startWork();
     }
     catch (Exception ex)
     {
         handleException(ex);
     }
 }