private void show_matrix_separate_thread()
        {
            System.Threading.Thread win = new System.Threading.Thread(delegate()
            {
                var viewer = new matrix_window(d.get_matrix());
                viewer.Show();
                System.Windows.Threading.Dispatcher.Run();
            });

            win.SetApartmentState(System.Threading.ApartmentState.STA);
            win.Start();
        }
        private void show_matrix(object sender, RoutedEventArgs e)
        {
            string pass = Regex.Replace(password.Text.ToLower(), "[^a-z]", "");

            if (pass != "" && pass != "wpiszhaso")
            {
                password.Text = pass;
                d.set_matrix(pass);
                matrix_window win = new matrix_window(d.get_matrix());
                win.Show();
            }
            else
            {
                MessageBoxResult result = MessageBox.Show("Podaj hasło.");
                password.Text = "Wpisz hasło";
            }
        }