private void Main_Load_1(object sender, EventArgs e) { picValidCode.Image = Bitmap.FromStream(validCode.CreateCheckCodeImage()); Win32Utility.SetCueText(textBox_username, "请输入用户名"); Win32Utility.SetCueText(textBox_password, "请输入密码"); Win32Utility.SetCueText(textBox_prove, "请输入验证码"); }
public addDrug() { InitializeComponent(); Win32Utility.SetCueText(name, "输入药品名"); Win32Utility.SetCueText(specification, "选择规格"); Win32Utility.SetCueText(unit, "选择记录单位"); Win32Utility.SetCueText(bid, "输入药品进价"); Win32Utility.SetCueText(price, "输入药品售价"); Win32Utility.SetCueText(packing, "选择包装数量"); Win32Utility.SetCueText(approval, "输入批准文号"); specification.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; unit.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; commDao info = new commDao(); List <Specification> specificationList = info.loadSpecification(); for (int i = 0; i < specificationList.Count; i++) { specification.Items.Add(specificationList[i].getName()); } List <Unit> unitList = info.loadUnit(); for (int i = 0; i < unitList.Count; i++) { unit.Items.Add(unitList[i].getName()); } List <String> packingList = info.loadPacking(); for (int i = 0; i < packingList.Count; i++) { packing.Items.Add(packingList[i]); } }
public bool CreateProcessHandler(string lpApplicationName, string lpCommandLine, IntPtr lpProcessAttributes, IntPtr lpThreadAttributes, bool bInheritHandles, uint dwCreationFlags, IntPtr lpEnvironment, string lpCurrentDirectory, ref StartupInfoW lpStartupInfo, ref ProcessInformation pInfo) { var processHook = false; var parameters = new object[] { lpApplicationName, lpCommandLine, lpProcessAttributes, lpThreadAttributes, bInheritHandles, dwCreationFlags, lpEnvironment, lpCurrentDirectory, lpStartupInfo, pInfo }; if (_t != null) { processHook = (bool)_t.CallMethodAndNotifyHooker(parameters); } else { processHook = (bool)RemoteHookerBase.CallMethodAndNotifyHookerStatic(parameters); } lpStartupInfo = (StartupInfoW)parameters[parameters.Length - 2]; pInfo = (ProcessInformation)parameters[parameters.Length - 1]; Win32Utility.ResumeThread(pInfo.HThread); return(processHook); }
private void ManagerFind_Load(object sender, EventArgs e) { picValidCode1.Image = Bitmap.FromStream(validCode.CreateCheckCodeImage()); Win32Utility.SetCueText(textBox_changemanagerusername, "请输入用户名"); Win32Utility.SetCueText(textBox_changemanagerpassword, "请输入新密码"); Win32Utility.SetCueText(textBox_changemanagerconfirm, "请再次输入新密码"); Win32Utility.SetCueText(textBox_changemanagercode, "请输入验证码"); }
private void Change_Load(object sender, EventArgs e) { picValidCode.Image = Bitmap.FromStream(validCode.CreateCheckCodeImage()); Win32Utility.SetCueText(textBox_oldpassword, "请输入旧密码"); Win32Utility.SetCueText(textBox_newpassword, "请输入新密码"); Win32Utility.SetCueText(textBox_confirenewpassword, "请再次输入新密码"); Win32Utility.SetCueText(textBox_prove, "请输入验证码"); }
private static void CreateProcessAHooker_ProcessCreated(object sender, HookedEventArgs e) { Console.WriteLine("Process ID (PID): " + e.Entries["DwProcessId"]); Console.WriteLine("Process Handle : " + e.Entries["HProcess"]); Console.WriteLine("Process Thread : " + e.Entries["HThread"]); var threadHandle = (IntPtr)e.Entries["HThread"]; Win32Utility.ResumeThread(threadHandle); }
private void Find_Load_1(object sender, EventArgs e) { picValidCode1.Image = Bitmap.FromStream(validCode1.CreateCheckCodeImage()); Win32Utility.SetCueText(textBox_username, "请输入学号/用户名"); Win32Utility.SetCueText(textBox_postname, "请输入身份证号"); Win32Utility.SetCueText(textBox_password, "请输入新密码"); Win32Utility.SetCueText(textBox_confirm, "请再次输入新密码"); Win32Utility.SetCueText(textBox_prove, "请输入验证码"); }
public MainForm(string[] args) { InitializeComponent(); Win32Utility.SetCueText(directoryEdit, Properties.Resources.chooseFolderHint); Win32Utility.SetCueText(outputEdit, Properties.Resources.chooseOutputHint); richTextBox1.Rtf = Properties.Resources.rtfHelp; if (args.Length > 0) { setSourceDirectory(args[0]); } }
private void Student_Load(object sender, EventArgs e) { //显示时间姓名 this.timer1.Start(); switch (DateTime.Now.DayOfWeek.ToString()) { case "Monday": weekstr = "星期一"; break; case "Tuesday": weekstr = "星期二"; break; case "Wednesday": weekstr = "星期三"; break; case "Thursday": weekstr = "星期四"; break; case "Friday": weekstr = "星期五"; break; case "Saturday": weekstr = "星期六"; break; case "Sunday": weekstr = "星期日"; break; } Win32Utility.SetCueText(textBox_searchnumber, "输入查询学号"); Win32Utility.SetCueText(textBox_searchname, "输入查询姓名"); string connectStr = "server=localhost;port=3306;database=programpunchsystem;user=root;password=123456;"; MySqlConnection conn = new MySqlConnection(connectStr); MySqlDataAdapter s1 = new MySqlDataAdapter("select * from question where stu_number = '" + student_number + "' ", conn); DataSet d1 = new DataSet(); s1.Fill(d1, "t"); dataGridView_get_answer.DataSource = d1.Tables["t"]; try { conn.Open(); string sql = " select stu_idcard from student where stu_number = '" + student_number + "' "; MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlDataReader get = cmd.ExecuteReader(); //getusername.Read()表示找到 if (get.Read()) { textBox_stu_idcard.Text = get[0].ToString(); get.Close(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); Application.Exit(); } finally { conn.Close(); } }
public XsdCodeGenDialog(string[] xsdfiles) { InitializeComponent(); // Fill the file names text box. tbFileNames.Text = string.Join(";", xsdfiles); this.Text += System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); this.cbAddCustomRequestInterface.CheckedChanged += (o, e) => { this.tbCustomRequestInterface.Visible = this.cbAddCustomRequestInterface.Checked; this.tbCustomRequestInterface.Text = ""; }; Win32Utility.SetCueText(this.tbCustomRequestInterface, "Custom request interface"); }
private void Manager_Load(object sender, EventArgs e) { //显示时间姓名 this.timer1.Start(); switch (DateTime.Now.DayOfWeek.ToString()) { case "Monday": weekstr = "星期一"; break; case "Tuesday": weekstr = "星期二"; break; case "Wednesday": weekstr = "星期三"; break; case "Thursday": weekstr = "星期四"; break; case "Friday": weekstr = "星期五"; break; case "Saturday": weekstr = "星期六"; break; case "Sunday": weekstr = "星期日"; break; } Win32Utility.SetCueText(textBox_searchnumber, "输入查询学号"); Win32Utility.SetCueText(textBox_searchname, "输入查询姓名"); Win32Utility.SetCueText(textBox_changestuid, "输入学生编号"); Win32Utility.SetCueText(textBox_changestupassword, "输入学生密码"); Win32Utility.SetCueText(textBox_changestudays, "输入修改天数"); Win32Utility.SetCueText(textBox_studentsearchname, "输入查询姓名"); Win32Utility.SetCueText(textBox_studentsearchnumber, "输入查询学号"); string connectStr = "server=localhost;port=3306;database=programpunchsystem;user=root;password=123456;"; MySqlConnection conn = new MySqlConnection(connectStr); MySqlDataAdapter s1 = new MySqlDataAdapter("select stu_number, stu_question, date from question where stu_answer is NULL", conn); //创建DataSet对象d DataSet d1 = new DataSet(); //使用fill方法填充DataSet s1.Fill(d1, "t"); //在DataGridView1控件中显示表t dataGridView_question.DataSource = d1.Tables["t"]; try { conn.Open(); string sql = " select admin_id,admin_name,admin_idcard from admin where admin_number = '" + manager_number + "' "; MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlDataReader get = cmd.ExecuteReader(); //getusername.Read()表示找到 if (get.Read()) { id = int.Parse(get[0].ToString()); name = get[1].ToString(); label_showmanagerid.Text = "" + get[0].ToString() + ""; label_showmanagername.Text = "" + get[1].ToString() + ""; label_showmanagerusername.Text = "" + manager_number + ""; textBox_manager_idcard.Text = get[2].ToString(); get.Close(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); Application.Exit(); } finally { conn.Close(); } }
public static void Main() { try { CultureInfo cInf = new CultureInfo(RegistrySettings.Default.UiCulture); Loksim3D.WetterEdit.Resources.Strings.Culture = cInf; } catch (ArgumentException ex) { MessageBox.Show("Invalid Language Settings " + RegistrySettings.Default.UiCulture + "\n" + ex.Message); } if (Environment.OSVersion.Version.Major >= 6 && RegistrySettings.Default.DefaultAdminStartMode != RegistrySettings.AdminStartMode.DoNotStartAsAdmin) { // Unter Vista oder höher prüfen ob wir in das Datenverzeichnis lt. paths.ini schreiben dürfen // Wenn nicht schauen wir ob wir als Admin ausgeführt werden // Wenn nicht als Admin ausgeführt => User fragen ob als Admin ausführen bzw in Optionen nachschauen was user möchte string datadir = L3dFilePath.LoksimDirectory.AbsolutePath; try { string file = TempFileUtility.GetTempFileName("l3d", 0, datadir /*Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)*/); File.Delete(file); } catch (Win32Exception ex) { if (ex.ErrorCode == TempFileUtility.ERROR_ACCESS_DENIED) { IntPtr tkHandle; IntPtr procHandle = Process.GetCurrentProcess().Handle; Win32Utility.OpenProcessToken(procHandle, (uint)System.Security.Principal.TokenAccessLevels.Read, out tkHandle); uint TokenInfLength = 0; bool Result; // first call gets lenght of TokenInformation Result = Win32Utility.GetTokenInformation(tkHandle, Win32Utility.TOKEN_INFORMATION_CLASS.TokenElevation, IntPtr.Zero, TokenInfLength, out TokenInfLength); IntPtr TokenInformation = Marshal.AllocHGlobal((int)TokenInfLength); Result = Win32Utility.GetTokenInformation(tkHandle, Win32Utility.TOKEN_INFORMATION_CLASS.TokenElevation, TokenInformation, TokenInfLength, out TokenInfLength); if (Result) { Win32Utility.TOKEN_ELEVATION TokenElevation = (Win32Utility.TOKEN_ELEVATION)Marshal.PtrToStructure(TokenInformation, typeof(Win32Utility.TOKEN_ELEVATION)); TaskDialog dlg = new TaskDialog { Caption = Strings.UacDlgCaption, InstructionText = Strings.UacDlgInstructionText, Text = Strings.UacDlgText, FooterCheckBoxChecked = false, FooterCheckBoxText = Strings.UacDlgCheckBoxText, Cancelable = false, }; TaskDialogButton btn = new TaskDialogButton { Text = Strings.UacDlgBtnAdmin, UseElevationIcon = true, Default = true }; btn.Click += (sender, e) => dlg.Close(TaskDialogResult.Yes); dlg.Controls.Add(btn); btn = new TaskDialogButton { Text = Strings.UacDlgBtnNoAdmin }; btn.Click += (sender, e) => dlg.Close(TaskDialogResult.No); dlg.Controls.Add(btn); if (RegistrySettings.Default.DefaultAdminStartMode == RegistrySettings.AdminStartMode.StartAsAdmin || dlg.Show() == TaskDialogResult.Yes) { if (dlg.FooterCheckBoxChecked.GetValueOrDefault(false)) { RegistrySettings.Default.DefaultAdminStartMode = RegistrySettings.AdminStartMode.StartAsAdmin; } ProcessStartInfo info = new ProcessStartInfo(); info.FileName = System.Reflection.Assembly.GetCallingAssembly().Location; info.UseShellExecute = true; info.Verb = "runas"; // Provides Run as Administrator info.Arguments = EscapeCommandLineArguments(Environment.GetCommandLineArgs()); Process.Start(info); Marshal.FreeHGlobal(TokenInformation); return; } else if (RegistrySettings.Default.DefaultAdminStartMode == RegistrySettings.AdminStartMode.Ask && dlg.FooterCheckBoxChecked.GetValueOrDefault(false)) { RegistrySettings.Default.DefaultAdminStartMode = RegistrySettings.AdminStartMode.DoNotStartAsAdmin; } } Marshal.FreeHGlobal(TokenInformation); } } } // Der Editor soll pro Installation nur 1x gestartet werden können. // Hat der User mehrere Editoren in unterschiedlichen Verzeichnissen oder mit unterschiedlichen Namen, kann er diese jeweils 1x starten // Deshalb ist in der Unique-ID auch noch die Assembly Location kodiert if (SingleInstance <App> .InitializeAsFirstInstance(Unique + "-" + System.Reflection.Assembly.GetCallingAssembly().Location.GetHashCode())) { var application = new App(); application.InitializeComponent(); application.Run(); // Allow single instance code to perform cleanup operations SingleInstance <App> .Cleanup(); } }
public override void Register() { //Upload to the Store { var a = new EditorAction(); //!!!! a.Name = "Prepare for the Store"; //a.Name = "Upload to the Store"; a.Description = "Uploads the selected product or all products in the selected folder to the NeoAxis Store."; a.CommonType = EditorAction.CommonTypeEnum.General; a.ImageSmall = Properties.Resources.Package_16; a.ImageBig = Properties.Resources.Package_32; a.QatSupport = true; a.ContextMenuSupport = EditorContextMenuWinForms.MenuTypeEnum.Resources; a.RibbonText = ("Upload", ""); a.GetState += delegate(EditorAction.GetStateContext context) { if (context.ObjectsInFocus.DocumentWindow == null && context.ObjectsInFocus.Objects.Length != 0) { var fileItems = context.ObjectsInFocus.Objects.OfType <ContentBrowserItem_File>(); foreach (var fileItem in fileItems) { if (fileItem.IsDirectory) { bool skip = false; if (context.Holder == EditorAction.HolderEnum.ContextMenu) { var files = Directory.GetFiles(fileItem.FullPath, "*.store", SearchOption.AllDirectories); if (files.Length == 0) { skip = true; } } if (!skip) { context.Enabled = true; break; } } if (!fileItem.IsDirectory && Path.GetExtension(fileItem.FullPath).ToLower() == ".store") { context.Enabled = true; break; } } } }; a.Click += delegate(EditorAction.ClickContext context) { if (context.ObjectsInFocus.DocumentWindow == null && context.ObjectsInFocus.Objects.Length != 0) { var realFileNames = new ESet <string>(); { var fileItems = context.ObjectsInFocus.Objects.OfType <ContentBrowserItem_File>(); foreach (var fileItem in fileItems) { if (fileItem.IsDirectory) { realFileNames.AddRangeWithCheckAlreadyContained(Directory.GetFiles(fileItem.FullPath, "*.store", SearchOption.AllDirectories)); } if (!fileItem.IsDirectory && Path.GetExtension(fileItem.FullPath).ToLower() == ".store") { realFileNames.AddWithCheckAlreadyContained(fileItem.FullPath); break; } } } var virtualFileNames = new List <string>(); foreach (var realFileName in realFileNames) { var virtualFileName = VirtualPathUtility.GetVirtualPathByReal(realFileName); if (VirtualFile.Exists(virtualFileName)) { virtualFileNames.Add(virtualFileName); } } if (virtualFileNames.Count == 0) { return; } var text = "Upload selected products to the store?\n\n"; foreach (var fileName in virtualFileNames) { text += fileName + "\n"; } if (EditorMessageBox.ShowQuestion(text, EMessageBoxButtons.OKCancel) == EDialogResult.Cancel) { return; } //process var item = ScreenNotifications.ShowSticky("Processing..."); try { foreach (var fileName in virtualFileNames) { var res = ResourceManager.LoadResource(fileName, true); if (res != null) { var product = res.ResultComponent as Component_StoreProduct; if (product != null) { if (!product.BuildArchive()) { return; } } } } } catch (Exception e) { Log.Warning(e.Message); return; } finally { item.Close(); } if (virtualFileNames.Count > 1) { ScreenNotifications.Show("The products were prepared successfully."); } else { ScreenNotifications.Show("The product was prepared successfully."); } //open folder in the Explorer Win32Utility.ShellExecuteEx(null, Component_StoreProduct.writeToDirectory); } }; EditorActions.Register(a); } }