PlexityHide

Home 

Products 

Downloads 

Our Shop 

Support 

Contact 


Wednesday, April 21, 2010

In GTP.NET for Silverlight and WPF, how to stop a move to avoid collision

This is one way to stop a move that will cause a collision:

   1: private void GanttRow_OnTimeItemChange(object sender, OnTimeItemChangeArgs e)
   2: {
   3:     if (e.MoveState == MoveState.move)
   4:     {
   5:         DateTime newstart=e.TimeItem.Start+e.Diff;
   6:         DateTime newstop=e.TimeItem.Stop+e.Diff;
   7:         foreach(GanttRowItem gri in e.TimeItem.GanttRow.InternalIndexOfContent)
   8:         {
   9:             if (newstart<gri.TimeItem.Stop && newstop>gri.TimeItem.Start && gri.TimeItem!=e.TimeItem)
  10:             {
  11:                 // collision
  12:                 e.Allow=false;
  13:                 return;
  14:             }
  15:  
  16:         }
  17:     }
  18: }

Comments:

Post a Comment

Subscribe to Post Comments [Atom]





<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]

Support

Support intro

Knowledgebase

FAQ phGantTimePackage

FAQ GTP.NET

FAQ general

History