public void LogInAction(string user, string pwd)
 {
     if (model.Login(user, pwd))
     {
         //((Window)LoginView).Hide();
         viewHandler.Hide(LoginView);
         if (MainView == null)
         {
             MainView = container.GetMainView();
         }
         //((Window)MainView).Show();
         viewHandler.Show(MainView);
         Error = "";
     }
     else
     {
         if (!viewHandler.IsReady(ErrorView)) //ErrorView == null || !((Window)ErrorView).IsVisible)
         {
             ErrorView = container.GetLoginErrorView();
         }
         Error = "Invalid login";
         ErrorView.UpdateView();
         //((Window)ErrorView).ShowDialog();
         viewHandler.ShowModal(ErrorView);
     }
 }
        private void calculate(Action <double> operation, string x)
        {
            var dx = 0d;

            try
            {
                dx    = double.Parse(x);
                Error = "";
            }
            catch (FormatException)
            {
                Error = "Use numbers!";
            }
            catch (Exception ex)
            {
                Error = $"Unexpeced error: {ex.Message}";
            }
            if (Error == "")
            {
                operation(dx);
                MainView.UpdateView();
                if (viewHandler.IsReady(LogView)) //LogView != null && ((Window)LogView).IsVisible)
                {
                    LogView.UpdateView();
                }
            }
            else
            {
                if (!viewHandler.IsReady(ErrorView))          //ErrorView == null || !((Window)ErrorView).IsVisible)
                {
                    ErrorView = container.GetCalcErrorView(); //new ErrorWindow<ICalcController>(model, this);
                }
                ErrorView.UpdateView();
                //((Window)ErrorView).ShowDialog();
                viewHandler.ShowModal(ErrorView);
            }
        }