public MainWindow()
 {
     InitializeComponent();
     app = (App)App.Current;
     client = app.Client;
     initialize();
 }
 public LoginWindow()
 {
     InitializeComponent();
     app = (App)App.Current;
     client = app.Client;
     ServerIP.Text = client.ServerAddress.ToString();
     ServerPort.Text = client.ServerPort.ToString();
     utf8Encoder = new UTF8Encoding();
     TitleLabel.Content = "Strategie";
     VersionLabel.Content = "verze: " + app.Version.ToString();
     exit = new BitmapImage(new Uri("/StrategyClient;component/Graphics/exit.png", UriKind.RelativeOrAbsolute));
     exitMouseOver = new BitmapImage(new Uri("/StrategyClient;component/Graphics/exit2.png", UriKind.RelativeOrAbsolute));
     SaveLogin.IsChecked = client.Login != string.Empty;
     if (SaveLogin.IsChecked == true)
     {
         LoginLogin.Text = client.Login;
     }
     #if DEBUG
     LoginPassword.Password = "******";
     #endif
 }
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            Version = Assembly.GetExecutingAssembly().GetName().Version;

            while (true)
            {
                Client = new Client();
                LoadConfig();

                LoginWindow loginWindow = new LoginWindow();
                bool? goAhead = loginWindow.ShowDialog();
                SaveConfig(Client.ServerAddress, Client.ServerPort, LanguageCode.Czech, Client.Login);
                if (goAhead != true)
                {
                    break;
                }
                MainWindow mainWindow = new MainWindow();
                mainWindow.ShowDialog();
                Client.Dispose();
            }
            Shutdown();
        }