private void CommonNotificationMessageReceived(NotificationMessage notificationMessage)
        {
            if (notificationMessage.Notification == Messages.ShowAboutWindow)
            {

                AboutWindow aboutWindow = new AboutWindow("Ozeki IVR Studio") { DataContext = notificationMessage.Target, Owner = this };
                aboutWindow.ShowDialog();
            }
        }
예제 #2
0
        private void MessageReceived(NotificationMessage notificationMessage)
        {
            Dispatcher.BeginInvoke(new Action(() =>
            {
                if (notificationMessage.Notification == Messages.NavigateToMainWindow)
                {
                    var settingsRepository = GalaSoft.MvvmLight.Ioc.SimpleIoc.Default.GetInstance<IGenericSettingsRepository<AppPreferences>>();
                    var settings = settingsRepository.GetSettings();

                    try
                    {
                        GalaSoft.MvvmLight.Ioc.SimpleIoc.Default.Register(() => new WcfCrmClient(settings.ConnectionProperties, settings.ClientCredential));
                    }
                    catch (Exception)
                    { }

                    var mainWindow = new MainWindow();

                    mainWindow.Title = string.Format("{0} - {1} ({2})", "Call Center CRM", settings.ClientCredential.UserName, settings.ClientCredential.PhoneNumber);
                    mainWindow.Show();

                    Application.Current.MainWindow = mainWindow;
                }
                else if (notificationMessage.Notification == Messages.ShowAboutWindow)
                {
                    var aboutWindow = new AboutWindow("Call Center CRM");
                    aboutWindow.ShowDialog();
                }
            }));
        }
        void MessageReceived(NotificationMessage notificationMessage)
        {
            Dispatcher.BeginInvoke(new Action(() =>
                                                  {
                                                      if (notificationMessage.Notification == Messages.ShowWaitWindowLoading)
                                                      {
                                                          if (waitWindow != null) waitWindow.Close();

                                                          waitWindow = new WaitWindow("Loading please wait...")
                                                          {
                                                              Owner = this
                                                          };

                                                          waitWindow.Closed += (sender, e) => viewModel.CancelLoading();

                                                          waitWindow.ShowDialog();
                                                      }
                                                      else if (notificationMessage.Notification == Messages.ShowWaitWindowSaving)
                                                      {
                                                          if (waitWindow != null) waitWindow.Close();

                                                          waitWindow = new WaitWindow("Saving please wait...")
                                                          {
                                                              Owner = this
                                                          };

                                                          waitWindow.Closed += (sender, e) => viewModel.CancelLoading();

                                                          waitWindow.ShowDialog();
                                                      }
                                                      else if (notificationMessage.Notification == Messages.ShowAboutWindow)
                                                      {
                                                          if (aboutWindow != null) aboutWindow.Close();

                                                          aboutWindow = new AboutWindow(viewModel.GetApplicationInformation().ProductName)
                                                                           {
                                                                               DataContext = notificationMessage.Target,
                                                                               Owner = this
                                                                           };
                                                          aboutWindow.ShowDialog();
                                                      }

                                                      else if (notificationMessage.Notification == Messages.ShowSettings)
                                                      {
                                                          if (settingsWindow != null)
                                                              settingsWindow.Close();

                                                          settingsWindow = new SettingsWindow
                                                          {
                                                              DataContext = notificationMessage.Target,
                                                              Owner = this
                                                          };
                                                          settingsWindow.ShowDialog();
                                                      }
                                                      else if (notificationMessage.Notification == Messages.DismissWaitWindow)
                                                      {
                                                          if (waitWindow != null)
                                                          {
                                                              waitWindow.Close();
                                                              waitWindow = null;
                                                          }
                                                      }
                                                      else if (notificationMessage.Notification == Messages.DismissSettingsWindow)
                                                      {
                                                          if (settingsWindow != null)
                                                          {
                                                              settingsWindow.Close();
                                                              settingsWindow = null;
                                                          }
                                                      }
                                                      else if (notificationMessage.Notification == Messages.ReValidateAllRows)
                                                      {
                                                          RevalidateAllRows();
                                                      }
                                                      else if (notificationMessage.Notification == Messages.RefreshDataGridRowNumbers)
                                                      {
                                                          CustumerDataGrid.Items.Refresh();
                                                      }
                                                  }));
        }
예제 #4
0
        private void MessageReceived(NotificationMessage notificationMessage)
        {
            Dispatcher.BeginInvoke(new Action(() =>
            {
                if (notificationMessage.Notification == Messages.NavigateToMainWindow)
                {
                    var mainWindow = new MainWindow();
                    mainWindow.Show();

                    Application.Current.MainWindow = mainWindow;
                }
                else if (notificationMessage.Notification == Messages.ShowAboutWindow)
                {
                    var aboutWindow = new AboutWindow("Call Center CRM Server");
                    aboutWindow.ShowDialog();
                }
                else if (notificationMessage.Notification == MainViewModel.ReRegisterDatabaseClient)
                {
                    var settingsRepository = SimpleIoc.Default.GetInstance<IGenericSettingsRepository<AppPreferences>>();
                    var settings = settingsRepository.GetSettings();

                    SimpleIoc.Default.Unregister<IDatabaseClient<CrmEntry>>();
                    SimpleIoc.Default.Register<IDatabaseClient<CrmEntry>>(() => new DatabaseClient<CrmEntry>(settings.DatabaseConnectionProperties));
                }
                else if (notificationMessage.Notification == MainViewModel.ReRegisterServiceHost)
                {
                    var settingsRepository = SimpleIoc.Default.GetInstance<IGenericSettingsRepository<AppPreferences>>();
                    var settings = settingsRepository.GetSettings();

                    InitServiceHost(settings.WcfConnectionProperties);
                }
            }));
        }