Тема: c# WPF
Показать сообщение отдельно
Непрочитано 01.01.2018, 22:19   #1
Забанен за кидаловo/обман/развод

Автор темы (Топик Стартер) c# WPF

Пробую создать лаунчер , но вот не могу понять как сделать так чтобы при вводе логина и пароля , он их использовал как параметры запуска.
Вот логин

 
<Window x:Class="Launcher.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Launcher"
        mc:Ignorable="d"
        Title="Launcher" Height="350" Width="525">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="78*"/>
            <ColumnDefinition Width="439*"/>
        </Grid.ColumnDefinitions>
        <Label Content="Login" HorizontalAlignment="Left" Margin="7.647,100,0,0" VerticalAlignment="Top" Grid.Column="1"/>
        <Label Content="Password" HorizontalAlignment="Left" Margin="7.647,155,0,0" VerticalAlignment="Top" Grid.Column="1"/>
        <Button Content="Start" HorizontalAlignment="Left" Margin="141.647,197,0,0" VerticalAlignment="Top" Width="75" Grid.Column="1" Click="Start"/>
        <TextBox HorizontalAlignment="Left" Height="23" Margin="79.647,103,0,0" TextWrapping="Wrap" Text="Login" VerticalAlignment="Top" Width="201" Grid.Column="1" TextChanged="Login"/>
        <TextBox HorizontalAlignment="Left" Height="23" Margin="79.647,155,0,0" TextWrapping="Wrap" Text="Password" VerticalAlignment="Top" Width="201" Grid.Column="1" TextChanged="Password"/>
    </Grid>
</Window>
 
 
Code: XML
Создал класс Launcher и там прописал
 
public class StartLauncher
    {
        private static string _login;
        private static string _password;
        public static void Run()
        {
            var Login = Login;
            var Password = Password;
            var process = new Process
            {
                StartInfo =
              {
                  FileName = "PiercingBlow.exe",
                  Arguments = String.Format("/Login:\"{0}\" /Password:{1}", Login, Password)
              }
 
            };
            process.Start();
        }
        public static string Login
        {
            get { return _login; }
            set { _login = value; }
        }
        public static string Password
        {
            get { return _password; }
            set { _password = value; }
        }
    }
 
Code: C#
Но не работает почему то.
Boris2105 вне форума Ответить с цитированием