public ThemeScreen() { ThemeName = Label <ThemeScreen, string> .CreateByXPath(this, "/html/body/div/main/div[1]/h3"); Topics = TopicListControl <ThemeScreen> .CreateByXPath(this, "/html/body/div/main/table"); StartButton = Button <ThemeScreen, ExamScreen> .CreateByXPath(this, "/html/body/div/main/div[2]/a"); }
public MainWindow() { this.save_path = null; this.state = null; this.state_dirty = false; this.entry_rows = new ObservableCollection <EntryRow>(); this.character_list = new CharacterListControl(this.entry_action_callback); this.inventory_list = new InventoryListControl(this.entry_action_callback); this.calendar_event_list = new CalendarEventListControl(this.entry_action_callback); this.task_list = new TaskListControl(this.entry_action_callback); this.topic_list = new TopicListControl(this.entry_action_callback); InitializeComponent(); this.character_group.Content = this.character_list; this.inventory_group.Content = this.inventory_list; this.entries_list.ItemsSource = this.entry_rows; this.calendar_event_group.Content = this.calendar_event_list; this.task_group.Content = this.task_list; this.topic_group.Content = this.topic_list; }
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; }