public Border AddEventBlock(Canvas canvas, Rect rect, EventBorderViewModel evt, bool isUnbound)
        {
            canvas.Children.Add(GenerateShadowEventBorder(canvas, rect, evt));

            var brd = GenerateGeneralEventBorder(canvas, rect, evt);

            canvas.Children.Add(brd);
            var grid = new Grid();

            brd.Child = grid;

            var blck = GetVacanteTextBlock();

            blck.VerticalAlignment = VerticalAlignment.Top;
            blck.HorizontalAlignment = HorizontalAlignment.Center;
            blck.Text = evt.Title;
            grid.Children.Add(blck);

            if (isUnbound)
            {
                brd.Style = canvas.FindResource("UnboundEventItemBorder") as Style;
            }
            else
            {
                TextBlock deletableTextBlock = new TextBlock();
                deletableTextBlock.Style = canvas.FindResource("DeletableTextBlock") as Style;
                brd.Style = canvas.FindResource("EventItemBorder") as Style;
                grid.Children.Add(deletableTextBlock);
            }

            return brd;
        }
        public String GetOverView(EventBorderViewModel evt)
        {
            StringBuilder build = new StringBuilder();
            build.AppendLine("イベント名:" + evt.Title);
            build.AppendLine("開始日時:" + evt.Parent.StartDateTime.ToString("yyyy/MM/dd(ddd) HH:mm:ss"));
            build.AppendLine("終了日時:" + evt.Parent.EndDateTime.ToString("yyyy/MM/dd(ddd) HH:mm:ss"));
            build.AppendLine("【参加者】");

            foreach (var id in evt.Parent.Participants)
            {
                var axis = GetAxis(id);
                if (!axis.IsUnbound)
                {
                    build.AppendLine(axis.HeaderName);
                }
            }

            return build.ToString();
        }
        public Border GenerateShadowEventBorder(Canvas canvas, Rect rect, EventBorderViewModel evt)
        {
            var brd = GenerateGeneralEventBorder(canvas, rect, evt);

            brd.Effect = new DropShadowEffect
            {
                Color = new Color { A = 255, R = 219, G = 219, B = 219 },
                Direction = 295,
                ShadowDepth = 5,
                Opacity = 5
            };

            return brd;
        }
        public Border GenerateGeneralEventBorder(Canvas canvas, Rect rect, EventBorderViewModel evt)
        {
            var brd = VacantBorder(1);
            brd.CornerRadius = new CornerRadius(2, 2, 2, 2);
            brd.DataContext = evt;
            brd.ToolTip = GetOverView(evt);

            brd.Width = rect.Width;
            brd.Height = rect.Height;

            Canvas.SetTop(brd, rect.Top);
            Canvas.SetLeft(brd, rect.Left);

            return brd;
        }
        public void GenerateEvents(Canvas canvas, EventModelManager eventManager)
        {
            var dictionary = eventManager.GetEventModel(TimeRangeCollection.First().StartDateTime, TimeRangeCollection.Last().EndDateTime);

            foreach (var axis in AxisDataCollection)
            {
                if (axis.IsDisplayed == false)
                {
                    continue;
                }

                if (!dictionary.ContainsKey(axis.Id))
                {
                    continue;
                }

                var placableRectList = new List<PlacableRect>();

                foreach (var evModl in dictionary[axis.Id])
                {
                    var top = GetTop(evModl.StartDateTime);
                    var height = GetHeight(evModl.StartDateTime, evModl.EndDateTime.AddSeconds(-1));

                    var viewModel = new EventBorderViewModel() { Parent = evModl, MyBrush = axis.DrawBrush, Title = evModl.Title };
                    placableRectList.Add(new PlacableRect(){rect = new Rect(0, top, 0, height), source = viewModel});

                }
                GenerateEventBorders(canvas, placableRectList, GetLeft(axis.Id), axis.Width, axis.IsUnbound);
            }
        }
 private void DeleteEventItem(EventBorderViewModel delModel)
 {
     if (delModel != null)
     {
         if (ShowDialogManager.ShowMessageBox("このイベントを削除してもいいですか?\n(選択した人物に関わらず同じイベントは全部消えます)", "確認", MessageBoxButton.YesNo, MessageBoxImage.Question)
             == MessageBoxResult.Yes)
         {
             _timelineViewModel.DeleteEvent(delModel);
         }
     }
 }
        public void DeleteEvent(EventBorderViewModel eventViewModel)
        {
            _eventModelManager.Remove(eventViewModel.Parent);
            _view.OnEventChanged(_view, new Timeline.EventChangedArgs() { kind = Timeline.EventChangedKind.Delete, model = eventViewModel.Parent });

            Initialize();
        }