private void timeline_Drop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent("Entry"))
            {
                TimelineEntry entry = e.Data.GetData("Entry") as TimelineEntry;

                Point dropPosition = e.GetPosition(this.icEntries);

                TimeSpan time = getPositionTime(dropPosition.X);

                TimelineEntry newEntry = new TimelineEntry(entry.Source, new TimeSpan((int)this.Day, time.Hours, time.Minutes, time.Seconds), entry.EndTime, entry.Text, entry.Brush, entry.ToolTip);

                object[] objects = new object[2] {
                    entry, newEntry
                };

                RaiseEvent(new RoutedEventArgs(EntryChangedEvent, objects));
            }
            if (e.Data.GetDataPresent("Route"))
            {
                Point dropPosition = e.GetPosition(this.icEntries);

                TimeSpan time = getPositionTime(dropPosition.X);

                //Route route= e.Data.GetData("Route") as Route;

                Airport route = e.Data.GetData("Route") as Airport;

                TimelineDropItem entry = new TimelineDropItem(time, this.Day, e.Data.GetData("Route"));
                RaiseEvent(new RoutedEventArgs(EntryAddedEvent, entry));

                //ListView listView = sender as ListView;
                //listView.Items.Add(contact);
            }
        }
Beispiel #2
0
        private void timeline_Drop(object sender, DragEventArgs e)
        {
            if (e.Data.GetDataPresent("Entry"))
            {
                TimelineEntry entry = e.Data.GetData("Entry") as TimelineEntry;

                Point dropPosition = e.GetPosition(this.icEntries);

                TimeSpan time = getPositionTime(dropPosition.X);

                TimelineEntry newEntry = new TimelineEntry(entry.Source, new TimeSpan((int)this.Day, time.Hours,time.Minutes,time.Seconds), entry.EndTime, entry.Text, entry.Brush, entry.ToolTip);

                object[] objects = new object[2]{entry,newEntry};

                RaiseEvent(new RoutedEventArgs(EntryChangedEvent,objects));

            }
            if (e.Data.GetDataPresent("Route"))
            {
                Point dropPosition = e.GetPosition(this.icEntries);

                TimeSpan time = getPositionTime(dropPosition.X);

                //Route route= e.Data.GetData("Route") as Route;

                Airport route = e.Data.GetData("Route") as Airport;

                TimelineDropItem entry = new TimelineDropItem(time,this.Day,e.Data.GetData("Route"));
                RaiseEvent(new RoutedEventArgs(EntryAddedEvent, entry));

                //ListView listView = sender as ListView;
                //listView.Items.Add(contact);
            }
        }