/// <summary> /// Show context menu (thread safe) /// </summary> public void ShowContextMenu() { EmptyHandler del = delegate() { //MakeTopMostInactive(); //this.TopMost = true; Win32.SetWindowPos(m_hwndCms, Win32.HWND_TOPMOST, Cursor.Position.X - this.Location.X - 20, Cursor.Position.Y - this.Location.Y, 0, 0, Win32.SWP_SHOWWINDOW | Win32.SWP_NOACTIVATE | Win32.SWP_NOREDRAW); //cMS_MatchedGestures.Show(Cursor.Position.X - this.Location.X - 20, Cursor.Position.Y - this.Location.Y); //cMS_MatchedGestures.Visible = true; m_tooltip.Hide(); m_contextMenuIsVisible = true; //Win32.ShowWindow(m_hwndCms, 1); }; if (this.InvokeRequired) { this.Invoke(del); } else { del(); } }
/// <summary> /// Constructs a new FormPostAction object. postHandler is the only important argument. Any of the others can be set to null /// to prevent them from being included as criteria for whether or not the postHandler method is called when a form is posted. /// </summary> /// <param name="postToPath">If not null, SprocketPath.Value must match this value before the method is called.</param> /// <param name="postFromPath">If not null, the referring page must match this SprocketPath value before the method is called.</param> /// <param name="fieldName">If not null, this is the name of the field that must be posted for the pst handler method to be called.</param> /// <param name="fieldValue">If not null, the value held by FieldName must match this before the post handler method is called.</param> /// <param name="postHandler">This is the method that will be called when a form is posted that matches the criteria held by the other fields in this class.</param> public FormPostAction(string postToPath, string postFromPath, string fieldName, string fieldValue, EmptyHandler postHandler) { this.postToPath = postToPath; this.postFromPath = postFromPath; this.fieldName = fieldName; this.fieldValue = fieldValue; this.postHandler = postHandler; }
private void Invoke(EmptyHandler handler) { ListView view = this.ListView; if (view != null) { Utils.Invoke(view, handler); } }
public void Read_WithEmptyHandler() { var handler = new EmptyHandler(); var settings = new ReadingSettings(); settings.ReadingHandlers.Add(handler); var midiFile = MidiFile.Read(TestFilesProvider.GetMiscFile_14000events(), settings); }
/// <summary> /// Creates a new Subscription Handler /// </summary> /// <param name="deviceDescriptor">A DeviceDescriptor object that describes the device being handled</param> /// <param name="emptyHandler">The delegate to fire when the device has no more subscriptions</param> public SubscriptionHandler(DeviceDescriptor deviceDescriptor, EmptyHandler emptyHandler) { _emptyHandler = emptyHandler; _bindings = new DictionaryWrapper <BindingType, DictionaryWrapper <int, DictionaryWrapper <int, SubscriptionProcessor, BindingDescriptor>, BindingDescriptor>, DeviceDescriptor>(deviceDescriptor, DeviceEmptyHandler); }
internal WindowPanel(float w, float h, string t, LevelWindow windowRef, EmptyHandler uiFunction) { width = w; height = h; title = t; window = windowRef; defaultBoxStyle = new GUIStyle(GUI.skin.box); defaultBoxStyle.normal.background = DreamteckEditorGUI.blankImage; defaultBoxStyle.margin = new RectOffset(0, 0, 0, 0); this.uiFunction = uiFunction; }
public Deck() { AlmostEmpty = new EmptyHandler(HandleEmpty); for (int value = 1; value <= 13; value++) { for (int suit = 1; suit <= 4; suit++) { cards.Add(new Card(value, suit)); } } }
//public int dominos => dList.Count; public BoneYard(int maxDots) { dList = new List <Domino>(); for (int side1 = 0; side1 <= maxDots; side1++) { for (int side2 = side1; side2 <= maxDots; side2++) { dList.Add(new Domino(side1, side2)); } } Empty = new EmptyHandler(HandleEmpty); }
public void TestConstructorWithHandlers() { string entityname = "entity"; IActionHandler createHandler = new EmptyHandler(); IActionHandler updateHandler = new EmptyHandler(); FieldMap fieldMapping = new FieldMap("source", "target"); ImportMap map = new ImportMap(entityname, fieldMapping, createHandler, updateHandler); Assert.AreEqual(entityname, map.EntityName); Assert.AreEqual(fieldMapping, map.Key); Assert.AreEqual(createHandler, map.CreateHandler); Assert.AreEqual(updateHandler, map.UpdateHandler); }
public static void Invoke(Control control, EmptyHandler handler) { if (control.IsHandleCreated) { if (control.InvokeRequired) { control.Invoke(handler); } else { handler(); } } }
public ProcessWorker(ModuleBase module, MethodInfo mi) { sim = Simulator.GetInstance(); eh = (EmptyHandler)Delegate.CreateDelegate(typeof(EmptyHandler), module, mi.Name); infostring = module.Name + "(" + mi.Name + ")"; object[] o = mi.GetCustomAttributes(typeof(ThreadedProcessAttribute), true); //if (o.Length > 0 && Simulator.UseThreadedProcess) //{ // threaded = true; // Thread t = new Thread(new ThreadStart(RunThread)); // t.Start(); //} // sim.OnStop +=new EmptyHandler(sim_OnStop); }
/// <summary> /// overloaded BoneYard constructor, accepts a max number of dominos /// </summary> /// <param name="maxDots"></param> public BoneYard(int maxDots) { // instantiates the new list boneyard = new List <Domino>(); // loops through the dominos starting at 0 and ending at the number of // max dominos for (int side1 = 0; side1 <= maxDots; side1++) { for (int side2 = side1; side2 <= maxDots; side2++) { // Adds the new domino to the BoneYard list boneyard.Add(new Domino(side1, side2)); } } Empty = new EmptyHandler(HandleEmpty); }
/// <summary> /// Hide form (thread safe) /// </summary> public void HideForm() { EmptyHandler del = delegate() { Win32.ShowWindow(m_hwndForm, 0); //Win32.ShowWindowAsync(m_hwndForm, 0); }; if (this.InvokeRequired) { this.Invoke(del); } else { del(); } }
/// <summary> /// Refresh form (thread safe) /// </summary> public void RefreshForm() { EmptyHandler del = delegate() { //this.Refresh(); this.Invalidate(); }; if (this.InvokeRequired) { this.Invoke(del); } else { del(); } }
public void PerformClickOnContextMenu() { EmptyHandler del = delegate() { Point point = cMS_MatchedGestures.PointToClient(Cursor.Position); //Debug.WriteLine(string.Format("PerformClickOnContextMenu X: {0} Y: {1}", point.X, point.Y)); ToolStripItem item = cMS_MatchedGestures.GetItemAt(point); if (item == null) { point.Y -= 1; foreach (ContextMenuStrip contextMenu in m_cmsList) { point = contextMenu.PointToClient(Cursor.Position); item = contextMenu.GetItemAt(point); if (item != null) { break; } } } if (item != null) { ToolStripMenuItem menuItem = (ToolStripMenuItem)item; if (menuItem.DropDownItems.Count == 0) { item.PerformClick(); } } }; if (this.InvokeRequired) { this.Invoke(del); } else { del(); } }
public void Test() { string fieldName = "field"; string fieldInitialValue = "value"; string changedValue = "othervalue"; XrmFakedContext context = new XrmFakedContext(); IOrganizationService service = context.GetOrganizationService(); EmptyHandler handler = new EmptyHandler(); Entity initialEntity = new Entity("entity", Guid.NewGuid()) { [fieldName] = fieldInitialValue }; context.Initialize(initialEntity); initialEntity[fieldName] = changedValue; handler.Execute(initialEntity, service); Entity post = service.Retrieve(initialEntity.LogicalName, initialEntity.Id, new ColumnSet(fieldName)); Assert.AreEqual(fieldInitialValue, post[fieldName]); }
/// <summary> /// Clear context menu (thread safe) /// </summary> public void ClearContextMenu() { EmptyHandler del = delegate() { foreach (ContextMenuStrip cms in m_cmsList) { cms.Dispose(); } cMS_MatchedGestures.Items.Clear(); m_hwndCmsList.Clear(); m_cmsList.Clear(); }; if (cMS_MatchedGestures.InvokeRequired) { this.Invoke(del); } else { del(); } }
static void Main(string[] args) { Console.WriteLine("Hello World!"); var desHandler = new DesHandler(); var emptyHandler = new EmptyHandler(desHandler); var rkeHandler = new RkeHandler(emptyHandler); var sstKwHandler = new SstKwHandler(rkeHandler); var handlerChainOfResponsibility = sstKwHandler; var requestSetDes = new Request(RequestType.SetDesParameter, "Set the value to 1.2"); handlerChainOfResponsibility.HandleRequest(requestSetDes); var overallRequest = new Request(RequestType.SetAll, "Settings for all turbulent models"); handlerChainOfResponsibility.HandleRequest(overallRequest); var requestSetA1ForSstKw = new Request(RequestType.SetA1, "Set A1 to the value 0.6"); handlerChainOfResponsibility.HandleRequest(requestSetA1ForSstKw); }
static void RunThread(object o) { ThreadDef.Worker work = (ThreadDef.Worker)o; while (true) { try { work.computing = false; Thread.Sleep(Timeout.Infinite); } catch (ThreadInterruptedException) { work.computing = true; lock (locker) { while (work.instructions.Count > 0) { EmptyHandler h = work.instructions.Dequeue(); if (h != null) { h(); } } } } catch (System.Exception ex) { if (ex.Message != "") { Debug.Log("THREAD EXCEPTION " + ex.Message); } break; } } Debug.Log("Thread stopped"); work.computing = false; }
/// <summary> /// Add new item into context menu /// </summary> /// <param name="item"></param> public void AddItemToCms(ToolStripMenuItem item) { EmptyHandler del = delegate() { cMS_MatchedGestures.Items.Add(item); item.MouseHover += new EventHandler(cMS_MatchedGestures_MouseHover); if (item.DropDown.Items.Count > 0) { m_hwndCmsList.Add(item.DropDown.Handle); m_cmsList.Add((ContextMenuStrip)item.DropDown); // register visibility event so the context menu is closed when it is hidden //item.DropDown.VisibleChanged += new EventHandler(cMS_MatchedGestures_VisibleChanged); } }; if (cMS_MatchedGestures.InvokeRequired) { this.Invoke(del); } else { del(); } }
public DelegateCommand(string text, EmptyHandler func) : base(text) { this.Function = func; }
public DelegateCompletionListItem(string text, EmptyHandler func) : base(text) { this.Function = func; }
public DictionaryWrapper(TEmptyEventArgs emptyEventArgs, EmptyHandler emptyHandler) { _emptyEventArgs = emptyEventArgs; _emptyHandler = emptyHandler; }
public void HandleEmpty(Card card) { AlmostEmpty = new EmptyHandler(HandleEmpty); }
public TimerElement(EmptyHandler func) { this.func = func; }
public SubscriptionProcessor(BindingDescriptor emptyEventArgs, EmptyHandler emptyHandler) : base(emptyEventArgs, emptyHandler) { }
public ActivatedEffect(string name, EmptyHandler effect) { Name = name; Effect = effect; }
internal void Queue(EmptyHandler handler) { worker.instructions.Enqueue(handler); }
//constructor public BoneYard(int md) { maxDots = md; NewBonyYard(); Empty = new EmptyHandler(HandleEmpty); }
/// <summary> /// Creates an empty hand /// </summary> public Hand() { handOfDominos = new List <Domino>(); Empty = new EmptyHandler(HandleEmpty); }
public void AddFormProcessor(string forSprocketPath, string fieldName, EmptyHandler postHandler) { }
public ActionLink(EmptyHandler handler) { customHandler = handler; }