Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (App.Current.MainWindow != null && App.Current.MainWindow.GetType() == typeof(MainWindow))
- {
- this.Close();
- }
- else
- {
- //main Window hasn't been created yet so create it!
- MainWindow main = new MainWindow();
- App.Current.MainWindow = main;
- this.Close();
- main.Show();
- wndw = main;
- }
- MainWindow main;
- if
- {...
- }
- else
- {...
- }
- main= App.Current.MainWindow;
- var window = Application.Current.Windows.OfType<Window>().SingleOrDefault(w => w.IsActive);
- var main = App.Current.MainWindow as MainWindow
- var main = (MainWindow)App.Current.MainWindow
- public static Window ActivatedWindow {get;set;}
- public class MetroToolWindowBase
- {
- public MetroToolWindowBase()
- {
- Activated += new EventHandler(MakeActive);
- }
- private void MakeActive(object sender, EventArgs e)
- {
- App.ActivatedWindow= this;
- }
- }
- private void XWindow_Activated(object sender,EventArgs e)
- {
- App.ActivatedWindow= this;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement