Esempio n. 1
0
        public DataEditor(ChorusSystem chorusSystem, string dataFilePath)
        {
            _chorusSystem = chorusSystem;
            _dataFilePath = dataFilePath;
            InitializeComponent();

            var notesToRecordMapping = new NotesToRecordMapping()
                                           {
                                               FunctionToGetCurrentUrlForNewNotes = GetCurrentUrlForNewNotes,
                                               FunctionToGoFromObjectToItsId = GetIdForObject
                                           };

            _notesBar = _chorusSystem.WinForms.CreateNotesBar(dataFilePath, notesToRecordMapping, new NullProgress());
            _notesBar.Location = new Point(10, 6);
            this.Controls.Add(_notesBar);

            XmlDocument doc = new XmlDocument();
            doc.Load(dataFilePath);

            var areas = doc.SelectNodes("//area");

            _area1Text.Tag = _area1Label.Text = areas[0].Attributes["id"].Value;
            _area1Text.Text = areas[0].InnerText.Trim();

            _area2Text.Tag = _area2Label.Text = areas[1].Attributes["id"].Value;
            _area2Text.Text = areas[1].InnerText.Trim();
        }
Esempio n. 2
0
		public override void FinishInit()
		{
			m_chorusSystem = new ChorusSystem(Cache.ProjectId.ProjectFolder);
			m_chorusSystem.InitWithoutHg(SendReceiveUser);
			// This is a required object for CreateNotesBar. It specifies delegates for getting the information
			// the bar requires about the current object.
			var notesToRecordMapping = new NotesToRecordMapping()
				{
					FunctionToGetCurrentUrlForNewNotes = GetCurrentUrlForNewNotes,
					FunctionToGoFromObjectToItsId = GetIdForObject,
					FunctionToGoFromObjectToAdditionalIds = GetAdditionalIdsForObject
				};
			var dataFilePath = GetDataFilePath(Cache);
			var additionalPaths = GetAdditionalLexiconFilePaths(Cache);
			const string idAttrForOtherFiles = "guid"; // .lexdb chorus notes files identify FLEx object with a url attr of "guid".
			m_notesBar = m_chorusSystem.WinForms.CreateNotesBar(dataFilePath, additionalPaths, idAttrForOtherFiles, notesToRecordMapping, new NullProgress());
			m_notesBar.SetTargetObject(m_obj);
			// Set the writing systems for the NoteDetailDialog.  (See FWNX-1239.)
			var vernWs = Cache.ServiceLocator.WritingSystems.DefaultVernacularWritingSystem;
			var labelWs = new ChorusWritingSystem(vernWs.LanguageName, vernWs.RFC5646, vernWs.DefaultFontName, 12);
			m_notesBar.LabelWritingSystem = labelWs;
			var analWs = Cache.ServiceLocator.WritingSystems.DefaultAnalysisWritingSystem;
			var msgWs = new ChorusWritingSystem (analWs.LanguageName, analWs.RFC5646, analWs.DefaultFontName, 12);
			m_notesBar.MessageWritingSystem = msgWs;
			this.Control = m_notesBar;
		}