Ejemplo n.º 1
0
 private void itemsListView_DragDrop(object sender, DragEventArgs e)
 {
     if (e.Effect != DragDropEffects.None)
     {
         if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IRun)
         {
             IRun item = (IRun)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
             Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (IRun)item.Clone() : item);
         }
         else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable)
         {
             IEnumerable <IRun> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast <IRun>();
             if (e.Effect.HasFlag(DragDropEffects.Copy))
             {
                 Cloner cloner = new Cloner();
                 items = items.Select(x => cloner.Clone(x));
             }
             if (RunCollection != null)
             {
                 RunCollection.AddRange(items);
             }
             else // the content is an IItemCollection<IRun>
             {
                 foreach (IRun item in items)
                 {
                     Content.Add(item);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
        public void Save(IRun run, Stream stream)
        {
            var obj = (IRun)run.Clone();
            foreach (var segment in obj)
            {
                segment.SplitTime = default(Time);
            }

            var formatter = new BinaryFormatter();
            formatter.Serialize(stream, obj);
        }
Ejemplo n.º 3
0
        public void Save(IRun run, Stream stream)
        {
            var obj = (IRun)run.Clone();

            foreach (var segment in obj)
            {
                segment.SplitTime = default(Time);
            }

            var formatter = new BinaryFormatter();

            formatter.Serialize(stream, obj);
        }