public override void Attach(GanttViewDataItem data, object context)
 {
     base.Attach(data, context);
     this.cellContainer.Owner        = data.GanttViewElement.TextViewElement;
     this.cellContainer.DataProvider = (IEnumerable)this.cellContainer.Owner.ColumnScroller;
     this.cellContainer.Owner.ColumnScroller.ScrollerUpdated += new EventHandler(this.ColumnScroller_ScrollerUpdated);
 }
        protected override void OnDropDownOpening(CancelEventArgs args)
        {
            base.OnDropDownOpening(args);
            GanttViewDataItem selectedItem = this.GanttViewElement.SelectedItem;

            if (this.ShowProgress && this.ProgressStep > new Decimal(0))
            {
                this.ProgressMenuItem.Visibility = ElementVisibility.Visible;
                bool    flag = selectedItem.Progress % this.ProgressStep != new Decimal(0);
                Decimal num  = new Decimal(0);
                while (num <= new Decimal(100))
                {
                    GanttViewMenuItem ganttViewMenuItem1 = new GanttViewMenuItem(num.ToString(), string.Format("{0:P0}", (object)(num / new Decimal(100))));
                    this.progressMenuItem.Items.Add((RadItem)ganttViewMenuItem1);
                    ganttViewMenuItem1.IsChecked = selectedItem.Progress == num;
                    ganttViewMenuItem1.Click    += new EventHandler(this.progressMenuItem_Click);
                    if (flag && selectedItem.Progress > num && selectedItem.Progress < num + this.ProgressStep)
                    {
                        GanttViewMenuItem ganttViewMenuItem2 = new GanttViewMenuItem(selectedItem.Progress.ToString(), string.Format("{0:P0}", (object)(selectedItem.Progress / new Decimal(100))));
                        this.progressMenuItem.Items.Add((RadItem)ganttViewMenuItem2);
                        ganttViewMenuItem2.IsChecked = true;
                        ganttViewMenuItem2.Click    += new EventHandler(this.progressMenuItem_Click);
                    }
                    num += this.ProgressStep;
                }
            }
            else
            {
                if (this.ShowProgress)
                {
                    return;
                }
                this.ProgressMenuItem.Visibility = ElementVisibility.Collapsed;
            }
        }
Esempio n. 3
0
 public override object this[GanttViewDataItem item]
 {
     get
     {
         if (((IDataItem)item).DataBoundItem == null)
         {
             return((object)null);
         }
         if (this.IsSubPropertyMode)
         {
             return(this.GetSubPropertyValue(this.Column.FieldName, ((IDataItem)item).DataBoundItem));
         }
         if (string.IsNullOrEmpty(this.Column.FieldName))
         {
             return((object)null);
         }
         return(this.GanttViewElement.BindingProvider.GetBoundValue(((IDataItem)item).DataBoundItem, this.Column.FieldName));
     }
     set
     {
         if (((IDataItem)item).DataBoundItem == null)
         {
             return;
         }
         if (this.IsSubPropertyMode)
         {
             this.GanttViewElement.BindingProvider.SetBoundValue((IDataItem)item, this.Column.FieldName, value, this.Column.FieldName);
         }
         else
         {
             this.GanttViewElement.BindingProvider.SetBoundValue((IDataItem)item, this.Column.FieldName, this.Column.Name, value, (string)null);
         }
     }
 }
 public override bool IsCompatible(GanttViewDataItem data, object context)
 {
     if (data != null)
     {
         return(data.Start == data.End);
     }
     return(false);
 }
Esempio n. 5
0
        public override void Attach(GanttViewDataItem data, object context)
        {
            int num = (int)this.TaskElement.BindProperty(GanttGraphicalViewBaseTaskElement.SelectedProperty, (RadObject)data, GanttViewDataItem.SelectedProperty, PropertyBindingOptions.TwoWay);

            base.Attach(data, context);
            this.InvalidateMeasure();
            this.Invalidate();
        }
Esempio n. 6
0
 protected virtual void OnChildRemoved(GanttViewDataItem child)
 {
     if (this.Parent == null || this.GanttViewElement.AllowSummaryEditing)
     {
         return;
     }
     this.InvalidateStartAndEnd();
     this.InvalidateProgress();
 }
Esempio n. 7
0
 public GanttViewEditorRequiredEventArgs(
     GanttViewDataItem item,
     GanttViewTextViewColumn column,
     Type editorType)
     : base(item)
 {
     this.column     = column;
     this.editorType = editorType;
 }
