public static void NewWindow(Window owner, MySql mySql, DataSource dataSource) { var window = new MySqlView(mySql, dataSource); window.Owner = owner; window.ShowDialog(); }
private void MenuItem_Click(object sender, RoutedEventArgs e) { var dataItem = HistoryList.SelectedItem as HistoryDetailItem; switch (dataItem.MonitorType) { case MonitorType.Process: var processWindow = new ProcessView(dataSource.GetProcessItem(dataItem.ItemID), dataSource); processWindow.Owner = this; processWindow.ShowDialog(); break; case MonitorType.MySql: var mySqlWindow = new MySqlView(dataSource.GetMySqlItem(dataItem.ItemID), dataSource); mySqlWindow.Owner = this; mySqlWindow.ShowDialog(); break; case MonitorType.HttpUrl: var urlWindow = new HttpUrlView(dataSource.GetUrlItem(dataItem.ItemID), dataSource); urlWindow.Owner = this; urlWindow.ShowDialog(); break; default: MsgBox.Alert("未知监控类型"); break; } }
private void MySqlList_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { var dataItem = MySqlList.SelectedItem as MySql; if (dataItem == null) { return; } MySqlView.NewWindow(this, dataItem, dataSource); }