Esempio n. 1
0
        private void btSave_Click(object sender, RoutedEventArgs e)
        {
            curDoc.type   = meTagControl.cbType.Text;
            curDoc.intent = meTagControl.cbIntent.Text;

            SaveFileDialog sfDlg = new SaveFileDialog();

            sfDlg.DefaultExt = "*.xml";
            sfDlg.Filter     = "XML File|*.xml|All File|*.*";

            if (sfDlg.ShowDialog() == true)
            {
                if (AppBase.SaveFile(sfDlg.FileName, curDoc))
                {
                    MessageBox.Show("Save successful", "Save file", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    MessageBox.Show("Save failed", "Save file", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
Esempio n. 2
0
        private void btOpen_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofDlg = new OpenFileDialog();

            ofDlg.DefaultExt  = ".xml";
            ofDlg.Filter      = "XML File|*.xml|All File|*.*";
            ofDlg.Multiselect = false;

            if (ofDlg.ShowDialog() == true)
            {
                curDoc = AppBase.LoadFile(ofDlg.FileName);
                if (curDoc == null)
                {
                    MessageBox.Show("Failed to load seleted file, check file format.");
                }
                else
                {
                    rTBDoc.SelectAll();
                    rTBDoc.Selection.Text = curDoc.content;
                    rTBDoc.Selection.Select(rTBDoc.Document.ContentStart, rTBDoc.Document.ContentStart);
                    meTagControl.lbMessage.Text = String.Format("Message:\n Tilte:{0}\n Author:{1}\n URL:{2}\n ID:{3}", curDoc.title, curDoc.author, curDoc.url, curDoc.id);
                }
            }
        }