我就在那心情......
所以這是啤酒軟件...隨時給我買啤酒,如果我們曾經見過...
C#
的app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="WindowsFormsApplication2.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<WindowsFormsApplication2.Properties.Settings>
<setting name="path_to_dccon_exe" serializeAs="String">
<value>J:\dcrypt\dccon.exe</value>
</setting>
<setting name="parameters_for_dccon_exe" serializeAs="String">
<value>-mountall -kf J:\key -p "{0}"</value>
</setting>
</WindowsFormsApplication2.Properties.Settings>
</applicationSettings>
</configuration>
Form1.cs中
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
System.Diagnostics.Process.Start(Properties.Settings.Default.path_to_dccon_exe, string.Format(Properties.Settings.Default.parameters_for_dccon_exe, textBox1.Text));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + "\n\n" + ex.StackTrace, "Exception");
}
}
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(152, 10);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(75, 23);
this.button1.TabIndex = 1;
this.button1.Text = "OK";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(46, 12);
this.textBox1.Name = "textBox1";
this.textBox1.PasswordChar = '*';
this.textBox1.Size = new System.Drawing.Size(100, 20);
this.textBox1.TabIndex = 2;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(272, 42);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "Form1";
this.Text = "unsuspicious Application";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
}
}
編輯:所以...這是我寫的......好吧,除了從上扔2個控制和安排他們
try
{
System.Diagnostics.Process.Start(Properties.Settings.Default.path_to_dccon_exe, string.Format(Properties.Settings.Default.parameters_for_dccon_exe, textBox1.Text));
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + "\n\n" + ex.StackTrace, "Exception");
}
因此不要求代碼正確的地方爲你寫。這是關於*編程的問題,而不是發佈要求。 – skrrgwasme 2014-10-11 20:48:06
嗯,我在問代碼應該是什麼,但好的..你會建議我問什麼呢? – st0rm 2014-10-11 20:54:02
您的評論強調了我的觀點......您要求提供完整的代碼。如果你已經編寫了程序的大部分內容,只需要一步的幫助,但是你要求某人編寫整個程序*並告訴你如何編譯它,那將是不同的。這不是那種要求的。我唯一的建議是把它作爲一個自由職業者的項目。com或其他一些工程承包網站。 – skrrgwasme 2014-10-11 21:05:26