1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
| using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Collections.ObjectModel;
namespace WpfGraphicPlannigBis
{
public class Task : INotifyPropertyChanged
{
private DateTime thisDate = new DateTime(2015, 01, 01, 0, 0, 0);
private DateTime dstDate = new DateTime(2015, 01, 31, 0, 0, 0);
public Task()
{
_description = "Task";
_startDate = new DateTimeOffset(thisDate, new TimeSpan(0, 0, 0));
_endDate = new DateTimeOffset(dstDate, new TimeSpan(0, 0, 0));
_personName = "PersonName";
}
public Task(string pdesc, DateTimeOffset t1, DateTimeOffset t2,int scale,string pname):this()
{
_description = pdesc;
_startDate = t1;
_endDate = t2;
_scaleDuration = scale;
_duration = _scaleDuration * (_endDate.Day - _startDate.Day);
_x = ScaleDuration * _startDate.Day;
_personName = pname;
}
private string _description ;
public string Description
{
get { return _description; }
set
{
_description = value;
OnPropertyChanged("Description");
}
}
private DateTimeOffset _startDate;
public DateTimeOffset StartDate
{
get { return _startDate; }
set
{
_startDate = value;
OnPropertyChanged("StartDate");
}
}
private DateTimeOffset _endDate;
public DateTimeOffset EndDate
{
get { return _endDate; }
set
{
_endDate = value;
OnPropertyChanged("EndDate");
}
}
private int _duration;
public int Duration
{
get { return _duration; }
set
{
_duration = value;
OnPropertyChanged("Duration");
}
}
//abscisse du jour de debut
private int _x;
public int X
{
get { return _x; }
set
{
_x = value;
OnPropertyChanged("X");
}
}
private string _personName;
public string PersonName
{
get { return _personName; }
set
{
_personName = value;
OnPropertyChanged("PersonName");
}
}
//facteur d'echelle du graphisme
private static int _scaleDuration = 50;
public static int ScaleDuration
{
get { return _scaleDuration; }
set
{
_scaleDuration = value;
}
}
#region INotifyPropertyChanged Membres
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propName));
}
}
#endregion
}
public class Tasks : ObservableCollection<Task>
{
public Tasks()
{ }
}
} |
Partager