示例#1
0
 public static void RemoveActivity(Activity activity)
 {
     CheckCache();
     Cache.Activities.Remove(activity);
 }
示例#2
0
        private void lvActivities_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if(lvActivities.SelectedItems.Count == 1)
            {
                var dialog = new AddActivityDialog();
                var selected = lvActivities.SelectedItems[0];
                dialog.Value = selected.Text;
                dialog.Descripton = selected.ToolTipText;

                var prevName = dialog.Value;

                dialog.Text = "Edit Activity";

                var result = dialog.ShowDialog();
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    LogItemsService.RemoveActivityByName(prevName);

                    var activity = new Activity() { ID = dialog.Value, Name = dialog.Value, Description = dialog.Descripton };
                    LogItemsService.AddActivity(activity);

                    selected.Text = activity.Name;
                    selected.ToolTipText = activity.Description;

                    LoadLogTimeItems(dateTimePicker.Value.Date);
                    FillAllTime();

                    FormChanged();
                }
            }
        }
示例#3
0
 public static void AddActivity(Activity activity)
 {
     CheckCache();
     Cache.Activities.Add(activity);
 }
示例#4
0
 private void button1_Click(object sender, EventArgs e)
 {
     var dialog = new AddActivityDialog();
     var result = dialog.ShowDialog();
     if (result == System.Windows.Forms.DialogResult.OK)
     {
         var activity = new Activity() { ID = dialog.Value, Name = dialog.Value, Description = dialog.Descripton };
         LogItemsService.AddActivity(activity);
         lvActivities.Items.Add(new ListViewItem() { Text = activity.Name, ToolTipText = activity.Description });
         FormChanged();
     }
 }