private void UserControl_Loaded_1(object sender, RoutedEventArgs e) { _model = this.DataContext as EventViewModel; this.DeletableStackPanel.NoItemMessage = "ここには登録した登場人物が表示されます"; this.DeletableStackPanel.DataList = _model.AppearListViewItems; this.DeletableStackPanel.Initialize(); }
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(); } }