Esempio n. 1
0
        private void OnSaveAsActivated(object sender, System.EventArgs e)
        {
            string        filename = String.Empty;
            SaveDocDialog dialog   = new SaveDocDialog(current_tab.Title);

            if (dialog.Run() == (int)ResponseType.Ok)
            {
                filename = dialog.Document;
            }

            dialog.Destroy();

            try {
                if (filename != String.Empty)
                {
                    using (FileStream fileStream = new FileStream(filename, FileMode.CreateNew)) {
                        using (StreamWriter streamWriter = new StreamWriter(fileStream)) {
                            streamWriter.Write(DocumentBufferArchiver.Serialize(current_tab.Buffer));
                        }
                    }
                }
            } catch (IOException emsg) {
                //TODO: Add message dialog about error.
                Console.WriteLine(emsg.Message);
            }
        }
Esempio n. 2
0
	private void OnSaveAsActivated (object sender, System.EventArgs e)
	{
		string filename = String.Empty;
		SaveDocDialog dialog = new SaveDocDialog (current_tab.Title);
		if (dialog.Run () == (int) ResponseType.Ok)
			filename = dialog.Document;
		
		dialog.Destroy ();
		
		try {
			if (filename != String.Empty)
				using (FileStream fileStream = new FileStream (filename, FileMode.CreateNew)) {
					using (StreamWriter streamWriter = new StreamWriter (fileStream)) {
						streamWriter.Write (DocumentBufferArchiver.Serialize (current_tab.Buffer));
					}
				}
		} catch (IOException emsg) {
			//TODO: Add message dialog about error.
			Console.WriteLine (emsg.Message);
		}
	}