/// <summary> /// 更新データとしてコンバートを行う /// </summary> /// <param name="src">コンバート対象</param> /// <param name="target">コンバート先</param> /// <returns>TimelineEventModel</returns> public static void ConvertAsModify(EventModel src, TimelineEventModel target) { target.Title = src.Title; target.StartDateTime = src.StartDateTime; target.EndDateTime = src.EndDateTime; target.Detail = src.Detail; target.Participants = src.Participants; }
/// <summary> /// 新規データとしてコンバートを行う /// </summary> /// <param name="evt">コンバートしたいイベントモデル</param> /// <returns>TimelineEventModel</returns> public static TimelineEventModel ConvertAsNew(EventModel evt) { var newModel = ModelsComposite.TimelineEventModelManager.GetNewModel(); newModel.Title = evt.Title; newModel.StartDateTime = evt.StartDateTime; newModel.EndDateTime = evt.EndDateTime; newModel.Detail = evt.Detail; newModel.Participants = evt.Participants; return newModel; }
public void Add(EventModel eventModel) { _eventModelCollection.Add(eventModel); }
public void Remove(EventModel eventModel) { _eventModelCollection.Remove(eventModel); }
public void ShowExistEvent(EventModel eventModel) { EventViewModel evtModel = new EventViewModel() { StartDateTime = eventModel.StartDateTime, EndDateTime = eventModel.EndDateTime, Detail = eventModel.Detail, Title = eventModel.Title, AppearListViewItems = GenerateAppearListViewItemModel(eventModel) }; CommonLightBox lightBox = new CommonLightBox(); EventRegister register = new EventRegister(); register.DataContext = evtModel; lightBox.LightBoxKind = CommonLightBox.CommonLightBoxKind.SaveCancel; lightBox.BindUIElement(register); lightBox.Owner = Application.Current.MainWindow; if (ShowDialogManager.ShowDialog(lightBox) == true) { _eventModelManager.Remove(eventModel); var participants = GetParticipants(evtModel.AppearListViewItems); // 参加者がいないイベント作っても意味ないよね if (participants.Count() == 0) { _view.OnEventChanged(_view, new Timeline.EventChangedArgs() { kind = Timeline.EventChangedKind.Delete, model = eventModel }); } else { var addEvent = new EventModel() { StartDateTime = evtModel.StartDateTime, EndDateTime = evtModel.EndDateTime, Title = evtModel.Title, Detail = evtModel.Detail, Participants = GetParticipants(evtModel.AppearListViewItems), SourceObject = eventModel.SourceObject, }; _eventModelManager.Add(addEvent); _view.OnEventChanged(_view, new Timeline.EventChangedArgs() { kind = Timeline.EventChangedKind.Modify, model = addEvent }); } Initialize(); } }
public void ShowEventOnVacantCell(TimeBorderViewModel borderModel) { EventViewModel evtModel = new EventViewModel() { StartDateTime = borderModel.StartDateTime, EndDateTime = borderModel.EndDateTime, AppearListViewItems = GenerateAppearListViewItemModel(borderModel) }; CommonLightBox lightBox = new CommonLightBox(); EventRegister register = new EventRegister(); register.DataContext = evtModel; lightBox.LightBoxKind = CommonLightBox.CommonLightBoxKind.SaveCancel; lightBox.BindUIElement(register); lightBox.Owner = Application.Current.MainWindow; lightBox.OnSaveAndQuit += register.OnSaveAndQuit; if (ShowDialogManager.ShowDialog(lightBox) == true) { var participants = GetParticipants(evtModel.AppearListViewItems); // 参加者がいないイベント作っても意味ないよね if (participants.Count() == 0) { return; } var addEvent = new EventModel() { StartDateTime = evtModel.StartDateTime, EndDateTime = evtModel.EndDateTime, Title = evtModel.Title, Detail = evtModel.Detail, Participants = participants, }; _eventModelManager.Add(addEvent); _view.OnEventChanged(_view, new Timeline.EventChangedArgs(){kind = Timeline.EventChangedKind.Add, model = addEvent}); Initialize(); } }
public ObservableCollection<AppearListViewItemModel> GenerateAppearListViewItemModel(EventModel eventModel) { ObservableCollection<AppearListViewItemModel> modelList = new ObservableCollection<AppearListViewItemModel>(); foreach (var item in _dataSource) { if (item.IsUnbound) { continue; } if (eventModel.Participants.Contains(item.Id)) { modelList.Add(new AppearListViewItemModel(item.HeaderName, true, "登場する", "登場しない", item) { BackgroundBrush = item.DrawBrush }); } else { modelList.Add(new AppearListViewItemModel(item.HeaderName, false, "登場する", "登場しない", item) { BackgroundBrush = item.DrawBrush }); } } return modelList; }
public void Remove(EventModel eventModel) { _eventModelCollection.Remove(eventModel); }
public void Add(EventModel eventModel) { _eventModelCollection.Add(eventModel); }