public SlideInfoWrapper(ICalendarControl parentCalendar, RetractableBarControl container)
        {
            _parentCalendar = parentCalendar;

            _container = container;
            _container.StateChanged += Container_StateChanged;
        }
 public MonthViewControl(ICalendarControl calendar)
 {
     InitializeComponent();
     Dock             = DockStyle.Fill;
     Calendar         = calendar;
     SelectionManager = new SelectionManager(this);
     CopyPasteManager = new CopyPasteManager(this);
 }
Exemplo n.º 3
0
 protected override void OnContentChanged(object oldContent, object newContent)
 {
     base.OnContentChanged(oldContent, newContent);
     if (!(newContent is IAppointment))
     {
         owner = null;
     }
 }
Exemplo n.º 4
0
 public CalendarTimeslotItem(ICalendarControl calendar)
 {
     this.calendar = calendar;
     AllowDrop = true;
     Binding result = new Binding("ReadOnly");
     result.Source = calendar;
     result.Converter = new NegationConverter();
     SetBinding(IsHitTestVisibleProperty, result);
 }
Exemplo n.º 5
0
		public MonthViewControl(ICalendarControl calendar)
		{
			InitializeComponent();
			Dock = DockStyle.Fill;
			Calendar = calendar;
			Months = new Dictionary<DateTime, MonthControl>();
			SelectionManager = new SelectionManager(this);
			CopyPasteManager = new CopyPasteManager(this);
		}
Exemplo n.º 6
0
 public CalendarAppointmentItem(ICalendarControl owner)
 {
     this.owner = owner;
     dragDrop.SetDragSource(this, (FrameworkElement)owner, delegate
     {
         StartDragDrop();
     });
     AllowDrop        = true;
     this.MouseEnter +=
         new MouseEventHandler(SimpleButton_MouseEnter);
     this.MouseLeave +=
         new MouseEventHandler(SimpleButton_MouseLeave);
 }
Exemplo n.º 7
0
 public TaskWindow(CampaignSave save_state, CampaignState state, Calendar calendar, decimal now, Guid?entry_guid = null, Guid?guid = null)
 {
     this.valid      = false;
     this.save_state = save_state;
     this.state      = state.copy();
     this.now        = now;
     this.actions    = new List <EntryAction>();
     if (guid is null)
     {
         if (entry_guid is null)
         {
             throw new ArgumentNullException(nameof(entry_guid));
         }
         this.guid = Guid.NewGuid();
         ActionTaskCreate add_action = new ActionTaskCreate(this.guid, new Task(entry_guid.Value, ""));
         this.actions.Add(add_action);
         this.task = add_action.task;
     }
     else
     {
         this.guid = guid.Value;
         this.task = this.state.tasks.tasks[this.guid];
     }
     InitializeComponent();
     this.name_box.Text              = this.task.name;
     this.description_box.Text       = this.task.description;
     this.current_timestamp_box.Text = calendar.format_timestamp(now);
     if (this.task.completed_guid is null)
     {
         FrameworkElement due_box = calendar.timestamp_control();
         Grid.SetRow(due_box, 2);
         Grid.SetColumn(due_box, 1);
         this.main_grid.Children.Add(due_box);
         this.due_box = due_box as ICalendarControl;
         if (this.due_box is null)
         {
             throw new InvalidOperationException();
         }
         FrameworkElement due_diff_box = calendar.interval_control();
         Grid.SetRow(due_diff_box, 2);
         Grid.SetColumn(due_diff_box, 3);
         this.main_grid.Children.Add(due_diff_box);
         this.due_diff_box = due_diff_box as ICalendarControl;
         if (this.due_diff_box is null)
         {
             throw new InvalidOperationException();
         }
         if (this.task.due is null)
         {
             this.due_checkbox.IsChecked      = false;
             this.due_box.calendar_value      = now;
             this.due_box.IsReadOnly          = true;
             this.due_diff_box.calendar_value = 0;
             this.due_diff_box.IsReadOnly     = true;
         }
         else
         {
             this.due_checkbox.IsChecked = true;
             this.due_box.calendar_value = this.task.due.Value;
             this.due_box.IsReadOnly     = false;
             decimal due_diff = this.task.due.Value - now;
             if (due_diff < 0)
             {
                 this.timestamp_diff_label.Content = "before";
                 due_diff = -due_diff;
             }
             else
             {
                 this.timestamp_diff_label.Content = "after";
             }
             this.due_diff_box.calendar_value = due_diff;
             this.due_diff_box.IsReadOnly     = false;
         }
         this.due_box.value_changed      = this.due_changed;
         this.due_diff_box.value_changed = this.due_diff_changed;
     }
     else
     {
         decimal?completed_timestamp = null;
         if (task.completed_guid == entry_guid)
         {
             completed_timestamp = now;
         }
         else
         {
             foreach (Entry entry in this.save_state.domain.entries)
             {
                 if (entry.guid == task.completed_guid)
                 {
                     completed_timestamp = entry.timestamp;
                     break;
                 }
             }
         }
         if (completed_timestamp is null)
         {
             throw new InvalidOperationException();
         }
         if (this.task.failed)
         {
             this.status_label.Content = "Failed:";
         }
         else
         {
             this.status_label.Content = "Completed:";
         }
         this.status_label.Visibility  = Visibility.Visible;
         this.due_checkbox.Visibility  = Visibility.Collapsed;
         this.timestamp_box.Text       = calendar.format_timestamp(completed_timestamp.Value);
         this.timestamp_box.Visibility = Visibility.Visible;
         decimal timestamp_diff = completed_timestamp.Value - now;
         if (timestamp_diff < 0)
         {
             this.timestamp_diff_label.Content = "before";
             timestamp_diff = -timestamp_diff;
         }
         else
         {
             this.timestamp_diff_label.Content = "after";
         }
         this.timestamp_diff_box.Text       = calendar.format_interval(timestamp_diff);
         this.timestamp_diff_box.Visibility = Visibility.Visible;
     }
 }
