Пример #1
0
 private void SaveRequested(IPluginChildWindow sender)
 {
     if (changedCheckBox.Checked)
     {
         PutScripture();
     }
 }
Пример #2
0
        private void SaveRequested(IPluginChildWindow sender)
        {
            if (m_writeLock == null)
            {
                m_writeLock = m_project.RequestWriteLock(this, ReleaseRequested, savedDataId);
            }
            if (m_writeLock == null)
            {
                MessageBox.Show("Cannot get write lock; aborting loading data");
                m_savedText      = "";
                m_currentText    = "";
                textBox.Text     = "";
                textBox.ReadOnly = true;
                return;
            }

            m_currentText = textBox.Text;
            ProjectTextData data = new ProjectTextData
            {
                Lines = m_currentText.Split(new[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries)
            };

            try
            {
                m_project.PutPluginData(m_writeLock, this, savedDataId, writer => m_Serializer.Serialize(writer, data));
            }
            catch (Exception e)
            {
                MessageBox.Show($"Unable to save data:\n{e.Message}");
            }
            m_savedText = m_currentText;
        }
Пример #3
0
 private void Parent_SaveRequested(IPluginChildWindow sender)
 {
     if (lastSavedValue != EditText)
     {
         SaveText();
     }
 }
Пример #4
0
        public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state)
        {
            m_parent = parent;
            if (parent.CurrentState == null)
            {
                m_project  = null;
                m_verseRef = null;
            }
            else
            {
                m_project  = parent.CurrentState.Project;
                m_verseRef = parent.CurrentState.VerseRef;
            }

            parent.SetTitle(PluginG.pluginName);
            parent.WindowClosing   += WindowClosing;
            parent.ProjectChanged  += ProjectChanged;
            parent.VerseRefChanged += VerseRefChanged;
            if (m_project != null)
            {
                m_project.ProjectDataChanged += ProjectDataChanged;
            }

            m_UpdateThread = new Thread(UpdateTimeWorker);
            m_UpdateThread.Start();
        }
Пример #5
0
        private void ProjectChanged(IPluginChildWindow sender, IProject newProject)
        {
            // Save the old project first:
            PromptSaveAndUnlock();

            // Then remember the new project
            SetProject(newProject);
        }
Пример #6
0
 public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state)
 {
     m_project = parent.CurrentState.Project;
     parent.SetTitle(PluginF.pluginName);
     parent.SaveRequested  += SaveRequested;
     parent.WindowClosing  += WindowClosing;
     parent.ProjectChanged += ProjectChanged;
 }
Пример #7
0
        public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state)
        {
            parent.SetTitle(PluginJ.pluginName);
            SetProject(parent.CurrentState.Project);

            host.ActiveWindowSelectionChanged += ActiveWindowSelectionChanged;
            parent.ProjectChanged             += ProjectChanged;
        }
Пример #8
0
        private void ProjectChanged(IPluginChildWindow sender, IProject newProject)
        {
            // Save the old project first:
            PromptSaveAndDispose(sender);

            // Then load the new project
            m_project = newProject;
            LoadSavedText();
        }
Пример #9
0
 private void Parent_VerseRefChanged(IPluginChildWindow sender, IVerseRef oldReference, IVerseRef newReference)
 {
     Debug.Assert(oldReference.Equals(m_reference));
     m_reference = newReference;
     if (oldReference.BookNum != newReference.BookNum || oldReference.ChapterNum != newReference.ChapterNum)
     {
         UpdateWordleAsync();
     }
 }
Пример #10
0
        public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state)
        {
            parent.SetTitle(PluginE.pluginName);
            m_Project   = parent.CurrentState.Project;
            m_Reference = parent.CurrentState.VerseRef;

            parent.ProjectChanged  += ProjectChanged;
            parent.VerseRefChanged += VerseRefChanged;
        }
Пример #11
0
        public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state)
        {
            parent.Icon = Resources.icon;
            parent.SetTitle(ProjectTextEditorPlugin.pluginName, false);
            UpdateProject(parent.CurrentState.Project);

            parent.SaveRequested   += Parent_SaveRequested;
            parent.WindowClosing   += Parent_WindowClosing;
            parent.ProjectChanged  += Parent_ProjectChanged;
            parent.MegaMenuShowing += Parent_MegaMenuShowing;
        }
Пример #12
0
        public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state)
        {
            m_host = host;
            parent.SetTitle(ChapterWordCloudPlugin.pluginName);

            parent.VerseRefChanged += Parent_VerseRefChanged;
            parent.ProjectChanged  += Parent_ProjectChanged;

            SetProject(parent.CurrentState.Project);
            m_reference    = parent.CurrentState.VerseRef;
            m_selectedText = state;
            selectedTextToolStripMenuItem.Checked = state != null;
        }
Пример #13
0
 private void ReferenceChanged(IPluginChildWindow sender, IVerseRef oldReference, IVerseRef newReference)
 {
     if ((m_Reference.BookNum != newReference.BookNum) ||
         (m_Reference.ChapterNum != newReference.ChapterNum))
     {
         PromptSaveAndUnlock();
         m_Reference      = newReference;
         chapterText.Text = "Click 'Get Chapter'";
         chapterText.BringToFront();
         bookName.Text           = m_Reference.BookCode;
         chapterNumber.Text      = m_Reference.ChapterNum.ToString();
         changedCheckBox.Checked = false;
     }
 }
