diff --git a/Mirivoice/App.axaml.cs b/Mirivoice/App.axaml.cs index 7b4c8f8..8f2234b 100644 --- a/Mirivoice/App.axaml.cs +++ b/Mirivoice/App.axaml.cs @@ -65,9 +65,10 @@ public override void OnFrameworkInitializationCompleted() } } - mainviewModel.OnPropertyChanged((mainviewModel.Title)); + mainWindow.Content = new MainView(mainviewModel); mainWindow.DataContext = mainviewModel; - desktop.MainWindow = mainWindow; + mainviewModel.OnPropertyChanged((mainviewModel.Title)); + desktop.MainWindow = mainWindow; } base.OnFrameworkInitializationCompleted(); diff --git a/Mirivoice/Commands/AddLineBoxReceiver.cs b/Mirivoice/Commands/AddLineBoxCommand.cs similarity index 75% rename from Mirivoice/Commands/AddLineBoxReceiver.cs rename to Mirivoice/Commands/AddLineBoxCommand.cs index 49a577e..a462b41 100644 --- a/Mirivoice/Commands/AddLineBoxReceiver.cs +++ b/Mirivoice/Commands/AddLineBoxCommand.cs @@ -3,21 +3,20 @@ namespace Mirivoice.Commands { - public class AddLineBoxReceiver : MReceiver + public class AddLineBoxCommand : ICommand { private readonly MainViewModel v; private int LineBoxIndexLastAdded; - public AddLineBoxReceiver(MainViewModel mainViewModel) + public AddLineBoxCommand(MainViewModel mainViewModel) { v = mainViewModel; } - public override void DoAction() + public void Execute(bool isRedoing) { - - var lineBox = new LineBoxView(v); + var lineBox = new LineBoxView(v); int LineNoToBeAdded = v.LineBoxCollection.Count + 1; - + lineBox.viewModel.SetLineNo(LineNoToBeAdded); lineBox.ShouldPhonemizeWhenSelected = true; @@ -26,7 +25,7 @@ public override void DoAction() lineBox.ScrollToEnd(); } - public override void UndoAction() + public void UnExecute() { if (LineBoxIndexLastAdded < 0) return; @@ -37,5 +36,6 @@ public override void UndoAction() } + } } diff --git a/Mirivoice/Commands/AddLineBoxesReceiver.cs b/Mirivoice/Commands/AddLineBoxesCommand.cs similarity index 92% rename from Mirivoice/Commands/AddLineBoxesReceiver.cs rename to Mirivoice/Commands/AddLineBoxesCommand.cs index 81371b9..f047dff 100644 --- a/Mirivoice/Commands/AddLineBoxesReceiver.cs +++ b/Mirivoice/Commands/AddLineBoxesCommand.cs @@ -10,7 +10,7 @@ namespace Mirivoice.Commands { - public class AddLineBoxesReceiver : MReceiver + public class AddLineBoxesCommand : ICommand { private MainViewModel v; private int InitialEndOfLineBoxCollection; @@ -20,23 +20,19 @@ public class AddLineBoxesReceiver : MReceiver int DefaultVoicerMetaOriginal; - public AddLineBoxesReceiver(MainViewModel mainViewModel) + public AddLineBoxesCommand(MainViewModel mainViewModel) { v = mainViewModel; InitialEndOfLineBoxCollection = v.LineBoxCollection.Count - 1; // if undo, remove all lineboxes after this index DefaultVoicerOriginal = MainManager.Instance.DefaultVoicerIndex; DefaultVoicerMetaOriginal = MainManager.Instance.DefaultMetaIndex; - } - public void SetScript(string newscript) // should be called when script is changed - { - script = newscript; + script = v.mTextBoxEditor.CurrentScript; InitialEndOfLineBoxCollection = v.LineBoxCollection.Count - 1; // if undo, remove all lineboxes after this index - } - public override void DoAction() + public void Execute(bool isRedoing) { string pattern = @"\[(?[^\]]+)\](?:\s*\((?