Esempio n. 8
0
        private RadGanttViewElement FindGanttView()
        {
            GanttViewDataItem ganttViewDataItem = this;

            while (ganttViewDataItem.parent != null)
            {
                ganttViewDataItem = ganttViewDataItem.parent;
            }
            return(ganttViewDataItem.ganttView);
        }
Esempio n. 9
0
        public object GetNestedValue(
            GanttViewDataItem item,
            LinkedList <PropertyDescriptor> nestedDescriptor)
        {
            object dataBoundItem = ((IDataItem)item).DataBoundItem;

            for (LinkedListNode <PropertyDescriptor> linkedListNode = nestedDescriptor.First; linkedListNode != null; linkedListNode = linkedListNode.Next)
            {
                dataBoundItem = linkedListNode.Value.GetValue(dataBoundItem);
            }
            return(dataBoundItem);
        }
        protected virtual void AddMenuItemClicked(GanttViewMenuItem item)
        {
            if (!(item.Command == "AddChild") && !(item.Command == "AddSibling"))
            {
                return;
            }
            CreateGanttDataItemEventArgs e = new CreateGanttDataItemEventArgs();

            this.GanttViewElement.OnCreateDataItem(e);
            GanttViewDataItem ganttViewDataItem = e.Item ?? this.GanttViewElement.CreateNewTask();
            DateTime          dateTime1         = this.GanttViewElement.GraphicalViewElement.TimelineBehavior.AdjustedTimelineStart.AddSeconds((double)(this.GanttViewElement.GraphicalViewElement.PointFromScreen(this.DropDown.Location).X + this.GanttViewElement.GraphicalViewElement.HorizontalScrollBarElement.Value) * this.GanttViewElement.GraphicalViewElement.OnePixelTime.TotalSeconds);
            DateTime          dateTime2         = dateTime1.AddSeconds(this.GanttViewElement.GraphicalViewElement.OnePixelTime.TotalSeconds * 20.0);

            ganttViewDataItem.Start = dateTime1;
            ganttViewDataItem.End   = dateTime2;
            if (item.Command == "AddChild")
            {
                this.GanttViewElement.SelectedItem.Items.Add(ganttViewDataItem);
            }
            else
            {
                if (!(item.Command == "AddSibling"))
                {
                    return;
                }
                if (this.GanttViewElement.SelectedItem.Parent == null)
                {
                    int index = this.GanttViewElement.Items.IndexOf(this.GanttViewElement.SelectedItem);
                    if (index < this.GanttViewElement.Items.Count)
                    {
                        this.GanttViewElement.Items.Insert(index, ganttViewDataItem);
                    }
                    else
                    {
                        this.GanttViewElement.Items.Add(ganttViewDataItem);
                    }
                }
                else
                {
                    int index = this.GanttViewElement.SelectedItem.Parent.Items.IndexOf(this.GanttViewElement.SelectedItem);
                    if (index < this.GanttViewElement.SelectedItem.Parent.Items.Count)
                    {
                        this.GanttViewElement.SelectedItem.Parent.Items.Insert(index, ganttViewDataItem);
                    }
                    else
                    {
                        this.GanttViewElement.SelectedItem.Parent.Items.Add(ganttViewDataItem);
                    }
                }
            }
        }
Esempio n. 11
0
 protected virtual void NotifyExpandedChanged(GanttViewDataItem item)
 {
     if (this.GanttViewElement == null)
     {
         return;
     }
     if (item != null)
     {
         this.GanttViewElement.Update(RadGanttViewElement.UpdateActions.ExpandedChanged, item);
         ControlTraceMonitor.TrackAtomicFeature((RadElement)this.GanttViewElement, item.Expanded ? "Expanded" : "Collapsed", (object)item.Title);
     }
     else
     {
         this.GanttViewElement.Update(RadGanttViewElement.UpdateActions.ExpandedChanged);
     }
 }
