Exemple #1
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;
        }
Exemple #2
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();
        }
Exemple #3
0
        protected override void Dispose(bool disposing)
        {
            if (!IsDisposed && disposing)
            {
                m_chorusSystem?.Dispose();
                // m_notesBar is stored in Control, which is disposed by base.Dispose.
            }

            m_chorusSystem = null;
            m_notesBar     = null;

            base.Dispose(disposing);
        }
Exemple #4
0
        public EntryHeaderView(NotesBarView notesBarView)
        {
            SetupEntryPreview();
            InitializeComponent();

            _notesBar             = notesBarView;// notesSystem.CreateNotesBarView(id => WeSayWordsProject.GetUrlFromLexEntry(_currentRecord));
            _notesBar.BorderStyle = System.Windows.Forms.BorderStyle.None;
            _notesBar.Dock        = System.Windows.Forms.DockStyle.Top;
            _notesBar.Location    = new System.Drawing.Point(0, 0);
            _notesBar.Name        = "notesBar";
            _notesBar.BackColor   = this.BackColor;
            //notesBar.Size = new System.Drawing.Size(474, 85);
            _notesBar.TabIndex = 1;
            _notesBar.TabStop  = false;
            //_notesBar.Visible = false;//wait until we have a record to show
            _notesBar.Height = kNotesBarHeight;

            this.Controls.Add(_notesBar);
            Controls.SetChildIndex(_notesBar, 0);

            _notesBar.SizeChanged  += new EventHandler(_notesBar_SizeChanged);
            _notesBar.AutoScaleMode = AutoScaleMode.None;
            DoLayout();
        }