private void InitUi(TypeC?type) { string title = EnumFunc.TypeToString(type); if (title != "A propos") { title += " Infos"; } Text = title; ClientSize = SetSize(type); FormBorderStyle = FormBorderStyle.Fixed3D; string text = (type.Equals(TypeC.Aero)) ? Ressources.AERO_ABOUT : (type.Equals(TypeC.Cesar)) ? Ressources.CESAR_ABOUT : (type.Equals(TypeC.Morse)) ? Ressources.MORSE_ABOUT : (type.Equals(TypeC.Navajo)) ? Ressources.NAVAJO_ABOUT : (type.Equals(TypeC.Vigenere)) ? Ressources.VIGENERE_ABOUT : (type.Equals(TypeC.Binaire)) ? Ressources.BINAIRE_ABOUT : Ressources.PROGRAM_ABOUT; var font = new Font("Verdana", 9, FontStyle.Italic | FontStyle.Bold); var lyrics = new Label(); lyrics.Parent = this; lyrics.Text = text; lyrics.Font = font; lyrics.AutoSize = true; lyrics.TextAlign = ContentAlignment.MiddleCenter; Controls.Add(lyrics); CenterToParent(); }
/// <summary> /// Add a new callback function to the worker thread. /// </summary> static public void Create(VoidFunc main, EnumFunc finished, bool highPriority = false) { #if SINGLE_THREADED if (main != null) { main(); } while (finished().MoveNext()) { } #else if (mInstance == null) { #if UNITY_EDITOR if (!Application.isPlaying) { if (main != null) { main(); } if (finished != null) { finished(); } return; } #endif var go = new GameObject("Worker Thread"); mInstance = go.AddComponent <WorkerThread>(); } Entry ent; if (mInstance.mUnused.size != 0) { lock (mInstance.mUnused) { ent = (mInstance.mUnused.size != 0) ? mInstance.mUnused.Pop() : new Entry(); } } else { ent = new Entry(); } ent.main = main; ent.finishedEnum = finished; ent.milliseconds = 0; if (main != null) { if (highPriority) { lock (mInstance.mPriority) mInstance.mPriority.Enqueue(ent); } else { lock (mInstance.mRegular) mInstance.mRegular.Enqueue(ent); } } else { lock (mInstance.mFinished) mInstance.mFinished.Enqueue(ent); } #endif }
public static extern bool EnumChildWindows(IntPtr hWndParent, EnumFunc lpEnumFunc, int lParam);
public static extern bool EnumWindows(EnumFunc lpEnumFunc, int lParam);