Esempio n. 12
0
 private GanttViewDataItem GetLastVisibleItem(GanttViewDataItem parent)
 {
     for (int index = parent.Items.Count - 1; index >= 0; --index)
     {
         GanttViewDataItem parent1 = parent.Items[index];
         if (parent1.Visible)
         {
             if (parent1.Expanded && parent1.Items.Count > 0)
             {
                 return(this.GetLastVisibleItem(parent1));
             }
             return(parent1);
         }
     }
     return((GanttViewDataItem)null);
 }
 public virtual object this[GanttViewDataItem item]
 {
     get
     {
         if (item.Cache[this.Column] == null)
         {
             PropertyInfo property = item.GetType().GetProperty(this.Column.FieldName);
             if ((object)property != null)
             {
                 object obj = property.GetValue((object)item, (object[])null);
                 this.SetUnboundValue(item, obj);
             }
         }
         return(item.Cache[this.Column]);
     }
     set
     {
         this.SetUnboundValue(item, value);
     }
 }
        private void SetUnboundValue(GanttViewDataItem item, object value)
        {
            if (item == null)
            {
                return;
            }
            if (this.GanttViewElement != null)
            {
                this.GanttViewElement.Items.OnCollectionItemChanging(item);
            }
            item.Cache[this.column] = value;
            PropertyInfo property = item.GetType().GetProperty(this.column.FieldName);

            if ((object)property != null)
            {
                property.SetValue((object)item, value, (object[])null);
            }
            if (this.GanttViewElement == null)
            {
                return;
            }
            this.GanttViewElement.Items.OnCollectionItemChanged(item);
        }
Esempio n. 15
0
        public void SetNestedValue(
            GanttViewDataItem item,
            LinkedList <PropertyDescriptor> nestedDescriptor,
            object value)
        {
            object dataBoundItem = ((IDataItem)item).DataBoundItem;
            LinkedListNode <PropertyDescriptor> first = nestedDescriptor.First;

            while (first != null)
            {
                if (first.Next == null)
                {
                    object        obj       = value;
                    TypeConverter converter = first.Value.Converter;
                    if (value != null && converter.CanConvertFrom(value.GetType()))
                    {
                        obj = converter.ConvertFrom(value);
                    }
                    first.Value.SetValue(dataBoundItem, obj);
                    break;
                }
                dataBoundItem = first.Value.GetValue(dataBoundItem);
            }
        }
Esempio n. 16
0
 public object GetEnd(GanttViewDataItem item)
 {
     return(this.GetNestedValue(item, this.endDescriptor));
 }
Esempio n. 17
0
 public virtual void SetCurrent(GanttViewDataItem item)
 {
 }
Esempio n. 18
0
 public GanttViewTraversingEventArgs(GanttViewDataItem item)
 {
   this.item = item;
   this.process = item == null || item.Visible;
 }
Esempio n. 19
0
 public void SetProgress(GanttViewDataItem item, object value)
 {
     this.SetNestedValue(item, this.progressDescriptor, value);
 }
Esempio n. 20
0
 public void SetEnd(GanttViewDataItem item, object value)
 {
     this.SetNestedValue(item, this.endDescriptor, value);
 }
Esempio n. 21
0
 public void SetStart(GanttViewDataItem item, object value)
 {
     this.SetNestedValue(item, this.startDescriptor, value);
 }
Esempio n. 22
0
 public void SetTitle(GanttViewDataItem item, object value)
 {
     this.SetNestedValue(item, this.titleDescriptor, value);
 }
Esempio n. 23
0
 protected virtual void OnChildProgressChanged(GanttViewDataItem child)
 {
     this.InvalidateProgress();
 }
Esempio n. 24
0
 public object GetParent(GanttViewDataItem item)
 {
     return(this.GetNestedValue(item, this.parentDescriptor));
 }
Esempio n. 25
0
 public abstract IList <GanttViewDataItem> GetItems(GanttViewDataItem parent);
Esempio n. 26
0
 public object GetTitle(GanttViewDataItem item)
 {
     return(this.GetNestedValue(item, this.titleDescriptor));
 }
Esempio n. 27
0
 protected virtual void OnChildEndChanged(GanttViewDataItem child)
 {
     this.InvalidateStartAndEnd();
 }
Esempio n. 28
0
 public object GetProgress(GanttViewDataItem item)
 {
     return(this.GetNestedValue(item, this.progressDescriptor));
 }
Esempio n. 29
0
 public object GetStart(GanttViewDataItem item)
 {
     return(this.GetNestedValue(item, this.startDescriptor));
 }
Esempio n. 30
0
 public void SetParent(GanttViewDataItem item, object value)
 {
     this.SetNestedValue(item, this.parentDescriptor, value);
 }