private void NotificationMessageReceived(NotificationMessageEx message) { if (message.Notification == MsgDestination.WindowMain) // Csak akkor foglalkozunk az özenettel, ha nekünk szól { switch (message.Command) { case MsgCommand.PopulateTreeView: MenuTreeView.Items.Clear(); PopulateTreeView((List <VmIVRMenuElementBase>)message.Parameters[0], IVRMenuElementBase.RootIdentifier, null); if (MenuTreeView.Items.Count > 0 && MenuTreeView.Items.GetItemAt(0) is TreeViewItem) { TreeViewItem root = (TreeViewItem)MenuTreeView.Items.GetItemAt(0); root.IsExpanded = true; } break; case MsgCommand.ShowWindowApiExtensionSelector: if (wndApiExtension != null) { wndApiExtension.Close(); wndApiExtension = null; } wndApiExtension = new WindowAPIExtensionSelector(); wndApiExtension.Owner = this; wndApiExtension.Show(); break; case MsgCommand.ShowLoadDialog: var opendlg = new OpenFileDialog(); opendlg.DefaultExt = ".ozivr"; opendlg.Title = "Open an Ozeki IVR Studion project"; opendlg.Filter = "Ozeki IVR Studio project file (.ozivr)|*.ozivr"; if (opendlg.ShowDialog() == true) { ((FileOperationMessage)message.Parameters[0]).Callback(opendlg.FileName); } break; case MsgCommand.ShowDialogQuestion: DialogMessageEx dialogMessageEx = (DialogMessageEx)message.Parameters[0]; var result = MessageBox.Show(dialogMessageEx.Content, dialogMessageEx.Caption, MessageBoxButton.OKCancel, MessageBoxImage.Question); dialogMessageEx.Callback.Invoke(result); break; case MsgCommand.StartWithExtension: Dispatcher.BeginInvoke(new Action(() => { ((VmMain)DataContext).StartEnginewith(message.Parameters[0]); })); break; } } }
private void NotificationMessageReceived(NotificationMessageEx message) { Dispatcher.BeginInvoke(new Action(() => { if (message.Notification == MsgDestination.WindowApiExtension) // Csak akkor foglalkozunk az özenettel, ha nekünk szól { switch (message.Command) { case MsgCommand.CloseWindow: this.Close(); break; case MsgCommand.ShowDialogQuestion: DialogMessageEx dialogMessageEx = (DialogMessageEx)message.Parameters[0]; var result = MessageBox.Show(dialogMessageEx.Content, dialogMessageEx.Caption, MessageBoxButton.OKCancel, MessageBoxImage.Question); dialogMessageEx.Callback.Invoke(result); break; case MsgCommand.ShowWaitWindow: if (waitWindow != null) { waitWindow.Close(); } waitWindow = new WaitWindow("Loading please wait..."); waitWindow.Closed += waitWindow_Closed; waitWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; waitWindow.Owner = this; waitWindow.Show(); break; case MsgCommand.CloseWaitWindow: if (waitWindow != null) { waitWindow.Closed -= waitWindow_Closed; waitWindow.Close(); waitWindow = null; } break; } } })); }
private void CreateNewProject(object currentMenuTree) { Messenger.Default.Send(new NotificationMessageEx(MsgDestination.WindowMain, MsgCommand.ShowSaveQuestion, DialogMessageEx.CreateQuestionBox("Do you wish to save current project before creating a new project?", (result => { if (result == MessageBoxResult.Yes) { SaveProject(currentMenuTree); } })))); Messenger.Default.Send(new NotificationMessageEx(MsgDestination.WindowMain, MsgCommand.ShowWindowNewProject)); }
private void LoadProject(object currentTree) { Messenger.Default.Send(new NotificationMessageEx(MsgDestination.WindowMain, MsgCommand.ShowSaveQuestion, DialogMessageEx.CreateQuestionBox("Do you wish to save current project before loads an other project?", (result => { if (result == MessageBoxResult.Yes) { SaveProject(currentTree); } })))); Messenger.Default.Send(new NotificationMessageEx(MsgDestination.WindowMain, MsgCommand.ShowLoadDialog, new FileOperationMessage(( resPath) => { CurrentProject = new VmIVRProject(model.LoadProject(resPath)); CurrentProject.SavePath = resPath; }))); }
private void NotificationMessageReceived(NotificationMessageEx message) { if (message.Notification == MsgDestination.WindowMain) // Csak akkor foglalkozunk az özenettel, ha nekünk szól { switch (message.Command) { case MsgCommand.PopulateTreeView: MenuTreeView.Items.Clear(); PopulateTreeView((List <VmIVRMenuElementBase>)message.Parameters[0], IVRMenuElementBase.RootIdentifier, null); if (MenuTreeView.Items.Count > 0 && MenuTreeView.Items.GetItemAt(0) is TreeViewItem) { TreeViewItem root = (TreeViewItem)MenuTreeView.Items.GetItemAt(0); root.IsExpanded = true; } break; case MsgCommand.UpdateTreeDatas: UpdateTreeDatas(); Debug.WriteLine(resList.ToString()); break; case MsgCommand.DeleteSelectedItem: if (MessageBox.Show("Are you sure you want to delete the selected menu?", "Delete menu", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { DeleteSelectedItem((TreeViewItem)message.Parameters[0]); } break; case MsgCommand.ShowSavedialog: var dlg = new SaveFileDialog(); dlg.DefaultExt = ".ozivr"; dlg.Title = "Save Ozeki IVR Studio project"; dlg.FileName = (string)message.Parameters[1]; dlg.Filter = "Ozeki IVR Studio project file (.ozivr)|*.ozivr"; if (dlg.ShowDialog() == true) { ((FileOperationMessage)message.Parameters[0]).Callback(dlg.FileName); } break; case MsgCommand.ShowLoadDialog: var opendlg = new OpenFileDialog(); opendlg.DefaultExt = ".ozivr"; opendlg.Title = "Open an Ozeki IVR Studion project"; opendlg.Filter = "Ozeki IVR Studio project file (.ozivr)|*.ozivr"; if (opendlg.ShowDialog() == true) { ((FileOperationMessage)message.Parameters[0]).Callback(opendlg.FileName); } break; case MsgCommand.ShowSaveQuestion: DialogMessageEx dialogMessageEx = (DialogMessageEx)message.Parameters[0]; var result = MessageBox.Show(dialogMessageEx.Content, dialogMessageEx.Caption, MessageBoxButton.YesNo, MessageBoxImage.Question); dialogMessageEx.Callback.Invoke(result); break; case MsgCommand.ShowWindowNewProject: WindowNewProject wndNewProject = new WindowNewProject(); wndNewProject.Owner = this; wndNewProject.ShowDialog(); break; case MsgCommand.UpdateProject: ((VmMain)this.DataContext).CurrentProject = (VmIVRProject)message.Parameters[0]; break; } } }