Ejemplo n.º 1
0
        /// <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();
            }
        }
Ejemplo n.º 2
0
 /// <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;
 }
Ejemplo n.º 3
0
        private void Invoke(EmptyHandler handler)
        {
            ListView view = this.ListView;

            if (view != null)
            {
                Utils.Invoke(view, handler);
            }
        }
Ejemplo n.º 4
0
            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);
 }
Ejemplo n.º 6
0
 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;
 }
Ejemplo n.º 7
0
 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));
         }
     }
 }
Ejemplo n.º 8
0
        //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);
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
 public static void Invoke(Control control, EmptyHandler handler)
 {
     if (control.IsHandleCreated)
     {
         if (control.InvokeRequired)
         {
             control.Invoke(handler);
         }
         else
         {
             handler();
         }
     }
 }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
 /// <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);
 }
Ejemplo n.º 13
0
        /// <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();
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Refresh form (thread safe)
        /// </summary>
        public void RefreshForm()
        {
            EmptyHandler del = delegate()
            {
                //this.Refresh();
                this.Invalidate();
            };

            if (this.InvokeRequired)
            {
                this.Invoke(del);
            }
            else
            {
                del();
            }
        }
Ejemplo n.º 15
0
        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]);
        }
Ejemplo n.º 17
0
        /// <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();
            }
        }
Ejemplo n.º 18
0
        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);
        }
Ejemplo n.º 19
0
 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;
 }
Ejemplo n.º 20
0
        /// <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();
            }
        }
Ejemplo n.º 21
0
 public DelegateCommand(string text, EmptyHandler func)
     : base(text)
 {
     this.Function = func;
 }
Ejemplo n.º 22
0
 /// <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;
 }
Ejemplo n.º 23
0
 public DelegateCompletionListItem(string text, EmptyHandler func)
     : base(text)
 {
     this.Function = func;
 }
Ejemplo n.º 24
0
 public DelegateCompletionListItem(string text, EmptyHandler func)
     : base(text)
 {
     this.Function = func;
 }
Ejemplo n.º 25
0
 public DictionaryWrapper(TEmptyEventArgs emptyEventArgs, EmptyHandler emptyHandler)
 {
     _emptyEventArgs = emptyEventArgs;
     _emptyHandler   = emptyHandler;
 }
Ejemplo n.º 26
0
 public void HandleEmpty(Card card)
 {
     AlmostEmpty = new EmptyHandler(HandleEmpty);
 }
Ejemplo n.º 27
0
 public TimerElement(EmptyHandler func)
 {
     this.func = func;
 }
 public SubscriptionProcessor(BindingDescriptor emptyEventArgs, EmptyHandler emptyHandler) : base(emptyEventArgs, emptyHandler)
 {
 }
Ejemplo n.º 29
0
 public ActivatedEffect(string name, EmptyHandler effect)
 {
     Name   = name;
     Effect = effect;
 }
Ejemplo n.º 30
0
 internal void Queue(EmptyHandler handler)
 {
     worker.instructions.Enqueue(handler);
 }
Ejemplo n.º 31
0
 //constructor
 public BoneYard(int md)
 {
     maxDots = md;
     NewBonyYard();
     Empty = new EmptyHandler(HandleEmpty);
 }
Ejemplo n.º 32
0
 /// <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)
		{
		}
Ejemplo n.º 34
0
 public ActionLink(EmptyHandler handler)
 {
     customHandler = handler;
 }
Ejemplo n.º 35
0
 public DelegateCommand(string text, EmptyHandler func)
     : base(text)
 {
     this.Function = func;
 }