Esempio n. 1
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (Tag.Text == "")
            {
                Tag.Focus(); return;
            }
            System.Net.IPAddress ip;
            if (!System.Net.IPAddress.TryParse(Dns.Text, out ip))
            {
                Dns.Text = ""; Dns.Focus(); return;
            }

            Builder ClientBuilder = new Builder();

            try
            {
                Convert.ToInt16(Port.Text);
            }
            catch (Exception EX)
            {
                System.Windows.Forms.MessageBox.Show("Error: " + EX.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            SaveFileDialog dlg = new SaveFileDialog();

            //dlg.InitialDirectory = Environment.CurrentDirectory + @"\Clients";
            dlg.DefaultExt = ".exe"; // Default file extension
            dlg.Filter     = "Exe Files (.exe)|*.exe|All Files (*.*)|*.*";

            if (dlg.ShowDialog() != DialogResult.Cancel)
            {
                Dispatcher.Invoke(() =>
                {
                    ClientBuilder.BuildClient(Port.Text, helper.Session.CurrentAuditer.Login.ToString(), Dns.Text, dlg.FileName, Tag.Text, "1",
                                              "False", "False");
                    System.Diagnostics.Process.Start("explorer.exe", dlg.FileName.Substring(0, dlg.FileName.LastIndexOf("\\")));
                });
            }
            else
            {
                return;
            }
        }