Merge branch 'master' of http://192.168.0.12:13000/sc/formula_manage
This commit is contained in:
commit
a25f599430
5 files changed
+127
-75
No files matched your search
+37
-30
@@ -14,6 +14,7 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace formula_manage
|
||||
{
|
||||
@@ -21,36 +22,13 @@ namespace formula_manage
|
||||
/// Login.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class Login : Window
|
||||
{
|
||||
[DllImport("user32.dll", SetLastError = true)]
|
||||
static extern void keybd_event(byte bVk, byte bScan, uint dwFlags, UIntPtr dwExtraInfo);
|
||||
public static void PressKey(Keys key, bool up)
|
||||
{
|
||||
const int KEYEVENTF_EXTENDEDKEY = 0x1;
|
||||
const int KEYEVENTF_KEYUP = 0x2;
|
||||
if (up)
|
||||
{
|
||||
keybd_event((byte)key, 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, (UIntPtr)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
keybd_event((byte)key, 0x45, KEYEVENTF_EXTENDEDKEY, (UIntPtr)0);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
public Login()
|
||||
{
|
||||
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void TextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
||||
{
|
||||
Regex re = new Regex("^[1-9]+[0-9]*$");
|
||||
|
||||
e.Handled = !re.IsMatch(e.Text);
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e) //退出按钮事件
|
||||
{
|
||||
this.Close();
|
||||
@@ -71,20 +49,49 @@ namespace formula_manage
|
||||
}*/
|
||||
}
|
||||
|
||||
private void SearchBox_OnKeyDownd(object sender, System.Windows.Input.KeyEventArgs e)
|
||||
private void SearchBox_OnKeyDownd(object sender, System.Windows.Input.KeyEventArgs e) //回车跳转功能
|
||||
{
|
||||
if (e.Key == Key.Enter)
|
||||
{
|
||||
//SendKeys.SendWait("{Tab}");
|
||||
PressKey(Keys.Tab, false);
|
||||
PressKey(Keys.Tab, true);
|
||||
UserClass.PressKey.PressKeys(Keys.Tab, false);
|
||||
UserClass.PressKey.PressKeys(Keys.Tab, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
public string INIPath = Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "formula.ini";
|
||||
|
||||
|
||||
string TEXT_SQLIP;
|
||||
string TEXT_SQLNAME;
|
||||
string TEXT_SQMOD;
|
||||
string TEXT_SQLUSER;
|
||||
string TEXT_SQLPASWOR;
|
||||
string Connstr_SC;
|
||||
int i;
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
PressKey(Keys.Tab, false);
|
||||
PressKey(Keys.Tab, true);
|
||||
UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(INIPath);
|
||||
TEXT_SQLIP = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
|
||||
TEXT_SQLNAME = Configini.IniReadvalue("SQL_SERVER", "SQL2");
|
||||
TEXT_SQMOD = Configini.IniReadvalue("SQL_SERVER", "SQL3");
|
||||
TEXT_SQLUSER = Configini.IniReadvalue("SQL_SERVER", "SQL4");
|
||||
TEXT_SQLPASWOR = Configini.IniReadvalue("SQL_SERVER", "SQL5");
|
||||
int.TryParse(Configini.IniReadvalue("SQL_SERVER", "SQL3"), out i); //读数据库状态配置文件
|
||||
if (i == 0)
|
||||
{
|
||||
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";Trusted_Connection=SSPI";
|
||||
}
|
||||
else
|
||||
{
|
||||
Connstr_SC = "server=" + TEXT_SQLIP + ";database=" + TEXT_SQLNAME + ";User ID=" + TEXT_SQLUSER + ";Password=" + TEXT_SQLPASWOR;
|
||||
}
|
||||
SqlConnection conn_DBC = new SqlConnection(Connstr_SC);
|
||||
conn_DBC.Open();
|
||||
conn_DBC.Close();
|
||||
|
||||
UserClass.PressKey.PressKeys(Keys.Tab, false);
|
||||
UserClass.PressKey.PressKeys(Keys.Tab, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user