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;
                }
            }
            }));
        }
Ejemplo n.º 2
0
        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;
                }
            }
        }