From e167853c28e3f2a9a5652a9aafeb8bb1c4ca479c Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Tue, 23 Mar 2021 14:43:23 -0400 Subject: [PATCH] move IHostApplication core into UniversalEditor.Core --- .../UniversalEditor.Core.csproj | 4 ++++ .../UserInterface}/HostApplicationMessage.cs | 0 .../HostApplicationOutputWindow.cs | 0 .../UserInterface}/IHostApplication.cs | 2 +- .../FileSystem/ZIP/ZIPDataFormat.cs | 3 +++ .../Dialogs/BatchFindReplaceWindow.cs | 4 ++-- .../EditorDocumentExplorer.cs | 6 ++--- .../Editors/Database/Views/ScriptView.cs | 2 +- .../Editors/FileSystem/FileSystemEditor.cs | 4 ++-- .../UniversalEditor.UserInterface/Engine.cs | 24 +++++++++---------- .../Pages/StartPage.cs | 4 ++-- .../Panels/SolutionExplorerPanel.cs | 2 +- .../UniversalEditor.UserInterface.csproj | 5 +--- .../MultimediaCollaborationPlugin.cs | 20 ++++++++-------- .../AutoSavePlugin.cs | 6 ++--- .../CollaborationPlugin.cs | 6 ++--- 16 files changed, 48 insertions(+), 44 deletions(-) rename Libraries/{UniversalEditor.UserInterface => UniversalEditor.Core/UserInterface}/HostApplicationMessage.cs (100%) rename Libraries/{UniversalEditor.UserInterface => UniversalEditor.Core/UserInterface}/HostApplicationOutputWindow.cs (100%) rename Libraries/{UniversalEditor.UserInterface => UniversalEditor.Core/UserInterface}/IHostApplication.cs (90%) diff --git a/Libraries/UniversalEditor.Core/UniversalEditor.Core.csproj b/Libraries/UniversalEditor.Core/UniversalEditor.Core.csproj index 1350fd99..446c7aea 100644 --- a/Libraries/UniversalEditor.Core/UniversalEditor.Core.csproj +++ b/Libraries/UniversalEditor.Core/UniversalEditor.Core.csproj @@ -99,6 +99,9 @@ + + + @@ -109,6 +112,7 @@ + diff --git a/Libraries/UniversalEditor.UserInterface/HostApplicationMessage.cs b/Libraries/UniversalEditor.Core/UserInterface/HostApplicationMessage.cs similarity index 100% rename from Libraries/UniversalEditor.UserInterface/HostApplicationMessage.cs rename to Libraries/UniversalEditor.Core/UserInterface/HostApplicationMessage.cs diff --git a/Libraries/UniversalEditor.UserInterface/HostApplicationOutputWindow.cs b/Libraries/UniversalEditor.Core/UserInterface/HostApplicationOutputWindow.cs similarity index 100% rename from Libraries/UniversalEditor.UserInterface/HostApplicationOutputWindow.cs rename to Libraries/UniversalEditor.Core/UserInterface/HostApplicationOutputWindow.cs diff --git a/Libraries/UniversalEditor.UserInterface/IHostApplication.cs b/Libraries/UniversalEditor.Core/UserInterface/IHostApplication.cs similarity index 90% rename from Libraries/UniversalEditor.UserInterface/IHostApplication.cs rename to Libraries/UniversalEditor.Core/UserInterface/IHostApplication.cs index f5d7bd90..2e8cd229 100644 --- a/Libraries/UniversalEditor.UserInterface/IHostApplication.cs +++ b/Libraries/UniversalEditor.Core/UserInterface/IHostApplication.cs @@ -5,7 +5,7 @@ /// /// Gets or sets the current window of the host application. /// - IHostApplicationWindow CurrentWindow { get; set; } + // IHostApplicationWindow CurrentWindow { get; set; } /// /// Gets or sets the output window of the host application, where other plugins can read from and write to. /// diff --git a/Libraries/UniversalEditor.Essential/DataFormats/FileSystem/ZIP/ZIPDataFormat.cs b/Libraries/UniversalEditor.Essential/DataFormats/FileSystem/ZIP/ZIPDataFormat.cs index 14434295..11aac095 100644 --- a/Libraries/UniversalEditor.Essential/DataFormats/FileSystem/ZIP/ZIPDataFormat.cs +++ b/Libraries/UniversalEditor.Essential/DataFormats/FileSystem/ZIP/ZIPDataFormat.cs @@ -28,6 +28,8 @@ using UniversalEditor.Compression; using UniversalEditor.IO; using UniversalEditor.DataFormats.FileSystem.ZIP.ExtraDataFields; +using MBS.Framework; +using UniversalEditor.UserInterface; namespace UniversalEditor.DataFormats.FileSystem.ZIP { @@ -701,6 +703,7 @@ namespace UniversalEditor.DataFormats.FileSystem.ZIP } reader.Seek(-5, SeekOrigin.Current); } + ((IHostApplication)Application.Instance).Messages.Add(HostApplicationMessageSeverity.Warning, "end of central directory signature not found", Accessor.GetFileName()); return -1; } diff --git a/Libraries/UniversalEditor.UserInterface/Dialogs/BatchFindReplaceWindow.cs b/Libraries/UniversalEditor.UserInterface/Dialogs/BatchFindReplaceWindow.cs index 8d0bea4f..d52f5d69 100644 --- a/Libraries/UniversalEditor.UserInterface/Dialogs/BatchFindReplaceWindow.cs +++ b/Libraries/UniversalEditor.UserInterface/Dialogs/BatchFindReplaceWindow.cs @@ -149,12 +149,12 @@ namespace UniversalEditor.UserInterface.Dialogs CriteriaResult result = e.Row.GetExtraData("result"); if (result == null) return; - Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor(); + Editor editor = ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow).GetCurrentEditor(); if (editor == null) return; editor.Selections.Add(editor.CreateSelection(result.Value)); - (Application.Instance as IHostApplication).CurrentWindow.Present(DateTime.Now); + ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow).Present(DateTime.Now); } protected override void OnKeyDown(KeyEventArgs e) diff --git a/Libraries/UniversalEditor.UserInterface/EditorDocumentExplorer.cs b/Libraries/UniversalEditor.UserInterface/EditorDocumentExplorer.cs index efd05dcd..fb782833 100644 --- a/Libraries/UniversalEditor.UserInterface/EditorDocumentExplorer.cs +++ b/Libraries/UniversalEditor.UserInterface/EditorDocumentExplorer.cs @@ -40,7 +40,7 @@ namespace UniversalEditor.UserInterface { get { - ListViewControl lv = ((MainWindow)(Application.Instance as IHostApplication).CurrentWindow).DocumentExplorerPanel.ListView; + ListViewControl lv = ((MainWindow)(Application.Instance as UIApplication).CurrentWindow).DocumentExplorerPanel.ListView; if (lv.SelectedRows.Count > 0) { return lv.SelectedRows[0].GetExtraData("node"); @@ -52,7 +52,7 @@ namespace UniversalEditor.UserInterface TreeModelRow row = FindRow(value); if (row != null) { - ListViewControl lv = ((MainWindow)(Application.Instance as IHostApplication).CurrentWindow).DocumentExplorerPanel.ListView; + ListViewControl lv = ((MainWindow)(Application.Instance as UIApplication).CurrentWindow).DocumentExplorerPanel.ListView; lv.SelectedRows.Clear(); lv.SelectedRows.Add(row); @@ -63,7 +63,7 @@ namespace UniversalEditor.UserInterface private TreeModelRow FindRow(EditorDocumentExplorerNode node, TreeModelRow parent = null) { - ListViewControl lv = ((MainWindow)(Application.Instance as IHostApplication).CurrentWindow).DocumentExplorerPanel.ListView; + ListViewControl lv = ((MainWindow)(Application.Instance as UIApplication).CurrentWindow).DocumentExplorerPanel.ListView; TreeModelRow.TreeModelRowCollection coll = lv.Model.Rows; if (parent != null) diff --git a/Libraries/UniversalEditor.UserInterface/Editors/Database/Views/ScriptView.cs b/Libraries/UniversalEditor.UserInterface/Editors/Database/Views/ScriptView.cs index 3355d69d..8f55a55a 100644 --- a/Libraries/UniversalEditor.UserInterface/Editors/Database/Views/ScriptView.cs +++ b/Libraries/UniversalEditor.UserInterface/Editors/Database/Views/ScriptView.cs @@ -200,7 +200,7 @@ namespace UniversalEditor.UserInterface.Editors.Database.Views d.IsSaved = false; d.IsChanged = true; d.Title = "New Query"; - (Application.Instance as IHostApplication).CurrentWindow.OpenFile(new Document[] + ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow).OpenFile(new Document[] { d }); diff --git a/Libraries/UniversalEditor.UserInterface/Editors/FileSystem/FileSystemEditor.cs b/Libraries/UniversalEditor.UserInterface/Editors/FileSystem/FileSystemEditor.cs index 119392ee..d3f038fe 100644 --- a/Libraries/UniversalEditor.UserInterface/Editors/FileSystem/FileSystemEditor.cs +++ b/Libraries/UniversalEditor.UserInterface/Editors/FileSystem/FileSystemEditor.cs @@ -149,7 +149,7 @@ namespace UniversalEditor.Editors.FileSystem EmbeddedFileAccessor ma = new EmbeddedFileAccessor(f); Document doc = new Document(ma); doc.Saved += doc_Saved; - (Application.Instance as IHostApplication).CurrentWindow.OpenFile(doc); + ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.OpenFile(doc); } else if (fso is Folder) { @@ -259,7 +259,7 @@ namespace UniversalEditor.Editors.FileSystem if (fsom == null) return; - Document d = (Application.Instance as IHostApplication).CurrentWindow.NewFile(); + Document d = ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.NewFile(); if (d != null) { BeginEdit(); diff --git a/Libraries/UniversalEditor.UserInterface/Engine.cs b/Libraries/UniversalEditor.UserInterface/Engine.cs index 283767b4..9cbbc8a4 100644 --- a/Libraries/UniversalEditor.UserInterface/Engine.cs +++ b/Libraries/UniversalEditor.UserInterface/Engine.cs @@ -470,50 +470,50 @@ namespace UniversalEditor.UserInterface #region Perspective Application.Instance.AttachCommandEventHandler("ViewPerspective1", delegate(object sender, EventArgs e) { - (Application.Instance as IHostApplication).CurrentWindow.SwitchPerspective(1); + ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.SwitchPerspective(1); }); Application.Instance.AttachCommandEventHandler("ViewPerspective2", delegate(object sender, EventArgs e) { - (Application.Instance as IHostApplication).CurrentWindow.SwitchPerspective(2); + ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.SwitchPerspective(2); }); Application.Instance.AttachCommandEventHandler("ViewPerspective3", delegate(object sender, EventArgs e) { - (Application.Instance as IHostApplication).CurrentWindow.SwitchPerspective(3); + ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.SwitchPerspective(3); }); Application.Instance.AttachCommandEventHandler("ViewPerspective4", delegate(object sender, EventArgs e) { - (Application.Instance as IHostApplication).CurrentWindow.SwitchPerspective(4); + ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.SwitchPerspective(4); }); Application.Instance.AttachCommandEventHandler("ViewPerspective5", delegate(object sender, EventArgs e) { - (Application.Instance as IHostApplication).CurrentWindow.SwitchPerspective(5); + ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.SwitchPerspective(5); }); Application.Instance.AttachCommandEventHandler("ViewPerspective6", delegate(object sender, EventArgs e) { - (Application.Instance as IHostApplication).CurrentWindow.SwitchPerspective(6); + ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.SwitchPerspective(6); }); Application.Instance.AttachCommandEventHandler("ViewPerspective7", delegate(object sender, EventArgs e) { - (Application.Instance as IHostApplication).CurrentWindow.SwitchPerspective(7); + ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.SwitchPerspective(7); }); Application.Instance.AttachCommandEventHandler("ViewPerspective8", delegate(object sender, EventArgs e) { - (Application.Instance as IHostApplication).CurrentWindow.SwitchPerspective(8); + ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.SwitchPerspective(8); }); Application.Instance.AttachCommandEventHandler("ViewPerspective9", delegate(object sender, EventArgs e) { - (Application.Instance as IHostApplication).CurrentWindow.SwitchPerspective(9); + ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.SwitchPerspective(9); }); #endregion Application.Instance.AttachCommandEventHandler("ViewStartPage", delegate(object sender, EventArgs e) { - (Application.Instance as IHostApplication).CurrentWindow.ShowStartPage(); + ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.ShowStartPage(); }); Application.Instance.AttachCommandEventHandler("ViewStatusBar", delegate (object sender, EventArgs e) { - (Application.Instance as IHostApplication).CurrentWindow.StatusBar.Visible = !(Application.Instance as IHostApplication).CurrentWindow.StatusBar.Visible; - Application.Instance.Commands["ViewStatusBar"].Checked = (Application.Instance as IHostApplication).CurrentWindow.StatusBar.Visible; + ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow).StatusBar.Visible = !((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow).StatusBar.Visible; + Application.Instance.Commands["ViewStatusBar"].Checked = ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow).StatusBar.Visible; }); #endregion diff --git a/Libraries/UniversalEditor.UserInterface/Pages/StartPage.cs b/Libraries/UniversalEditor.UserInterface/Pages/StartPage.cs index 9649c166..0f9ca6bd 100644 --- a/Libraries/UniversalEditor.UserInterface/Pages/StartPage.cs +++ b/Libraries/UniversalEditor.UserInterface/Pages/StartPage.cs @@ -67,11 +67,11 @@ namespace UniversalEditor.UserInterface.Panels private void cmdCreateNewProject_Click(object sender, EventArgs e) { - (Application.Instance as IHostApplication).CurrentWindow?.NewProject(); + ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.NewProject(); } private void cmdOpenExistingProject_Click(object sender, EventArgs e) { - (Application.Instance as IHostApplication).CurrentWindow?.OpenProject(); + ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.OpenProject(); } } } diff --git a/Libraries/UniversalEditor.UserInterface/Panels/SolutionExplorerPanel.cs b/Libraries/UniversalEditor.UserInterface/Panels/SolutionExplorerPanel.cs index d950e6b3..9efb5585 100644 --- a/Libraries/UniversalEditor.UserInterface/Panels/SolutionExplorerPanel.cs +++ b/Libraries/UniversalEditor.UserInterface/Panels/SolutionExplorerPanel.cs @@ -301,7 +301,7 @@ namespace UniversalEditor.UserInterface.Panels Accessors.MemoryAccessor ma = new Accessors.MemoryAccessor(new byte[0], String.Format("{0} Properties", project.Title)); Document d = new Document(project, null, ma); d.Title = String.Format("{0} Properties", project.Title); - (Application.Instance as IHostApplication).CurrentWindow.OpenFile(d); + ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow).OpenFile(d); } else if (file != null) { diff --git a/Libraries/UniversalEditor.UserInterface/UniversalEditor.UserInterface.csproj b/Libraries/UniversalEditor.UserInterface/UniversalEditor.UserInterface.csproj index 89b11fdc..4324b77f 100644 --- a/Libraries/UniversalEditor.UserInterface/UniversalEditor.UserInterface.csproj +++ b/Libraries/UniversalEditor.UserInterface/UniversalEditor.UserInterface.csproj @@ -62,10 +62,7 @@ - - - @@ -132,10 +129,10 @@ - + diff --git a/Plugins.UserInterface/UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration/MultimediaCollaborationPlugin.cs b/Plugins.UserInterface/UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration/MultimediaCollaborationPlugin.cs index 2f397d29..2ebc993f 100644 --- a/Plugins.UserInterface/UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration/MultimediaCollaborationPlugin.cs +++ b/Plugins.UserInterface/UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration/MultimediaCollaborationPlugin.cs @@ -39,7 +39,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration Context = new UIContext(new Guid("{262a622c-c9e3-458b-8fbb-49cf9258b05d}"), "Multimedia Collaboration Plugin"); Context.AttachCommandEventHandler("Collaboration_Tracking_Track", delegate (object sender, EventArgs e) { - Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor(); + Editor editor = ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.GetCurrentEditor(); Document d = editor?.Document; if (d != null) { @@ -74,7 +74,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration }); Context.AttachCommandEventHandler("Collaboration_Tracking_PreviousChange", delegate (object sender, EventArgs e) { - Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor(); + Editor editor = ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.GetCurrentEditor(); Document d = editor?.Document; if (d == null) return; @@ -113,7 +113,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration }); Context.AttachCommandEventHandler("Collaboration_Tracking_NextChange", delegate (object sender, EventArgs e) { - Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor(); + Editor editor = ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.GetCurrentEditor(); Document d = editor?.Document; if (d == null) return; @@ -154,7 +154,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration private SynthesizedAudioCommandChange.SynthesizedAudioCommandChangeCollection GetChangedCommandsList() { - Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor(); + Editor editor = ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.GetCurrentEditor(); Document d = editor?.Document; if (d == null) return null; @@ -172,7 +172,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration private void ed_PianoRoll_NoteInserted(object sender, NoteEventArgs e) { - Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor(); + Editor editor = ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.GetCurrentEditor(); Document d = editor?.Document; CollaborationPlugin plugin = (UserInterfacePlugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin); CollaborationSettings collab = plugin.GetCollaborationSettings(d); @@ -189,7 +189,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration private void ed_PianoRoll_NoteDeleted(object sender, NoteEventArgs e) { - Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor(); + Editor editor = ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.GetCurrentEditor(); Document d = editor?.Document; CollaborationPlugin plugin = (UserInterfacePlugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin); CollaborationSettings collab = plugin.GetCollaborationSettings(d); @@ -215,7 +215,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration { get { - Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor(); + Editor editor = ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.GetCurrentEditor(); Document d = editor?.Document; CollaborationPlugin plugin = (UserInterfacePlugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin); CollaborationSettings collab = plugin.GetCollaborationSettings(d); @@ -223,7 +223,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration } set { - Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor(); + Editor editor = ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.GetCurrentEditor(); Document d = editor?.Document; CollaborationPlugin plugin = (UserInterfacePlugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin); CollaborationSettings collab = plugin.GetCollaborationSettings(d); @@ -234,7 +234,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration private void ed_PianoRoll_Paint(object sender, PaintEventArgs e) { // painting is handled by PianoRoll._vp, not PianoRollView!!! - SynthesizedAudioEditor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor() as SynthesizedAudioEditor; + SynthesizedAudioEditor editor = ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.GetCurrentEditor() as SynthesizedAudioEditor; CollaborationPlugin plugin = (UserInterfacePlugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin); CollaborationSettings collab = plugin.GetCollaborationSettings(); @@ -254,7 +254,7 @@ namespace UniversalEditor.Plugins.Multimedia.UserInterface.Collaboration private void ed_PianoRoll_NoteRendered(object sender, NoteRenderedEventArgs e) { - Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor(); + Editor editor = ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.GetCurrentEditor(); Document d = editor?.Document; CollaborationPlugin plugin = (UserInterfacePlugin.Get(new Guid("{981d54ae-dee6-47c7-bea6-20890b3baa23}")) as CollaborationPlugin); CollaborationSettings collab = plugin.GetCollaborationSettings(d); diff --git a/Plugins/UniversalEditor.Plugins.AutoSave/AutoSavePlugin.cs b/Plugins/UniversalEditor.Plugins.AutoSave/AutoSavePlugin.cs index 78ba264f..34e7104c 100644 --- a/Plugins/UniversalEditor.Plugins.AutoSave/AutoSavePlugin.cs +++ b/Plugins/UniversalEditor.Plugins.AutoSave/AutoSavePlugin.cs @@ -43,14 +43,14 @@ namespace UniversalEditor.Plugins.AutoSave { Console.WriteLine("autosave: looking for dirty documents..."); - IHostApplication ha = (Application.Instance as IHostApplication); + UIApplication ha = (Application.Instance as UIApplication); string path = System.IO.Path.Combine(new string[] { GetAutosavePath(), DateTime.Now.ToString("yyyyMMdd") }); Console.WriteLine("autosave: saving dirty documents in /tmp/autosave/universal-editor/..."); - for (int i = 0; i < ha.CurrentWindow.Editors.Count; i++) + for (int i = 0; i < (ha.CurrentWindow as IHostApplicationWindow).Editors.Count; i++) { - Editor ed = ha.CurrentWindow.Editors[i]; + Editor ed = (ha.CurrentWindow as IHostApplicationWindow).Editors[i]; if (ed.Changed || !ed.Document.IsSaved) { string filename = System.IO.Path.Combine(new string[] { path, String.Format("{0}{1}.tmp", DateTime.Now.ToString("HHmmss"), i.ToString().PadLeft(2, '0')) }); diff --git a/Plugins/UniversalEditor.Plugins.Collaboration/CollaborationPlugin.cs b/Plugins/UniversalEditor.Plugins.Collaboration/CollaborationPlugin.cs index 37f1520e..8be7aa40 100644 --- a/Plugins/UniversalEditor.Plugins.Collaboration/CollaborationPlugin.cs +++ b/Plugins/UniversalEditor.Plugins.Collaboration/CollaborationPlugin.cs @@ -34,7 +34,7 @@ namespace UniversalEditor.Plugins.Collaboration { if (document == null) { - document = (Application.Instance as IHostApplication).CurrentWindow?.GetCurrentEditor()?.Document; + document = ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.GetCurrentEditor()?.Document; } if (!_CollaborationSettings.ContainsKey(document)) @@ -50,7 +50,7 @@ namespace UniversalEditor.Plugins.Collaboration Context = new UIContext(ID, "Collaboration Plugin"); Context.AttachCommandEventHandler("Collaboration_Tracking_Track", delegate (object sender, EventArgs e) { - Editor editor = (Application.Instance as IHostApplication).CurrentWindow.GetCurrentEditor(); + Editor editor = ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.GetCurrentEditor(); Document d = editor?.Document; if (d != null) { @@ -66,7 +66,7 @@ namespace UniversalEditor.Plugins.Collaboration { base.UpdateMenuItemsInternal(); - Editor ed = (Application.Instance as IHostApplication).CurrentWindow?.GetCurrentEditor(); + Editor ed = ((Application.Instance as UIApplication).CurrentWindow as IHostApplicationWindow)?.GetCurrentEditor(); // not sure why this is registered (in Plugins/UniversalEditor.Plugins.Collaboration/Commands/Review.uexml) as a global command, but whatever Application.Instance.Commands["Collaboration_Comments_New"].Enabled = ed != null;