示例#1
0
        public void CopyToFolder()
        {
            //Copy the selected entries to another schedule
            dlgMoveEntry dlgCopyTo = new dlgMoveEntry();

            if (dlgCopyTo.ShowDialog(this) == DialogResult.OK)
            {
                //Package data
                DispatchDS ds = new DispatchDS();
                for (int i = 0; i < this.grdSchedule.Selected.Rows.Count; i++)
                {
                    int           ID    = Convert.ToInt32(this.grdSchedule.Selected.Rows[i].Cells["ID"].Value);
                    ScheduleEntry entry = this.mSchedule.Item(ID);
                    ds.Merge(entry.ToDataSet());
                }

                //Get destination schedule and copy data
                DispatchSchedule schedule = dlgCopyTo.Schedule;
                schedule.AddList(ds);
            }
        }
示例#2
0
        private void OnDragDropMouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            //Start drag\drop if user is dragging
            DataObject oData = null;

            try {
                switch (e.Button)
                {
                case MouseButtons.Left:
                    if (this.mIsDragging)
                    {
                        //Initiate drag drop operation from this schedule
                        DispatchDS ds = new DispatchDS();
                        for (int i = 0; i < this.grdSchedule.Selected.Rows.Count; i++)
                        {
                            int           ID    = Convert.ToInt32(this.grdSchedule.Selected.Rows[i].Cells["ID"].Value);
                            ScheduleEntry entry = this.mSchedule.Item(ID);
                            ds.Merge(entry.ToDataSet());
                        }
                        oData = new DataObject();
                        oData.SetData(ds);
                        DragDropEffects effect = this.grdSchedule.DoDragDrop(oData, DragDropEffects.All);

                        //After the drop- remove from this schedule on move
                        switch (effect)
                        {
                        case DragDropEffects.Move:      this.mSchedule.RemoveList(ds); break;

                        case DragDropEffects.Copy:      break;
                        }
                    }
                    break;
                }
            }
            catch (Exception ex) { reportError(ex); }
        }