Re: Pocket outlook - AppointmentsCollection class: ListChanged event



IIRC, it works via Windows Messages, so you have to have a message pump to get the notifications. Sleep won't do it - you need to Get and Dispatch messages from the queue.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com



"Sam" <NOSPAM@xxxxxxxxxx> wrote in message news:30170083-044D-470C-A7C8-477E6D701079@xxxxxxxxxxxxxxxx
> http://blog.opennetcf.com/ctacke/2008/10/20/TheCuttingRoomDetectingPOOMChanges.aspx
Thank you very much. It is very useful!!
It works with windows form but I'm not able to integrate it into my console application.
Please, I need help! Where I should put this code?
POOMHelper.OutlookItemChanged += new OutlookItemChangeDelegate(POOMHelper_OutlookItemChanged);

void POOMHelper_OutlookItemChanged(PIMNotificationMessage notification, PIMItemType itemType, int itemOID, int databaseOID)

{

switch (itemType)

{

case PIMItemType.Calendar:

{...}

break;}}


My Console application:

class Program
{
static Timer timer= new Timer();
static void Main(string[] args)
{
timer = new Timer();
timer.Interval = 500;
timer.OnTimerTick += timerTick;
Thread timerThread = timer.Start();
for (; ; )
Thread.Sleep(5000);
}

And:

class Timer
{
// Delegates
public delegate void Tick();

// Properties
public int Interval;
public Tick OnTimerTick;

// Private Data
Thread _timerThread;
volatile bool _bStop;

public void SleepIntermittently(int totalTime)
{
int sleptTime = 0;
int intermittentSleepIncrement = 10;

while (!_bStop && sleptTime < totalTime)
{
Thread.Sleep(intermittentSleepIncrement);
sleptTime += intermittentSleepIncrement;
}
}

public void Run()
{
while (!_bStop)
{
// Sleep for the timer interval
SleepIntermittently(Interval);
// Then fire the tick event
OnTimerTick();
}
}

public Thread Start()
{
_bStop = false;
_timerThread = new Thread(new ThreadStart(Run));
_timerThread.IsBackground = true;
_timerThread.Start();
return _timerThread;
}

public void Stop()
{
// Request the loop to stop
_bStop = true;
_timerThread.Join(1000);
_timerThread.Abort();
}
}

Relevant Pages

  • Panels on a BorderLayout
    ... I have just finished this application that draws a rectangle inside a panel & uses a thread or a timer to animate it. ... int size = 0; ... public void setSize{ ...
    (comp.lang.java.help)
  • Re: Java API sound
    ... I was using mixer but port is better solution; ... private void CreateInterface ... public void actionPerformed{ ... int d = -1; ...
    (comp.lang.java.programmer)
  • Re: mehrfach unterstreichen =?ISO-8859-1?Q?m=F6glich=3F?=
    ... private void init() { ... private void fill(DefaultMutableTreeNode node, int depth) { ... public void changedUpdate{ ... return vGap; ...
    (de.comp.lang.java)
  • JFrame Resize Issues (Redux)
    ... However, when the LookAndFeel is set, Java's Window Manager ... public int OffSetX = 0; ... private Rectangle positRectangle; ... public void componentHidden{ ...
    (comp.lang.java.programmer)
  • Re: mehrfach unterstreichen =?ISO-8859-1?Q?m=F6glich=3F?=
    ... */ public class FlowDOMView extends JPanel {private DefaultTreeModel model = null; ... private void fill(DefaultMutableTreeNode node, int depth) { ... public void changedUpdate{ ... return vGap; ...
    (de.comp.lang.java)