コード例 #1
0
        /// <summary>
        /// Start doing whatever is needed for the supported type of action.
        /// </summary>
        public void StartWorking(Dictionary <string, string> commandLineArgs)
        {
            _fwProjectFolder = Path.GetDirectoryName(commandLineArgs["-p"]);

            MainForm = new MainBridgeForm
            {
                ClientSize = new Size(904, 510)
            };
            _chorusUser   = new ChorusUser(commandLineArgs["-u"]);
            _chorusSystem = Utilities.InitializeChorusSystem(Utilities.LiftOffset(_fwProjectFolder), _chorusUser.Name, LiftFolder.AddLiftFileInfoToFolderConfiguration);
            _chorusSystem.EnsureAllNotesRepositoriesLoaded();

            _notesBrowser = _chorusSystem.WinForms.CreateNotesBrowser();
            var conflictHandler = _notesBrowser.MessageContentHandlerRepository.KnownHandlers.OfType <MergeConflictEmbeddedMessageContentHandler>().First();

            _chorusSystem.NavigateToRecordEvent.Subscribe(JumpToLiftObject);
            conflictHandler.HtmlAdjuster = AdjustConflictHtml;
            if (_connectionHelper != null)
            {
                JumpUrlChanged += _connectionHelper.SendJumpUrlToFlex;
            }

            var viewer = new BridgeConflictView();

            MainForm.Controls.Add(viewer);
            MainForm.Text = viewer.Text;
            viewer.Dock   = DockStyle.Fill;
            viewer.SetBrowseView(_notesBrowser);

            // Only used by FLEx, so how can it not be in use?
            //if (_currentLanguageProject.FieldWorkProjectInUse)
            //	viewer.EnableWarning();
            viewer.SetProjectName(LiftUtilties.GetLiftProjectName(_fwProjectFolder));
        }
コード例 #2
0
        /// <summary>
        /// Executes in two distinct scenarios.
        ///
        /// 1. If disposing is true, the method has been called directly
        /// or indirectly by a user's code via the Dispose method.
        /// Both managed and unmanaged resources can be disposed.
        ///
        /// 2. If disposing is false, the method has been called by the
        /// runtime from inside the finalizer and you should not reference (access)
        /// other managed objects, as they already have been garbage collected.
        /// Only unmanaged resources can be disposed.
        /// </summary>
        /// <remarks>
        /// If any exceptions are thrown, that is fine.
        /// If the method is being done in a finalizer, it will be ignored.
        /// If it is thrown by client code calling Dispose,
        /// it needs to be handled by fixing the issue.
        /// </remarks>
        private void Dispose(bool disposing)
        {
            if (IsDisposed)
            {
                return;
            }

            if (disposing)
            {
                if (_notesBrowser != null)
                {
                    _notesBrowser.Dispose();
                }
                if (_chorusSystem != null)
                {
                    _chorusSystem.Dispose();
                }
                if (_connectionHelper != null)
                {
                    JumpUrlChanged -= _connectionHelper.SendJumpUrlToFlex;
                }
                if (_chorusSystem != null)
                {
                    _chorusSystem.Dispose();
                }
            }
            _connectionHelper = null;
            MainForm          = null;
            _chorusUser       = null;
            _notesBrowser     = null;

            IsDisposed = true;
        }
コード例 #3
0
        private void ShowBrowser(IEnumerable <AnnotationRepository> repositories)
        {
            //TODO (jh/jh): something here seems screwed up... we create a NotesInProjectViewModel here, and yet so does the NotesBrowserPage

            var messageSelected            = new MessageSelectedEvent();
            var chorusNotesDisplaySettings = new ChorusNotesDisplaySettings()
            {
                WritingSystemForNoteLabel   = new TestWritingSystem("Algerian"),
                WritingSystemForNoteContent = new TestWritingSystem("Bradley Hand ITC")
            };

            NotesInProjectViewModel notesInProjectModel = new NotesInProjectViewModel(new ChorusUser("Bob"), repositories, chorusNotesDisplaySettings, new ConsoleProgress());

            var annotationModel = new AnnotationEditorModel(new ChorusUser("bob"), messageSelected, StyleSheet.CreateFromDisk(),
                                                            new EmbeddedMessageContentHandlerRepository(), new NavigateToRecordEvent(), chorusNotesDisplaySettings);
            AnnotationEditorView annotationView = new AnnotationEditorView(annotationModel);

            annotationView.ModalDialogMode = false;
            var page = new NotesBrowserPage((unusedRepos, progress) => notesInProjectModel, repositories, annotationView);

            page.Dock = DockStyle.Fill;
            var form = new Form();

            form.Size = new Size(700, 600);
            form.Controls.Add(page);

            Application.EnableVisualStyles();
            Application.Run(form);
        }
コード例 #4
0
ファイル: Form1.cs プロジェクト: sillsdev/chorus
        private void ChangeSimulatedUser(string userName)
        {
            ClearOutInAnticipationOfSwitchingUsers();

            var dir = Path.Combine(_testDirectory, userName);

            if (!Directory.Exists(dir))
            {
                UnZipToDirectory(dir);
            }

            var shoppingListDir = Path.Combine(dir, "ShoppingList");

            //note: if you don't have a user name, you can just let chorus try to figure one out.
            //Also note that this is not the same name as that used for any given network repository credentials;
            //Rather, it's the name which will show in the history, and besides Notes that this user makes.
            _chorusSystem = new ChorusSystem(shoppingListDir);
            _chorusSystem.DisplaySettings = new ChorusNotesDisplaySettings()
            {
                WritingSystemForNoteLabel   = new TestWritingSystem("Algerian"),
                WritingSystemForNoteContent = new TestWritingSystem("Bradley Hand ITC")
            };

            _chorusSystem.Init(userName);


            _chorusSystem.Repository.SetKnownRepositoryAddresses(new RepositoryAddress[] { _serverRepository });

            _chorusSystem.ProjectFolderConfiguration.IncludePatterns.Add("*.xml");

            _dataEditor      = new DataEditor(_chorusSystem, Path.Combine(shoppingListDir, "shopping.xml"));
            _dataEditor.Dock = DockStyle.Fill;
            _frontPage.Controls.Add(_dataEditor);

            _notesBrowserControl      = _chorusSystem.WinForms.CreateNotesBrowser();
            _notesBrowserControl.Dock = DockStyle.Fill;
            _notesPage.Controls.Add(_notesBrowserControl);

            _historyControl      = _chorusSystem.WinForms.CreateHistoryPage();
            _historyControl.Dock = DockStyle.Fill;
            _historyPage.Controls.Add(_historyControl);
        }
コード例 #5
0
 public void SetBrowseView(NotesBrowserPage browser)
 {
     _notesBrowser = browser;
     _splitContainer.Panel2.Controls.Add(_notesBrowser);
     _notesBrowser.Dock = DockStyle.Fill;
 }