void windowRequests_WindowLoaded(object sender, EventArgs e) { PartWithNotify partWithNotify = (PartWithNotify)View.CurrentItem; WindowRequests windowRequests = (WindowRequests)sender; windowRequests.OpenWindowInsertRequest(partWithNotify); }
private void RibbonButtonAddRequest_OnClick(object sender, RoutedEventArgs e) { if (View.CurrentItem == null) { return; } PartWithNotify partWithNotify = (PartWithNotify)View.CurrentItem; bool isWindowRequestOpen = false; WindowRequests windowRequests = null; foreach (var window in Application.Current.Windows) { if (window.GetType() == typeof(WindowRequests)) { isWindowRequestOpen = true; windowRequests = (WindowRequests)window; windowRequests.Activate(); windowRequests.OpenWindowInsertRequest(partWithNotify); break; } } if (isWindowRequestOpen == false) { windowRequests = new WindowRequests(); windowRequests.WindowLoaded += windowRequests_WindowLoaded; windowRequests.Show(); } }