コード例 #1
0
	private void OnOpenActivated(object sender, System.EventArgs e)
	{
		string filename = String.Empty;
		OpenDocDialog dialog = new OpenDocDialog ();
		if (dialog.Run () == (int) ResponseType.Ok)
			filename = dialog.Document;
			
		dialog.Destroy ();
		
		if (filename != String.Empty) {
			try {
				MonoDocument doc = new MonoDocument (filename);
				
				if (!current_tab.Title.Equals ("Untitled"))
					AddTab ();
				
				current_tab.Title = doc.Filename;
				current_tab.Buffer.Load (doc);
				SaveAs.Sensitive = Save.Sensitive = true;
			} catch (ArgumentException emsg) {
				// TODO: Add message dialog about error.
				Console.WriteLine (emsg.Message);
			}
		}
	}
コード例 #2
0
	public void Load (MonoDocument document)
	{
		undo_manager.FreezeUndo ();
		DocumentBufferArchiver.Deserialize (this, document.Xml);
		document_loaded = true;
		undo_manager.ThrawUndo ();
	}
コード例 #3
0
	public void ConstructorValid ()
	{
		string fileName;
		
		fileName = Path.Combine (pathTest, "Accel.xml");
		MonoDocument document = new MonoDocument (fileName);
		Assert.IsInstanceOfType (type, document, "CV02");
		Assert.IsNotNull (document, "CV02");
	}
コード例 #4
0
        public void ConstructorValid()
        {
            string fileName;

            fileName = Path.Combine(pathTest, "Accel.xml");
            MonoDocument document = new MonoDocument(fileName);

            Assert.IsInstanceOfType(type, document, "CV02");
            Assert.IsNotNull(document, "CV02");
        }
コード例 #5
0
	public void ConstructorInvalid ()
	{
		MonoDocument document = null;
		
		try {
			document = new MonoDocument (String.Empty);
		} catch {
		}
		
		Assert.IsNotInstanceOfType (type, document, "CI01");
		Assert.IsNull (document, "CI02");
	}
コード例 #6
0
        public void ConstructorInvalid()
        {
            MonoDocument document = null;

            try {
                document = new MonoDocument(String.Empty);
            } catch {
            }

            Assert.IsNotInstanceOfType(type, document, "CI01");
            Assert.IsNull(document, "CI02");
        }
コード例 #7
0
	public void TestSerialize ()
	{
		string originalXml, newXml, filename;
		
		foreach (string file in files) {
			DocumentEditor editor = new DocumentEditor ();
			DocumentBuffer buffer = (DocumentBuffer) editor.Buffer;
			
			MonoDocument document = new MonoDocument (file);
			filename = Path.GetFileName (file);
			originalXml= document.Xml;
			
			buffer.Undoer.FreezeUndo ();
			DocumentBufferArchiver.Deserialize (buffer, originalXml);
			buffer.Undoer.ThrawUndo ();
			newXml = DocumentBufferArchiver.Serialize (buffer);
			
			Assert.AreEqual (originalXml, newXml, "SR:" + filename);
		}
	}
コード例 #8
0
	public void TestSerializePerformance ()
	{
		foreach (string file in files) {
			DocumentEditor editor = new DocumentEditor ();
			DocumentBuffer buffer = (DocumentBuffer) editor.Buffer;
			
			MonoDocument document = new MonoDocument (file);
			string filename = Path.GetFileName (file);
			
			buffer.Undoer.FreezeUndo ();
			DocumentBufferArchiver.Deserialize (buffer, document.Xml);
			buffer.Undoer.ThrawUndo ();
			
			DateTime startTime = DateTime.Now;
			DocumentBufferArchiver.Serialize (buffer);
			DateTime stopTime = DateTime.Now;
			
			TimeSpan duration = stopTime - startTime;			
			Assert.Less (duration.TotalMilliseconds, 3000, "SP:" + filename);
		}
	}