static void Main(string[] args) { IEnumerable <int> setdata = null; string result = null; string myString = string.Empty; int myInt; Console.WriteLine("Max Numbers"); int max = int.Parse(Console.ReadLine()); Console.WriteLine("Key Numbers"); for (int i = 0; i < max; i++) { myString = Console.ReadLine(); var array = myString.ToCharArray().Where(x => int.TryParse (x.ToString(), out myInt)) .Select(x => int.Parse (x.ToString())).ToArray(); var input = new run(); setdata = input.Homework13(array); result += " "; foreach (var item in setdata) { result += item; } } Console.WriteLine(" Double 99 "); Console.WriteLine(result); }
private void Start() { _state = new State(); _idle = new idle(); _eat = new eat(); _run = new run(); }
/// <summary> /// 获取一个线程并执行任务 /// </summary> /// <typeparam name="parameterType">参数类型</typeparam> /// <param name="task">任务委托</param> /// <param name="parameter">线程参数</param> internal void FastStart <parameterType>(Action <parameterType> task, parameterType parameter) { run <parameterType> run = run <parameterType> .Pop(); run.Set(task, parameter); FastStart(run, fastCSharp.threading.thread.callType.Run); }
static void Main(string[] args) { //args = new List<string> (){ "tfNet", "-n", "-i", "/Users/klev/Desktop/downloadedPeaks", "-o", "/Users/klev/Desktop/test1" }.ToArray (); Stopwatch watch = new Stopwatch(); watch.Start(); string invokedVerb = ""; object invokedVerbInstance = new object(); var options = new Options(); if (!CommandLine.Parser.Default.ParseArguments(args, options, (verb, subOptions) => { // if parsing succeeds the verb name and correct instance // will be passed to onVerbCommand delegate (string,object) invokedVerb = verb; invokedVerbInstance = subOptions; })) { Environment.Exit(CommandLine.Parser.DefaultExitCodeFail); } validateArguments runMe = new run(invokedVerb, options); Console.WriteLine(watch.Elapsed); }
private void butPdf_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; string tenfile = ReportFile.ToLower().Replace(".rpt", ""); tenfile = ExportPath + tenfile + ".pdf"; crDiskFileDestinationOptions = new DiskFileDestinationOptions(); crExportOptions = cMain.ExportOptions; crDiskFileDestinationOptions.DiskFileName = tenfile; crExportOptions.DestinationOptions = crDiskFileDestinationOptions; crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; cMain.Export(); try { string filerun = "AcroRd32.exe", arg = tenfile; // string filerun = "C:\\Program Files\\Foxit Software\\Foxit Reader\\Foxit Reader.exe", arg = tenfile; if (System.IO.File.Exists(arg)) { run f = new run(filerun, arg, true); f.Launch(); } } catch { MessageBox.Show(lan.Change_language_MessageText("Tập tin :") + tenfile); } this.Cursor = Cursors.Default; }
public Text(Vector2 location,string txt, SpriteFont txtfont,run action) { selected = false; currentcolor = Color.Black; RenderLocation = location; font = txtfont; nextaction = action; text = txt; }
/// <summary> /// 添加任务 /// </summary> /// <typeparam name="parameterType">执行参数类型</typeparam> /// <param name="run">任务执行委托</param> /// <param name="parameter">执行参数</param> /// <param name="runTime">执行时间</param> /// <param name="onError">任务执行出错委托,停止任务参数null</param> public void Add <parameterType> (Action <parameterType> run, parameterType parameter, DateTime runTime, Action <Exception> onError) { if (run != null) { run <parameterType> action = run <parameterType> .Pop(); action.Set(run, parameter); add(action, thread.callType.Run, onError, runTime); } }
/// <summary> /// 添加任务 /// </summary> /// <typeparam name="parameterType">执行参数类型</typeparam> /// <param name="run">任务执行委托</param> /// <param name="parameter">执行参数</param> /// <param name="onError">任务执行出错委托,停止任务参数null</param> /// <returns>任务添加是否成功</returns> public bool Add <parameterType>(Action <parameterType> run, parameterType parameter, Action <Exception> onError = null) { if (run != null) { run <parameterType> action = run <parameterType> .Pop(); action.Set(run, parameter); return(Add(new taskInfo { Call = action, Type = thread.callType.Run, OnError = onError })); } return(false); }
public static void runAct(Action <string> act) { //Action<string> act=x=>{Console.WriteLine(x);}; act.Invoke("ok"); args a = new args(); run r = new run(a.echo); r("ok"); //------------ a.t = a.echo; a.t += a.echo; a.t.Invoke("hello"); }
/// <summary> /// 获取一个线程并执行任务 /// </summary> /// <typeparam name="parameterType">参数类型</typeparam> /// <param name="task">任务委托</param> /// <param name="parameter">线程参数</param> /// <param name="onError">应用程序退出处理</param> internal void FastStart <parameterType>(Action <parameterType> task, parameterType parameter, Action <Exception> onError) { run <parameterType> run = run <parameterType> .Pop(); run.Set(task, parameter); if (onError == null) { FastStart(run, fastCSharp.threading.thread.callType.Run); } else { FastStart(run, onError, fastCSharp.threading.thread.callType.Run, threading.thread.errorType.Action); } }
public void temp(string s) { MessageBox.Show(s); for (int i = 0; i < 2000; i++) { for (int j = 0; j < 100000; j++) { Count += j; } } run r = new run(fun); this.BeginInvoke(r, null); }
private void Delay(int delay, run del) { Thread t = new Thread(delegate() { try { Thread.Sleep(delay); del(); } catch (Exception e) { Console.WriteLine(e); } }); t.Start(); }
/// <summary> /// 添加任务 /// </summary> /// <typeparam name="parameterType">执行参数类型</typeparam> /// <param name="run">任务执行委托</param> /// <param name="parameter">执行参数</param> /// <param name="runTime">执行时间</param> /// <param name="onError">任务执行出错委托,停止任务参数null</param> public void Add <parameterType> (Action <parameterType> run, parameterType parameter, DateTime runTime, Action <Exception> onError) { if (run != null) { if (runTime > date.Now) { run <parameterType> action = run <parameterType> .Pop(); action.Set(run, parameter); add(action, thread.callType.Run, onError, runTime); } else { threadPool.FastStart(run, ref parameter, onError); } } }
/// <summary> /// 添加任务 /// </summary> /// <typeparam name="parameterType">执行参数类型</typeparam> /// <param name="run">任务执行委托</param> /// <param name="parameter">执行参数</param> /// <param name="runTime">执行时间</param> /// <param name="onError">任务执行出错委托,停止任务参数null</param> /// <returns>任务信息,null表示不可取消</returns> public task Add <parameterType> (Action <parameterType> run, ref parameterType parameter, DateTime runTime, Action <Exception> onError) { if (run != null) { if (runTime > date.Now) { run <parameterType> action = run <parameterType> .Pop(); action.Set(run, ref parameter); task task = new task(action, thread.callType.Run, onError); add(task, runTime); return(task); } threadPool.FastStart(run, ref parameter, onError); } return(null); }
static void Main(string[] args) { IEnumerable <int> oop = null; string nums = null; // string.Empty; string myString = string.Empty; int myInt; int max = 4; Console.WriteLine("ป้อนค่่าตัวเลข 6 หลัก จำนวน 4 ค่า"); for (int i = 0; i < max; i++) { try { myString = Console.ReadLine(); //รับค่า var array = myString.ToCharArray().Where(x => int.TryParse (x.ToString(), out myInt)) .Select(x => int.Parse (x.ToString())).ToArray(); //แปลง string to array var input = new run(); oop = input.Homework13(array); foreach (var item in oop) { nums += item; } } catch (System.Exception) { Console.WriteLine("Error"); } } Console.WriteLine("**99**"); Console.WriteLine(nums); }
internal void Injected(ref run _gt) { this.gt = _gt; gt.applicationType = configBase.ApplicationType.MVC_API; Authenticate(); }
private void frmLogin_Load(object sender, EventArgs e) { f_capnhat_db();// try { m = new LibMedi.AccessData(); groLogin.BringToFront(); groLicense.Visible = false; bool bQuanLyLicense = m.QuanLyLicense; if (bQuanLyLicense) { m.RegisterDateStart(); if (m.DaDangKiLicense == false) { string s_NgayHeThong = m.ngayhienhanh_server; DateTime dtNgayHeThong = m.StringToDate(s_NgayHeThong); string s_NgayBatDau = m.RegisterGetDateStart; DateTime dtNgayBatDau = m.StringToDate(s_NgayBatDau.Substring(0, 10)); TimeSpan tp = dtNgayHeThong - dtNgayBatDau; int i_SoNgayConLai = tp.Days; txtKey.Text = Medisoft2009.MACAddress.MedisoftMAC.KeyInfo; groLicense.Visible = true; groLicense.BringToFront(); bChuaDangKiLicense = true; if (i_SoNgayConLai <= 30) { lblLicense.Text = "Hệ thống chưa được đăng ký bản quyền sử dụng. " + "Hãy copy key bên dưới gởi cho quản trị hệ thống." + "\nBạn chỉ có " + (30 - i_SoNgayConLai).ToString() + " ngày dùng thử"; } else { lblLicense.Text = "Hệ thống chưa được đăng ký bản quyền sử dụng. " + "Hãy copy key bên dưới gởi cho quản trị hệ thống." + "\nBạn đã hết số ngày dùng thử"; butTiepTuc.Enabled = false; groLogin.Enabled = false; } } else { groLogin.Enabled = true; bChuaDangKiLicense = false; this.Width = 292; this.Height = 146; } } else { this.Width = 292; this.Height = 146; } try { bool update = m_v.bAutoupdate && m_v.Path_medisoft != ""; if (update) { string file = "Vienphi", path = m_v.Path_medisoft + "\\" + file + "\\bin\\debug"; if (!m_v.bUpdate(System.IO.Directory.GetCurrentDirectory(), path, file)) { m_v.writeXml("thongso", "version", "Version " + m_v.f_modify(m_v.file_exe(path, file))); m_v.writeXml("thongso", "file", file); m_userid_off = ""; Application.Exit(); string filerun = @m_v.path_medisofthis() + "\\version\\bin\\debug\\version.exe"; run f = new run(filerun); f.Launch(); } } } catch { } if (m_userid_off != "") { foreach (DataRow r in m_v.f_get_v_dlogin(m_userid_off, "", "", "", "").Tables[9].Rows) { txtUsername.Text = r["username"].ToString(); break; } } } catch { } //if (m_v.get_data("select * from medibv.thongso where id=-2").Tables[0].Rows.Count > 0) // f_Check_License();///Dung license //else // f_Uncheck_License();//Khong dung license }