コード例 #1
0
        private void SwitchShell(SwitchShellData data)
        {
            Window           shell           = null;
            IEventAggregator eventAggregator = this.Container.GetExportedValue <IEventAggregator>();

            switch (data.Shell)
            {
            case Infrastructure.ShellType.ProfesionalShell:
                shell = this.Container.GetExportedValue <Views.ProfesionalShell>();
                break;

            case Infrastructure.ShellType.PacienteShell:
                shell = this.Container.GetExportedValue <Views.PacienteShell>();
                PacienteShellShowingEvent pacienteShellShowingEvent = eventAggregator.GetEvent <PacienteShellShowingEvent>();
                pacienteShellShowingEvent.Publish(data);
                break;

            default:
                break;
            }
            if (shell != null)
            {
                Application app = Application.Current;
                for (int intCounter = app.Windows.Count - 1; intCounter >= 0; intCounter--)
                {
                    app.Windows[intCounter].Hide();
                }

                shell.Show();
            }
        }