Exemplo n.º 8
0
        public EntryWindow(CampaignSave save_state, int entry = -1, List <EntryAction> actions = null)
        {
            this.valid      = false;
            this.save_state = save_state;
            this.entry      = entry;
            this.entries    = new List <Entry>();
            for (int i = 0; i < save_state.domain.entries.Count; i++)
            {
                if (i != entry)
                {
                    this.entries.Add(save_state.domain.entries[i]);
                }
            }
            if ((entry >= 0) && (entry < save_state.domain.valid_entries))
            {
                this.state = save_state.domain.get_entry_state(entry);
            }
            else
            {
                this.state = save_state.domain.state.copy();
            }
            Entry previous_entry = null, current_entry;

            if ((entry >= 0) && (entry < save_state.domain.entries.Count))
            {
                current_entry = save_state.domain.entries[entry];
                if (entry > 0)
                {
                    this.previous_entry_idx = entry - 1;
                    previous_entry          = this.entries[entry - 1];
                }
            }
            else
            {
                decimal timestamp;
                int     session;
                if (save_state.domain.valid_entries > 0)
                {
                    this.previous_entry_idx = save_state.domain.valid_entries - 1;
                    previous_entry          = this.entries[this.previous_entry_idx];
                    timestamp = previous_entry.timestamp + 1;
                }
                else
                {
                    timestamp = save_state.calendar.default_timestamp;
                }
                session = previous_entry?.session ?? 1;
                if ((previous_entry is not null) && ((DateTime.Now - previous_entry.created) >= SESSION_DOWNTIME_THRESHOLD))
                {
                    session += 1;
                }
                current_entry = new Entry(timestamp, DateTime.Now, "", session, actions);
                if (actions is not null)
                {
                    foreach (EntryAction action in actions)
                    {
                        action.apply(this.state, current_entry);
                    }
                }
            }
            this.actions = new List <EntryAction>();
            this.add_actions(current_entry.actions, false);
            InitializeComponent();
            this.session_box.textBox.VerticalContentAlignment = VerticalAlignment.Center;
            this.session_box.Value = current_entry.session ?? 0;
            this.created_time_box.textBox.VerticalContentAlignment = VerticalAlignment.Center;
            this.created_time_box.Pattern      = CultureInfo.CurrentCulture.DateTimeFormat.LongTimePattern;
            this.created_date_box.SelectedDate = current_entry.created.Date;
            this.created_time_box.Value        = current_entry.created.TimeOfDay.TotalSeconds;
            FrameworkElement timestamp_box = save_state.calendar.timestamp_control();

            Grid.SetRow(timestamp_box, 0);
            Grid.SetColumn(timestamp_box, 6);
            this.header_grid.Children.Add(timestamp_box);
            this.timestamp_box = timestamp_box as ICalendarControl;
            if (this.timestamp_box is null)
            {
                throw new InvalidOperationException();
            }
            this.timestamp_box.calendar_value = current_entry.timestamp;
            FrameworkElement timestamp_diff_box = save_state.calendar.interval_control();

            Grid.SetRow(timestamp_diff_box, 0);
            Grid.SetColumn(timestamp_diff_box, 8);
            this.header_grid.Children.Add(timestamp_diff_box);
            this.timestamp_diff_box = timestamp_diff_box as ICalendarControl;
            if (this.timestamp_diff_box is null)
            {
                throw new InvalidOperationException();
            }
            this.timestamp_diff_box.calendar_value = (previous_entry is null ? 0 : current_entry.timestamp - previous_entry.timestamp);
            this.timestamp_box.value_changed       = this.timestamp_changed;
            this.timestamp_diff_box.value_changed  = this.timestamp_diff_changed;
            this.previous_entry_box.Text           = (previous_entry is null ? "n/a" : save_state.calendar.format_timestamp(previous_entry.timestamp));
            this.description_box.Text    = current_entry.description;
            this.action_list.ItemsSource = this.actions;
            this.event_list = new CalendarEventListControl(this.entry_action_callback, current_entry.guid);
            this.event_list.set_calendar(this.save_state.calendar);
            this.event_list.set_state(this.state, current_entry.timestamp);
            this.event_group.Content = this.event_list;
            this.character_list      = new CharacterListControl(this.entry_action_callback);
            this.character_list.set_char_sheet(this.save_state.character_sheet);
            this.character_list.set_state(this.state);
            this.character_group.Content = this.character_list;
            this.inventory_list          = new InventoryListControl(this.entry_action_callback);
            this.inventory_list.set_state(this.save_state, this.state);
            this.inventory_group.Content = this.inventory_list;
            this.topic_list = new TopicListControl(this.entry_action_callback, current_entry.guid);
            this.topic_list.set_state(this.save_state, this.state, current_entry.timestamp);
            this.topic_group.Content = this.topic_list;
            this.task_list           = new TaskListControl(this.entry_action_callback, current_entry.guid);
            this.task_list.set_calendar(this.save_state.calendar);
            this.task_list.set_state(this.save_state, this.state, current_entry.timestamp);
            this.task_group.Content = this.task_list;
        }
