UserControl1.xaml の相互作用ロジック
Inheritance: System.Windows.Window
        public void ExecuteOnAdd(ObservableCollection<AppearListViewItemModel> dataList)
        {
            CommonLightBox dialog = new CommonLightBox();

            TagsSelectorView selectorView = new TagsSelectorView();
            var tagSelectorViewModel = new TagSelectorViewModel();
            SetSelectingTags(tagSelectorViewModel.SelectingTags);
            selectorView.SetModel(tagSelectorViewModel);

            dialog.Owner = Application.Current.MainWindow;
            dialog.BindUIElement(selectorView);
            dialog.LightBoxKind = CommonLightBox.CommonLightBoxKind.SaveCancel;

            dialog.IsStretchable = false;

            selectorView.Height = Application.Current.MainWindow.ActualHeight - 80;
            selectorView.Width = Application.Current.MainWindow.ActualWidth - 80;

            selectorView.DataContext = tagSelectorViewModel;

            if (ShowDialogManager.ShowDialog(dialog) == true)
            {
                tagSelectorViewModel.UpdateModelsComposite();
                _stickable.SetTagIds(GetSelectingTagIds(tagSelectorViewModel.SelectingTags));

                dataList.Clear();
                var list = TagToAppearListViewModelConverter.ToAppearListViewItemModel(_stickable.GetTagIds(), _tagManager);
                foreach (var newItemModel in list)
                {
                    dataList.Add(newItemModel);
                }
            }
        }
        private void colorbutton_Click(object sender, RoutedEventArgs e)
        {
            var userControl = new GeneralColorPicker();
            CommonLightBox lightBox = new CommonLightBox();
            lightBox.LightBoxKind = CommonLightBox.CommonLightBoxKind.SaveCancel;
            lightBox.BindUIElement(userControl);
            lightBox.Owner = Application.Current.MainWindow;

            userControl.SelectingColor = ((SolidColorBrush)_model.SelectingModel.ColorBrush).Color;

            if (ShowDialogManager.ShowDialog(lightBox) == true)
            {
                _model.SelectingModel.ColorBrush = new SolidColorBrush(userControl.SelectingColor);
            }
        }
        private void TextStyleButton_Click_1(object sender, RoutedEventArgs e)
        {
            var userControl = new TextBoxColorPicker();
            CommonLightBox lightBox = new CommonLightBox();
            lightBox.LightBoxKind = CommonLightBox.CommonLightBoxKind.SaveCancel;
            lightBox.BindUIElement(userControl);
            lightBox.Owner = Application.Current.MainWindow;

            userControl.SelectingFontFamily = Properties.Settings.Default.TextBoxFontFamily;
            //dlg.DlgFontWeight = FontWeights.Bold;
            userControl.SelectingFontSize = Properties.Settings.Default.TextBoxFontSize;
            userControl.SelectingFontColor = Properties.Settings.Default.TextBoxFontColor;
            userControl.SelectingBackgroundColor = Properties.Settings.Default.TextBoxBackgroundColor;

            if (ShowDialogManager.ShowDialog(lightBox) == true)
            {
                Properties.Settings.Default.TextBoxFontColor = userControl.SelectingFontColor;
                Properties.Settings.Default.TextBoxBackgroundColor = userControl.SelectingBackgroundColor;
                Properties.Settings.Default.Save();

                EventAggregator.OnFontSettingChanged(this, 0);
            }
        }
        private void FontButton_Click_1(object sender, RoutedEventArgs e)
        {
            var dlg = new emanual.Wpf.Controls.FontDialogEx();
            CommonLightBox lightBox = new CommonLightBox();
            lightBox.LightBoxKind = CommonLightBox.CommonLightBoxKind.SaveCancel;
            lightBox.BindUIElement(dlg);
            lightBox.Owner = Application.Current.MainWindow;

            dlg.DlgFontFamily = Properties.Settings.Default.TextBoxFontFamily;
            //dlg.DlgFontWeight = FontWeights.Bold;
            dlg.DlgFontSize = Properties.Settings.Default.TextBoxFontSize;
            dlg.DlgLanguage = "ja-jp";
            dlg.DlgSampleText = "ここでFontのテストが出来ます";

            if (ShowDialogManager.ShowDialog(lightBox) == true)
            {
                Properties.Settings.Default.TextBoxFontSize = dlg.DlgFontSize;
                Properties.Settings.Default.TextBoxFontFamily = dlg.DlgFontFamily;
                Properties.Settings.Default.Save();

                EventAggregator.OnFontSettingChanged(this, 0);
            }
        }
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            CommonLightBox dialog = new CommonLightBox();

            AppearListViewControl chWindow = new AppearListViewControl();

            dialog.Owner = Application.Current.MainWindow;
            dialog.BindUIElement(chWindow);

            var appearList = GetAppearList();
            var listViewModel = new AppearListViewModel()
            {
                DataList = appearList,
                DisplayOrNoDisplayHeader = "表示する/しない",
            };

            chWindow.DataContext = listViewModel;
            ShowDialogManager.ShowDialog(dialog);

            foreach (var item in listViewModel.DataList)
            {
                var data = item.ParentObject as TimelineAxis;
                data.IsDisplayed = item.IsAppeared;
            }

            _timelineViewModel.Initialize();
        }
        private void SateliteButton_Click(object sender, RoutedEventArgs e)
        {
            SateliteSelector sateliteSelector = new SateliteSelector();
            CommonLightBox commonLightBox = new CommonLightBox();

            commonLightBox.LightBoxKind = CommonLightBox.CommonLightBoxKind.CancelOnly;
            commonLightBox.BindUIElement(sateliteSelector);
            commonLightBox.Owner = Application.Current.MainWindow;

            ShowDialogManager.ShowDialog(commonLightBox);
        }
        public void ShowTimelineAxisEvents(TimelineAxis axis)
        {
            EventModelManager manager = _eventModelManager;

            var list = manager.GetEventModel(axis.Id);
            var eventListViewerViewModel = new EventViewerViewModel() { DataList = new List<EventViewerItemViewModel>() };

            foreach (var item in list)
            {
                eventListViewerViewModel.DataList.Add(new EventViewerItemViewModel()
                {
                    StartDateTime = item.StartDateTime,
                    EndDateTime = item.EndDateTime,
                    Name = item.Title,
                });
            }

            CommonLightBox lightBox = new CommonLightBox();
            EventListViewer viewer = new EventListViewer();

            viewer.DataContext = eventListViewerViewModel;

            lightBox.LightBoxKind = CommonLightBox.CommonLightBoxKind.CancelOnly;
            lightBox.BindUIElement(viewer);
            lightBox.Owner = Application.Current.MainWindow;

            if (ShowDialogManager.ShowDialog(lightBox) == true)
            {
                StartDateTime = viewer.JumpDateTime;
            }
        }
        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();
            }
        }
        /// <summary>
        /// ページ数を計算する
        /// </summary>
        public void CalculatePageNumber()
        {
            SetTextToModelsComposite();
            CommonLightBox dialog = new CommonLightBox();

            var pageLineCalcView = new PageLineCalculatorView();
            var pageLineCalculatorViewModel = new PageLineCalculatorViewModel(ModelsComposite.NovelSettingModel, ModelsComposite.DocumentModel);

            pageLineCalcView.BindModel(pageLineCalculatorViewModel);

            dialog.Owner = Application.Current.MainWindow;
            dialog.BindUIElement(pageLineCalcView);
            dialog.LightBoxKind = CommonLightBox.CommonLightBoxKind.SaveOnly;

            ShowDialogManager.ShowDialog(dialog);
        }