XWindow is a window which is configured with XML file.
Inheritance: System.Windows.Forms.Form, IFWDisposable, IxCoreColleague, IxWindow
示例#1
0
		/// <summary>
		///
		/// </summary>
		/// <returns></returns>
		public Form NewMainWindow()
		{
			XWindow form = new XWindow();
			ImageHolder holder = new ImageHolder ();

			//noticed that we only have one size of image, so we are sticking it in both the small and the large lists
			form.AddLargeImageList(holder.miscImages, new string[]{"chat", "wheelchair", "food", "basinet", "submit"});
			form.AddLargeImageList(holder.airportImages, new string[]{"defaultLocation","USA", "Italy"});
			form.AddSmallImageList(holder.miscImages, new string[]{"chat", "wheelchair", "food", "basinet", "submit"});
			form.AddSmallImageList(holder.airportImages, new string[]{"defaultLocation","USA", "Italy"});
			form.LoadUI(ConfigurationPath);//Argument("x"));
			form.Show();
			return form;
		}
示例#2
0
		public override void FixtureSetup()
		{
			base.FixtureSetup();

			// load a persisted version of the property table.
			m_settingsPath = Path.Combine(TempPath, "settingsBackup");
			if (!Directory.Exists(m_settingsPath))
				Directory.CreateDirectory(m_settingsPath);

			m_window = new XWindow();
			m_window.PropertyTable.UserSettingDirectory = m_settingsPath;
			// delete any existing property table settings.
			m_window.PropertyTable.RemoveLocalAndGlobalSettings();
			//m_window.PropertyTable.SetProperty("PreferredUILibrary", "FlexUIAdapter.dll");
			m_window.LoadUI(ConfigurationFilePath);
		}
示例#3
0
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			//Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************");
			// Must not be run more than once.
			if (IsDisposed)
				return;

			if (disposing)
			{
				if (components != null)
					components.Dispose();
			}

			base.Dispose(disposing);

			if (disposing)
			{
				// Do this after base class call,
				// as it will dispose the browse view,
				// which wants the mediator still kicking.
				// when it tires to get a RecordClerk out of it.
				if (m_myOwnPrivateMediator != null)
					m_myOwnPrivateMediator.Dispose();
			}
			m_xwindow = null;
			m_cache = null;
			m_myOwnPrivateMediator = null;
		}
