private void DealWindowMessage(WindowMessage message) { if (string.IsNullOrWhiteSpace(message.WindowName)) { return; } Window window; try { Assembly assembly = Assembly.GetEntryAssembly(); window = assembly .CreateInstance(assembly.GetName().Name + ".View." + message.WindowName, true, BindingFlags.Default, null, message.Param, null, null) as Window; } catch { throw new Exception(message.WindowName + "初始化失败"); } if (window == null) { return; } switch (message.Operation) { case WindowOperation.Show: { window.WindowStartupLocation = message.StartupLocation; window.Show(); } break; case WindowOperation.ShowDialog: { window.WindowStartupLocation = message.StartupLocation; window.ShowDialog(); try { if (message.ProcessCallback != null) { var data = window.DataContext as ExamViewModelBase; if (data != null) { message.ProcessCallback(data.CallBackResult); } } } catch { } } break; } }