/// <summary>
 /// Handles the Removed event of the Point control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="MetroTaskPointCollectionEventArgs"/> instance containing the event data.</param>
 private void Point_Removed(object sender, MetroTaskPointCollectionEventArgs e)
 {
     if (e.Item != null)
     {
         ZeroitMetroTask metroTask = this;
         e.Item.PropertyChanged -= new PropertyChangedEventHandler(metroTask.Item_PropertyChanged);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ZeroitMetroTaskSmartTagActionList"/> class.
        /// </summary>
        /// <param name="component">A component related to the <see cref="T:System.ComponentModel.Design.DesignerActionList" />.</param>
        public ZeroitMetroTaskSmartTagActionList(IComponent component) : base(component)
        {
            this.colUserControl = component as ZeroitMetroTask;

            // Cache a reference to DesignerActionUIService, so the
            // DesigneractionList can be refreshed.
            this.designerActionUISvc = GetService(typeof(DesignerActionUIService)) as DesignerActionUIService;
        }
 /// <summary>
 /// Handles the Added event of the Point control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="MetroTaskPointCollectionEventArgs"/> instance containing the event data.</param>
 private void Point_Added(object sender, MetroTaskPointCollectionEventArgs e)
 {
     if (e.Item != null)
     {
         ZeroitMetroTask metroTask = this;
         e.Item.PropertyChanged += new PropertyChangedEventHandler(metroTask.Item_PropertyChanged);
     }
     ZeroitMetroTask.PointAddedEventHandler pointAddedEventHandler = this.PointAdded;
     if (pointAddedEventHandler != null)
     {
         pointAddedEventHandler(this, new MetroTaskPointCollectionEventArgs(e.Item));
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ZeroitMetroTask" /> class.
        /// </summary>
        public ZeroitMetroTask()
        {
            //this._PointCollection = new MetroTaskPointCollection();
            this._FinishedColor   = Design.MetroColors.TaskColor;
            this._LineColor       = Design.MetroColors.TaskColor;
            this._HoverColor      = Design.MetroColors.AccentLightBlue;
            this._StartPointWidth = 10;
            this._Style           = Design.Style.Light;
            this._PointPosition   = new List <Rectangle>();
            this._TextRectangles  = new List <Rectangle>();
            this._HotIndex        = -1;
            this._AutoStyle       = true;
            this.Font             = new System.Drawing.Font("Segoe UI", 9f);
            this.SetStyle(ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.SupportsTransparentBackColor | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
            this.UpdateStyles();

            ZeroitMetroTask metroTask = this;

            this._PointCollection.ItemAdded += new EventHandler <MetroTaskPointCollectionEventArgs>(metroTask.Point_Added);
            ZeroitMetroTask metroTask1 = this;

            this._PointCollection.ItemRemoving += new EventHandler <MetroTaskPointCollectionEventArgs>(metroTask1.Point_Removed);
            Refresh();
        }