示例#4
0
		/// <summary>
		/// Initialize an Concorder dlg.
		/// </summary>
		/// <param name="xwindow">The main window for this modeless dlg.</param>
		/// <param name="configurationNode">The XML node to control the ConcorderControl.</param>
		internal void SetDlgInfo(XWindow xwindow, XmlNode configurationNode)
		{
			CheckDisposed();

			if (xwindow == null)
				throw new ArgumentNullException("Main window is missing.");

			if (m_myOwnPrivateMediator != null)
				throw new InvalidOperationException("It is not legal to call this method more than once.");

			m_xwindow = xwindow;
			m_cache = m_xwindow.Mediator.PropertyTable.GetValue("cache") as FdoCache;
			m_myOwnPrivateMediator = new Mediator();
			// The extension XML files should be stored in the data area, not in the code area.
			// This reduces the need for users to have administrative privileges.
			string dir = DirectoryFinder.GetFWDataSubDirectory(@"Language Explorer\Configuration\Extensions\Concorder");
			m_myOwnPrivateMediator.StringTbl = new StringTable(dir);
			m_myOwnPrivateMediator.PropertyTable.SetProperty("cache", m_cache, false);
			m_myOwnPrivateMediator.PropertyTable.SetPropertyPersistence("cache", false);
			m_myOwnPrivateMediator.PropertyTable.SetPropertyDispose("cache", false);
			m_myOwnPrivateMediator.SpecificToOneMainWindow = true;
			//FwStyleSheet styleSheet = m_xwindow.Mediator.PropertyTable.GetValue("FwStyleSheet") as FwStyleSheet;
			//m_myOwnPrivateMediator.PropertyTable.SetProperty("FwStyleSheet", styleSheet);
			//m_myOwnPrivateMediator.PropertyTable.SetPropertyPersistence("FwStyleSheet", false);
			//m_myOwnPrivateMediator.PropertyTable.SetPropertyPersistence("FwStyleSheet", false);
			List<ConcorderControl.FindComboFillerBase> fcfList = new List<ConcorderControl.FindComboFillerBase>();
			ConcorderControl.FindComboFillerBase fcf = null;

			// Find: main POS:
			// UsedBy:  MSAs, senses, entries, analyses (x2), wordforms, compound rules
			fcf = new ConcorderControl.FindPossibilityComboFiller(m_cache.LangProject.PartsOfSpeechOA);
			fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcGrammaticalCategory']"));
			fcfList.Add(fcf);

			// Find: sense
			// UsedBy: Analyses, Sentences
			fcf = new ConcorderControl.FindComboFiller();
			fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcSense']"));
			fcfList.Add(fcf);
/*
			// Find: allomorph (main and alternates)
			// UsedBy: Analyses, Sentences, Ad hoc rules
			fcf = new ConcorderControl.FindComboFiller();
			fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcAllomorph']"));
			fcfList.Add(fcf);

			// Find: entry
			// UsedBy: Analyses, Sentences
			fcf = new ConcorderControl.FindComboFiller();
			fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcEntry']"));
			fcfList.Add(fcf);

			// Find: Wordform
			// UsedBy: Sentences
			fcf = new ConcorderControl.FindComboFiller();
			fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcWordform']"));
			fcfList.Add(fcf);

			//// Find: MSA
			//// UsedBy: Senses, Analyses, Sentences
			//fcf = new ConcorderControl.FindComboFiller();
			//fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcGrammaticalFunction']"));
			//fcfList.Add(fcf);

			//// Find: Analysis
			//// UsedBy: Sentences
			//fcf = new ConcorderControl.FindComboFiller();
			//fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcAnalysis']"));
			//fcfList.Add(fcf);

			//// Find: Environment
			//// UsedBy: Allomorphs
			//fcf = new ConcorderControl.FindComboFiller();
			//fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcEnvironment']"));
			//fcfList.Add(fcf);

			//// Find: Word-level gloss
			//// UsedBy: Sentences
			//fcf = new ConcorderControl.FindComboFiller();
			//fcf.Init(m_myOwnPrivateMediator, configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcWordLevelGloss']"));
			//fcfList.Add(fcf);

			// Find: Phonemes
			// UsedBy:

			// Find: Natural Classes
			// UsedBy:

			// Find: Features
			// UsedBy:

			// Find: Exception Features
			// UsedBy:

//			// Find: eng rev POS
//			// UsedBy: rev entries
//			ubfList = new List<ConcorderControl.UsedByFiller>();
//			fcfConfigNode = configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcXX']");
//			fcf = new ConcorderControl.FindComboFiller("Grammatical Category: English Reversal", ubfList);
//			fcfList.Add(fcf);
//			ubfList.Add(new ConcorderControl.UsedByFiller("Reversal Entries" ));

//			// Find: spn rev POS
//			// UsedBy: rev entries
//			ubfList = new List<ConcorderControl.UsedByFiller>();
//			fcfConfigNode = configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcXX']");
//			fcf = new ConcorderControl.FindComboFiller("Grammatical Category: Spanish Reversal", ubfList);
//			fcfList.Add(fcf);
//			ubfList.Add(new ConcorderControl.UsedByFiller("Reversal Entries" ));

			//// Find: Academic Domain
			//// UsedBy: Senses
			//ubfList = new List<ConcorderControl.UsedByFiller>();
			//fcf = new ConcorderControl.FindPossibilityComboFiller(
			//    configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcAcademicDomain']"),
			//    ubfList,
			//    m_cache.LangProject.LexDbOA.DomainTypesOA);
			//fcfList.Add(fcf);
			//ubfList.Add(new ConcorderControl.UsedByFiller(
			//    configurationNode.SelectSingleNode("targetcontrols/control[@id='Senses']")));

			//// Find: Anthropology Category
			//// UsedBy: Senses
			//ubfList = new List<ConcorderControl.UsedByFiller>();
			//fcf = new ConcorderControl.FindPossibilityComboFiller(
			//    configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcAnthropologyCategory']"),
			//    ubfList,
			//    m_cache.LangProject.AnthroListOA);
			//fcfList.Add(fcf);
			//ubfList.Add(new ConcorderControl.UsedByFiller(
			//    configurationNode.SelectSingleNode("targetcontrols/control[@id='Senses']")));

			// Find: Confidence Level
			// UsedBy:

			// Find: Education Level
			// UsedBy:

			//// Find: Entry Type
			//// UsedBy: Entries
			//ubfList = new List<ConcorderControl.UsedByFiller>();
			//fcf = new ConcorderControl.FindPossibilityComboFiller(
			//    configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcEntryType']"),
			//    ubfList,
			//    m_cache.LangProject.LexDbOA.EntryTypesOA);
			//fcfList.Add(fcf);
			//ubfList.Add(new ConcorderControl.UsedByFiller(
			//    configurationNode.SelectSingleNode("targetcontrols/control[@id='Entries']")));

			// Find: Feature Type
			// UsedBy:

			// Find: Lexical Reference Type
			// UsedBy:

			// Find: Location
			// UsedBy:

			// Find: Minor Entry Condition
			// UsedBy: Entries
			//ubfList = new List<ConcorderControl.UsedByFiller>();
			//// TODO: Where is its pos list?
			//fcf = new ConcorderControl.FindComboFiller(
			//    configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcMinorEntryCondition']"),
			//    ubfList);
			//fcfList.Add(fcf);
			//ubfList.Add(new ConcorderControl.UsedByFiller("Entries" ));

			//// Find: Morpheme Type
			//// UsedBy: Allomorphs
			//ubfList = new List<ConcorderControl.UsedByFiller>();
			//fcf = new ConcorderControl.FindPossibilityComboFiller(
			//    configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcMorphemeType']"),
			//    ubfList,
			//    m_cache.LangProject.LexDbOA.MorphTypesOA);
			//fcfList.Add(fcf);
			//ubfList.Add(new ConcorderControl.UsedByFiller(
			//    configurationNode.SelectSingleNode("targetcontrols/control[@id='Allomorphs']")));

			// Find: People
			// UsedBy:

			// Find: Positions
			// UsedBy:

			// Find: Restrictions
			// UsedBy:

			//// Find: Semantic Domain
			//// UsedBy: Senses
			//ubfList = new List<ConcorderControl.UsedByFiller>();
			//fcf = new ConcorderControl.FindPossibilityComboFiller(
			//    configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcSemanticDomain']"),
			//    ubfList,
			//    m_cache.LangProject.SemanticDomainListOA);
			//fcfList.Add(fcf);
			//ubfList.Add(new ConcorderControl.UsedByFiller(
			//    configurationNode.SelectSingleNode("targetcontrols/control[@id='Senses']")));

			// Find: Sense Status
			// UsedBy: Senses
			//ubfList = new List<ConcorderControl.UsedByFiller>();
			//// TODO: Where is the pos list?
			//fcf = new ConcorderControl.FindComboFiller(
			//    configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcSenseStatus']"),
			//    ubfList);
			//fcfList.Add(fcf);
			//ubfList.Add(new ConcorderControl.UsedByFiller("Senses" ));

			//// Find: Sense Type
			//// UsedBy: Senses
			//ubfList = new List<ConcorderControl.UsedByFiller>();
			//fcf = new ConcorderControl.FindPossibilityComboFiller(
			//    configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcSenseType']"),
			//    ubfList,
			//    m_cache.LangProject.LexDbOA.SenseTypesOA);
			//fcfList.Add(fcf);
			//ubfList.Add(new ConcorderControl.UsedByFiller(
			//    configurationNode.SelectSingleNode("targetcontrols/control[@id='Senses']")));

			// Find: Status
			// UsedBy: Senses
			//ubfList = new List<ConcorderControl.UsedByFiller>();
			//// TODO: Where is the pos list?
			//fcf = new ConcorderControl.FindComboFiller(
			//    configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcStatus']"),
			//    ubfList);
			//fcfList.Add(fcf);
			//ubfList.Add(new ConcorderControl.UsedByFiller("Senses" ));

			// Find: Translation Type
			// UsedBy:

			//// Find: Usages
			//// UsedBy: Senses
			//ubfList = new List<ConcorderControl.UsedByFiller>();
			//fcf = new ConcorderControl.FindPossibilityComboFiller(
			//    configurationNode.SelectSingleNode("sourcecontrols/control[@id='srcUsages']"),
			//    ubfList,
			//    m_cache.LangProject.LexDbOA.UsageTypesOA);
			//fcfList.Add(fcf);
			//ubfList.Add(new ConcorderControl.UsedByFiller(
			//    configurationNode.SelectSingleNode("targetcontrols/control[@id='Senses']")));
*/

			m_concorderControl.SetupDlg(m_myOwnPrivateMediator, fcfList, fcfList[0]);
		}
示例#5
0
		public void ZCreateUIfromStream()
		{
			Assembly assembly = Assembly.GetExecutingAssembly();
			using (System.IO.Stream stream =
				assembly.GetManifestResourceStream("XCore.basicTest.xml"))
			{
				Assert.IsNotNull(stream, "Couldn't get the XML file.");

				using (XCore.XWindow window = new XWindow())
				{
					window.PropertyTable.UserSettingDirectory = m_settingsPath;
					window.LoadUI(stream);

					ITestableUIAdapter adapter = (ITestableUIAdapter)window.MenuAdapter;
					Assert.AreEqual(adapter.GetItemCountOfGroup("Vowels"), 5);
				}
			}
		}
示例#6
0
		protected void ReopenWindow()
		{
			m_window.Close();
			m_window.Dispose();
			m_window = new XWindow();
			m_window.PropertyTable.UserSettingDirectory = m_settingsPath;
			//m_window.PropertyTable.SetProperty("PreferredUILibrary", "FlexUIAdapter.dll");
			m_window.LoadUI(ConfigurationFilePath);
			m_window.SuspendWindowSizePersistence();
			m_window.Show();
			m_window.ResumeWindowSizePersistence();
		}