Exemplo n.º 9
0
        public CalendarEventWindow(CampaignState state, Calendar calendar, decimal now, Guid?entry_guid = null, Guid?guid = null)
        {
            this.valid   = false;
            this.state   = state.copy();
            this.now     = now;
            this.actions = new List <EntryAction>();
            if (guid is null)
            {
                if (entry_guid is null)
                {
                    throw new ArgumentNullException(nameof(entry_guid));
                }
                this.guid = Guid.NewGuid();
                ActionCalendarEventCreate add_action = new ActionCalendarEventCreate(this.guid, new CalendarEvent(entry_guid.Value, now, ""));
                this.actions.Add(add_action);
                this.evt = add_action.evt;
            }
            else
            {
                this.guid = guid.Value;
                this.evt  = this.state.events.events[this.guid];
            }
            InitializeComponent();
            FrameworkElement timestamp_box = calendar.timestamp_control();

            Grid.SetRow(timestamp_box, 0);
            Grid.SetColumn(timestamp_box, 1);
            this.main_grid.Children.Add(timestamp_box);
            this.timestamp_box = timestamp_box as ICalendarControl;
            if (this.timestamp_box is null)
            {
                throw new InvalidOperationException();
            }
            this.timestamp_box.calendar_value = this.evt.timestamp;
            FrameworkElement timestamp_diff_box = calendar.interval_control();

            Grid.SetRow(timestamp_diff_box, 0);
            Grid.SetColumn(timestamp_diff_box, 3);
            this.main_grid.Children.Add(timestamp_diff_box);
            this.timestamp_diff_box = timestamp_diff_box as ICalendarControl;
            if (this.timestamp_diff_box is null)
            {
                throw new InvalidOperationException();
            }
            decimal timestamp_diff = this.evt.timestamp - now;

            if (timestamp_diff < 0)
            {
                this.timestamp_diff_label.Content = "before";
                timestamp_diff = -timestamp_diff;
            }
            else
            {
                this.timestamp_diff_label.Content = "after";
            }
            this.timestamp_diff_box.calendar_value = timestamp_diff;
            this.current_timestamp_box.Text        = calendar.format_timestamp(now);
            this.timestamp_box.value_changed       = this.timestamp_changed;
            this.timestamp_diff_box.value_changed  = this.timestamp_diff_changed;
            this.repeat_box.IsChecked = (this.evt.interval is not null);
            FrameworkElement interval_box = calendar.interval_control();

            Grid.SetRow(interval_box, 0);
            Grid.SetColumn(interval_box, 9);
            this.main_grid.Children.Add(interval_box);
            this.interval_box = interval_box as ICalendarControl;
            if (this.interval_box is null)
            {
                throw new InvalidOperationException();
            }
            this.interval_box.calendar_value = (this.evt.interval ?? 0);
            this.name_box.Text        = this.evt.name;
            this.description_box.Text = this.evt.description;
        }