Пример #14
0
        public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state)
        {
            parent.SetTitle(PluginH.pluginName);

            m_Host      = host;
            m_Project   = parent.CurrentState.Project;
            m_Reference = parent.CurrentState.VerseRef;

            IReferenceListWindow refList = host.ReferenceList;

            refList.ListChanged         += ListChanged;
            refList.SelectedItemChanged += SelectedItemChanged;
            refList.ItemDoubleClicked   += ItemDoubleClicked;
        }
Пример #15
0
        public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state)
        {
            parent.SetTitle(PluginL.pluginName);
            parent.ProjectChanged  += ProjectChanged;
            parent.VerseRefChanged += VerseRefChanged;

            SetProject(parent.CurrentState.Project);
            m_verseRef = parent.CurrentState.VerseRef;

            RowStyle rowStyle = new RowStyle(SizeType.AutoSize);

            m_tableLayoutPanel.RowStyles.Add(rowStyle);

            AddHeaderRow();
        }
Пример #16
0
        public void ProjectChanged(IPluginChildWindow sender, IProject newProject)
        {
            if (m_project != null)
            {
                m_project.ProjectDataChanged -= ProjectDataChanged;
            }
            m_project = newProject;
            if (m_project != null)
            {
                m_project.ProjectDataChanged += ProjectDataChanged;
            }

            m_verseRef = sender.CurrentState.VerseRef;
            ShowProjectInfo();
        }
Пример #17
0
        public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state)
        {
            parent.SetTitle(PluginK.pluginName);

            m_host    = host;
            m_project = parent.CurrentState.Project;
            m_parent  = parent;

            m_whichListListBox.BeginUpdate();
            m_whichListListBox.Items.Add(ProjectList);
            m_whichListListBox.Items.Add(AllList);
            m_whichListListBox.Items.Add(MajorList);
            m_whichListListBox.SetSelected(0, true);
            m_whichListListBox.EndUpdate();
        }
Пример #18
0
        private void PromptSaveAndDispose(IPluginChildWindow sender)
        {
            if (textBox.Text != m_savedText)
            {
                var response = MessageBox.Show("Save changed data?", "Plugin F", MessageBoxButtons.YesNo);
                if (response == DialogResult.Yes)
                {
                    SaveRequested(sender);
                }
            }

            if (m_writeLock != null)
            {
                m_writeLock.Dispose();
                m_writeLock = null;
            }
        }
Пример #19
0
        public override void OnAddedToParent(IPluginChildWindow parent, IWindowPluginHost host, string state)
        {
            parent.SetTitle(PluginI.pluginName);

            SetProject(parent.CurrentState.Project);
            m_Reference        = parent.CurrentState.VerseRef;
            chapterText.Text   = "Click 'Get Chapter'";
            bookName.Text      = m_Reference.BookCode;
            chapterNumber.Text = m_Reference.ChapterNum.ToString();
            chapterText.Text   = "";
            chapterText.BringToFront();
            changedCheckBox.Checked = false;
            EnableRadioButtons();
            UsfmRadioButton.Checked       = true;
            UsfmTokensRadioButton.Checked = false;
            UsxRadioButton.Checked        = false;
            m_WriteLock            = null;
            lockedCheckBox.Checked = false;

            parent.VerseRefChanged += ReferenceChanged;
            parent.WindowClosing   += WindowClosing;
            parent.SaveRequested   += SaveRequested;
            parent.ProjectChanged  += ProjectChanged;
        }
Пример #20
0
 private void Parent_MegaMenuShowing(IPluginChildWindow sender)
 {
     undoToolStripMenuItem.Enabled = textChanged;
 }
Пример #21
0
 public void VerseRefChanged(IPluginChildWindow sender, IVerseRef oldReference, IVerseRef newReference)
 {
     m_project  = sender.CurrentState.Project;
     m_verseRef = newReference;
     ShowProjectInfo();
 }
Пример #22
0
 private void Parent_ProjectChanged(IPluginChildWindow sender, IProject newProject)
 {
     UpdateProject(newProject);
 }
Пример #23
0
 public void WindowClosing(IPluginChildWindow sender, CancelEventArgs args)
 {
     s_exists = false;
 }
Пример #24
0
 private void Parent_WindowClosing(IPluginChildWindow sender, System.ComponentModel.CancelEventArgs args)
 {
     PromptAndSave(args);
 }
Пример #25
0
 private void WindowClosing(IPluginChildWindow sender, CancelEventArgs args)
 {
     PromptSaveAndDispose(sender);
 }
Пример #26
0
 private void WindowClosing(IPluginChildWindow sender, CancelEventArgs args)
 {
     PromptSaveAndUnlock();
 }
Пример #27
0
 private void ProjectChanged(IPluginChildWindow sender, IProject newProject)
 {
     SetProject(newProject);
 }
Пример #28
0
 public void ProjectChanged(IPluginChildWindow sender, IProject newProject)
 {
     m_Project   = newProject;
     m_Reference = sender.CurrentState.VerseRef;
     ShowScripture();
 }
Пример #29
0
 public void VerseRefChanged(IPluginChildWindow sender, IVerseRef oldReference, IVerseRef newReference)
 {
     m_Reference = newReference;
     ShowScripture();
 }
Пример #30
0
 private void VerseRefChanged(IPluginChildWindow sender, IVerseRef oldReference, IVerseRef newReference)
 {
     m_verseRef = newReference;
 }