示例#1
0
        public ActivityTime(LogTimeItem item)
        {
            InitializeComponent();

            LogItem = item;
            timePickerAll.Time = LogItem.LoggedTime;
            Name = LogItem.ActivityID;
        }
示例#2
0
 public static void Remove(LogTimeItem item)
 {
     if (Cache != null)
     {
         lock(SyncRoot)
         {
             Cache.Data.Remove(item);
         }
     }
 }
示例#3
0
 public static void AddLogItem(LogTimeItem item)
 {
     CheckCache();
     Cache.Data.Add(item);
 }
示例#4
0
        private void btnAddLogItem_Click(object sender, EventArgs e)
        {
            if(lvActivities.SelectedItems.Count == 1)
            {
                var selected = lvActivities.SelectedItems[0];
                foreach (var item in flowPanel.Controls)
                {
                    if (((ActivityTime)item).Name == selected.Text)
                    {
                        return;
                    }
                }

                //flow panel doesn't contain such activity now
                //can add
                var logTime = new LogTimeItem();
                logTime.ActivityID = selected.Text;
                logTime.DayOfLogging = dateTimePicker.Value.Date;

                LogItemsService.AddLogItem(logTime);

                var control = new ActivityTime(logTime);
                control.RemoveButtonClicked += control_RemoveButtonClicked;
                control.AddButtonClicked += control_AddButtonClicked;
                flowPanel.Controls.Add(control);

                FormChanged();
            }
        }