public void SetView(Type view)
        {
            foreach (ViewBase openView in OpenViews)
            {
                if (openView.GetType().Equals(view))
                {
                    CurrentView = openView;
                    CurrentView.Reset();
                    return;
                }
            }

            CurrentView = Activator.CreateInstance(view) as ViewBase;
            if (CurrentView.TargetDataContext == null)
            {
                CurrentView.DataContext = this;
            }
            else
            {
                var context = Activator.CreateInstance(CurrentView.TargetDataContext, new object[] { mediator });
                var type    = CurrentView.TargetDataContext;
                CurrentView.DataContext = Convert.ChangeType(context, type);
            }
            OpenViews.Add(CurrentView);
        }
        /// <summary>
        /// Creates instance of Window of type T and shows it.
        /// </summary>
        /// <typeparam name="T">Window type</typeparam>
        public void OpenWindow <T>() where T : Window
        {
            if (!CheckIfAlreadyOpened(typeof(T)))
            {
                Window window = (T)Activator.CreateInstance(typeof(T));

                window.Closed += WindowClosed;
                window.Show();

                OpenViews.Add(window, window.DataContext);
            }
        }
        public async Task <bool?> OpenDialogWindow <T>() where T : Window
        {
            Returned = false;

            if (!CheckIfAlreadyOpened(typeof(T)))
            {
                Window window = (T)Activator.CreateInstance(typeof(T));

                window.Closed += DialogWindowClosed;
                window.Show();

                OpenViews.Add(window, window.DataContext);

                while (!Returned)
                {
                    await Task.Delay(100);
                }

                return(DialogResult);
            }

            return(null);
        }