Example #1
0
        void QueueAction(MyAction action, bool unique)
        {
            bool start;

            lock (lockObj) {
                if (unique)
                {
                    for (int i = 0; i < actions.Count; i++)
                    {
                        if (actions[i].GetType() == action.GetType())
                        {
                            actions.RemoveAt(i);
                            break;
                        }
                    }
                }
                actions.Add(action);
                start = actions.Count == 1;
            }
            if (start)
            {
                dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(EmptyQueue));
            }
        }
Example #2
0
		void QueueAction(MyAction action, bool unique) {
			bool start;
			lock (lockObj) {
				if (unique) {
					for (int i = 0; i < actions.Count; i++) {
						if (actions[i].GetType() == action.GetType()) {
							actions.RemoveAt(i);
							break;
						}
					}
				}
				actions.Add(action);
				start = actions.Count == 1;
			}
			if (start)
				dispatcher.BeginInvoke(DispatcherPriority.Background, new Action(EmptyQueue));
		}