示例#1
0
 /// <summary>
 /// 只允许单进程开启应用
 /// </summary>
 public static void HasSingle()
 {
     #region
     if ((Process.GetProcessesByName(_processName)).GetUpperBound(0) > 0)
     {
         ExtMessage.ShowError("程序已运行,请查看任务管理器中是否存在" + _processName + ".exe,\r\n然后再确认是否在当前用户下要运行该进程!");
         System.Environment.Exit(0);
     }
     #endregion
 }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fun"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        private bool valid(DLIsValid fun, string message)
        {
            #region
            if (fun())
            {
                ExtMessage.Show(message);
                this.WillValidateControl.Focus();
                return(false);
            }
            return(true);

            #endregion
        }