本文整理汇总了C#中BrightIdeasSoftware.OlvDropEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# OlvDropEventArgs类的具体用法?C# OlvDropEventArgs怎么用?C# OlvDropEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OlvDropEventArgs类属于BrightIdeasSoftware命名空间,在下文中一共展示了OlvDropEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: dropSink_Dropped
private void dropSink_Dropped(object sender, OlvDropEventArgs e)
{
OnDropped(e);
}
示例2: tlvGroupedFiles_Dropped
private void tlvGroupedFiles_Dropped(object sender, OlvDropEventArgs e)
{
var target = (tlvBranch)e.DropTargetItem.RowObject;
var index = -1;
var toRefresh = new HashSet<tlvBranch>();
if (target.Data is SpectrumSource)
{
index = target.Parent.Children.IndexOf(target);
target = target.Parent;
}
if (e.DataObject.GetType().ToString() == "System.Windows.Forms.DataObject")
{
var sources = new List<tlvBranch>();
foreach (ListViewItem item in lvNonGroupedFiles.SelectedItems)
sources.Add((tlvBranch)item.Tag);
//var sources = from ListViewItem item in lvNonGroupedFiles.SelectedItems
// select (tlvBranch) item.Tag;
foreach (var source in sources)
{
if (index >= 0)
target.Children.Insert(index, source);
else
target.Children.Add(source);
source.Parent = target;
}
toRefresh.Add(target);
var usedItems = from ListViewItem item in lvNonGroupedFiles.SelectedItems
select item;
foreach (var item in usedItems)
lvNonGroupedFiles.Items.Remove(item);
}
else if (e.DataObject is OLVDataObject)
{
var dragging = e.DataObject as OLVDataObject;
var sources = from tlvBranch item in dragging.ModelObjects
where item.Data is SpectrumSource
select item;
var groups = from tlvBranch item in dragging.ModelObjects
where (item.Data is SpectrumSourceGroup
&& (item.Data as SpectrumSourceGroup).Name != "\\")
select item;
var sourcesToIgnore = new List<tlvBranch>();
foreach (var group in groups)
{
//find and ignore spectra in group
getListOfSprectrumSourcesRecursively(group, ref sourcesToIgnore);
group.Parent.Children.Remove(group);
toRefresh.Add(group.Parent);
group.Parent = target;
if (target.Children.Any())
target.Children.Insert(0, group);
else
target.Children.Add(group);
}
sources = from tlvBranch s in sources where !sourcesToIgnore.Contains(s) select s;
foreach (var source in sources)
{
source.Parent.Children.Remove(source);
toRefresh.Add(source.Parent);
source.Parent = target;
if (index >= 0)
target.Children.Insert(index, source);
else
target.Children.Add(source);
}
toRefresh.Add(target);
tlvGroupedFiles.Expand(target);
}
foreach (var item in toRefresh)
tlvGroupedFiles.RefreshObject(item);
OrganizeNode(target);
}
示例3: dropSink_CanDrop
// Forward events from the drop sink to the control itself
private void dropSink_CanDrop(object sender, OlvDropEventArgs e)
{
OnCanDrop(e);
}
示例4: olvCraftList_Dropped
/// <summary>
/// Handles when external files are dropped into the list view
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void olvCraftList_Dropped(object sender, OlvDropEventArgs e)
{
if (!e.DragEventArgs.Data.GetDataPresent(DataFormats.FileDrop, false)) return;
// File system list of paths of files dropped into the list view
var files = ((string[])e.DragEventArgs.Data.GetData(DataFormats.FileDrop)).ToList();
_craftFileHandler.CopyNewCraftToSave(files, cbDefaultSave.Text);
UpdateList();
}
示例5: tlvGroupedFiles_CanDrop
private void tlvGroupedFiles_CanDrop(object sender, OlvDropEventArgs e)
{
if (e.DataObject.GetType().ToString() == "System.Windows.Forms.DataObject")
e.Effect = DragDropEffects.Move;
else if (e.DataObject is OLVDataObject && e.DropTargetItem != null
&& (e.DropTargetItem.RowObject is tlvBranch
&& ((e.DropTargetItem.RowObject as tlvBranch).Data is SpectrumSourceGroup
|| (e.DropTargetItem.RowObject as tlvBranch).Data is SpectrumSource)))
{
var target = e.DropTargetItem.RowObject as tlvBranch;
var dragging = (e.DataObject as OLVDataObject).ModelObjects;
var isValid = true;
foreach (var item in dragging)
{
if (checkIfDestGroupAChildNodeOfMe(target,item as tlvBranch))
{
isValid = false;
break;
}
}
if (isValid)
e.Effect = DragDropEffects.Move;
else
e.Effect = DragDropEffects.None;
}
else
e.Effect = DragDropEffects.None;
}
示例6: OnCanDrop
/// <summary>
///
/// </summary>
/// <param name="args"></param>
protected virtual void OnCanDrop(OlvDropEventArgs args) {
if (this.CanDrop != null)
this.CanDrop(this, args);
}
示例7: dropSink_CanDrop
// Forward events from the drop sink to the control itself
void dropSink_CanDrop(object sender, OlvDropEventArgs e)
{
this.OnCanDrop(e);
}
示例8: fdlvDetalle_Dropped
private void fdlvDetalle_Dropped(object sender, OlvDropEventArgs e)
{
e.Handled = true;
OLVDataObject o = e.DataObject as OLVDataObject;
if (o != null)
{
OLVListItem target = e.DropTargetItem;
bool targetModelo = false;
if (target != null)
{
DataRowView drv = (DataRowView)target.RowObject;
if (drv.Row["LIDO_ID"].ToString() == "N")
{
targetModelo = true;
}
}
foreach (var model in o.ModelObjects)
{
if (model is odts.PresupuestoVentaBloque)
{
bool permitir = true;
foreach (odts.PresupuestoVentaDetalle d in ((odts.PresupuestoVentaBloque)model).Detalle)
{
if (EsArticuloDuplicado(d.ArtiId1))
{
permitir = false;
break;
}
}
if (permitir)
{
// Copiar presupuesto
DataTable dt = (DataTable)this.fdlvDetalle.DataSource;
odts.PresupuestoVentaBloque bloque = (odts.PresupuestoVentaBloque)model;
foreach (odts.PresupuestoVentaDetalle d in ((odts.PresupuestoVentaBloque)model).Detalle)
{
DataRow dr = dt.NewRow();
dr["DOCU_ID"] = this.Documento;
dr["PEDID_ID"] = this.Numero;
dr["ESTDOC_ID"] = "N";
dr["LIDO_ID"] = d.TipoLinea;
dr["DOCU_ID_ORIGEN"] = bloque.DocuId;
dr["DOCU_NUMERO_ORIGEN"] = bloque.PresuvId;
dr["DOCU_LINEA_ORIGEN"] = d.Linea;
dr["DOCU_SUBLINEA_ORIGEN"] = d.Sublinea;
dr["PEDIDL_FLUJOC"] = "0";
dr["PEDIDL_FLUJOL"] = "0";
dr["PEDIDL_FECHAD_APLIC"] = string.Empty;
dr["PEDIDL_FECHAH_APLIC"] = string.Empty;
int linea = CalcularNuevaLinea();
dr["PEDIDL_LINEA"] = linea;
if (d.TipoLinea == "N")
dr["PEDIDL_SUBLINEA"] = 0;
else
dr["PEDIDL_SUBLINEA"] = d.Sublinea;
dr["PEDIDL_DESCRIPCION"] = d.DetalleDescripcion;
dr["PEDIDL_CANTIDAD"] = 1;
dr["UNID_ID"] = "UN";
dr["PEDIDL_PRECIO"] = d.Precio;
if (d.DescuentoId.HasValue)
dr["GRDE_ID"] = d.DescuentoId;
else
dr["GRDE_ID"] = DBNull.Value;
dr["COMP_ID"] = this._CompId;
dr["ARTI_ID1"] = d.ArtiId1;
dr["DEPA_ID"] = d.DepartamentoId;
dt.Rows.Add(dr);
if (d is odts.DetalleModelo)
{
foreach (odts.DetalleDeterminacion dd in (d as odts.DetalleModelo).Determinaciones)
{
DataRow drd = dt.NewRow();
drd["DOCU_ID"] = this.Documento;
drd["PEDID_ID"] = this.Numero;
drd["ESTDOC_ID"] = "N";
drd["DOCU_ID_ORIGEN"] = bloque.DocuId;
drd["DOCU_NUMERO_ORIGEN"] = bloque.PresuvId;
drd["DOCU_LINEA_ORIGEN"] = d.Linea;
drd["DOCU_SUBLINEA_ORIGEN"] = d.Sublinea;
drd["PEDIDL_FLUJOC"] = "0";
drd["PEDIDL_FLUJOL"] = "0";
drd["PEDIDL_FECHAD_APLIC"] = string.Empty;
drd["PEDIDL_FECHAH_APLIC"] = string.Empty;
drd["LIDO_ID"] = dd.TipoLinea;
drd["PEDIDL_LINEA"] = linea;
drd["PEDIDL_SUBLINEA"] = dd.Sublinea;
drd["PEDIDL_DESCRIPCION"] = dd.DetalleDescripcion;
drd["PEDIDL_CANTIDAD"] = 1;
drd["UNID_ID"] = "UN";
drd["PEDIDL_PRECIO"] = dd.Precio;
if (dd.DescuentoId.HasValue)
drd["GRDE_ID"] = dd.DescuentoId;
else
drd["GRDE_ID"] = DBNull.Value;
drd["COMP_ID"] = this._CompId;
drd["ARTI_ID1"] = dd.ArtiId1;
drd["DEPA_ID"] = dd.DepartamentoId;
//.........这里部分代码省略.........
示例9: OnCanDrop
protected override void OnCanDrop(OlvDropEventArgs args)
{
base.OnCanDrop(args);
_form.HostCanDrop(args);
}
示例10: treeListView1_CanDrop
private void treeListView1_CanDrop(object sender, OlvDropEventArgs e)
{
BrightIdeasSoftware.OLVDataObject data = e.DataObject as BrightIdeasSoftware.OLVDataObject;
FTPDirectory da = (FTPDirectory)data.ModelObjects[0];
e.Effect = DragDropEffects.Move;
//MessageBox.Show(da.Name);
}
示例11: treeListView1_Dropped
private void treeListView1_Dropped(object sender, OlvDropEventArgs e)
{
FTP par = (FTP)this.ParentForm;
FolderControl oppositeFolderControl;
if(this == par.folderControl1)
{
oppositeFolderControl = par.folderControl2;
}else{
oppositeFolderControl = par.folderControl1;
}
BrightIdeasSoftware.OLVDataObject data = e.DataObject as BrightIdeasSoftware.OLVDataObject;
FTPDirectory location = (FTPDirectory) e.DropTargetItem.RowObject;
string pathOfFile = null;
string pathToGo = null;
foreach (FTPDirectory ftp in (List<FTPDirectory>)data.ModelObjects.Cast<FTPDirectory>().ToList())
{
pathOfFile = ftp.Path;
pathToGo = (location).Path + "\\" + ftp.Name;
// MessageBox.Show(pathToGo);
if (IsRemote && !oppositeFolderControl.IsRemote) //Local Server to Remote Client
{
log.Text+=("\nStart transfer of " + ftp.Name+". From LOCAL to "+client.GetComputerName()+".");
pathToGo = pathToGo.Replace("\\", "\\\\");
if (Directory.Exists(pathOfFile))//if folder
{
//gotta check in this dir for other dirs
SendFolder(ftp, client, pathToGo, par);
}
else
{
Messaging.SendCommand("RemoteAcceptFTP(" + client.GetPort() + ",'" + pathToGo + "', " + new FileInfo(pathOfFile).Length + ");", client.GetClientSocket());
//Messaging.RemoteAcceptFTP(client.GetClientSocket(), pathToGo);
Messaging.FTPFile(pathOfFile, client.GetClientSocket());
log.Text += ("\nFile successfully sent.\n");
par.Refresh();
}
}
else if (IsRemote && oppositeFolderControl.IsRemote) //Client to client
{
if (ftp.IsFile)
{
log.Text += ("\nStart transfer of " + ftp.Name + ". From CLIENT to " + client.GetComputerName() + ".");
pathToGo = pathToGo.Replace("\\", "\\\\");
oppositeFolderControl.client.SendFileToOtherClient(pathOfFile, ftp.kbSize, pathToGo, client);
}
else
{
SendFolderToClient(ftp, pathOfFile, pathToGo, client, oppositeFolderControl);
log.Text += ftp.Name + " sent";
}
}
else //Client to Server
{
log.Text += ("\nStart transfer of " + ftp.Name + ". From " + client.GetComputerName() + " to LOCAL.");
//pathToGo = pathToGo.Replace("\\", "\\\\");
pathOfFile = pathOfFile.Replace("\\", "\\\\");
Messaging.SendCommand("RemoteSendFTP(" + client.GetPort() + ", '" + pathOfFile + "');", client.GetClientSocket());
//Messaging.RemoteSendFTP(client.GetClientSocket(), pathOfFile);
Messaging.LocalAcceptFTP(client.GetClientSocket(), pathToGo, ftp.kbSize);
log.Text += ("\nFile successfully sent.\n");
par.Refresh();
}
}
}
示例12: objectListView1_Dropped
private void objectListView1_Dropped(object sender, OlvDropEventArgs e)
{
Console.WriteLine("dropped");
updateModelList();
refreshContestantListView();
}
示例13: olv_Dropped
private void olv_Dropped(object sender, OlvDropEventArgs e)
{
string pathAndFilename = DragDropFile(e.DataObject);
if (!string.IsNullOrWhiteSpace(pathAndFilename))
{
string extension = Path.GetExtension(pathAndFilename);
if (string.IsNullOrEmpty(extension))
{
UntypedFileDropped(pathAndFilename);
}
else
{
TypedFileDropped(pathAndFilename, extension);
}
}
}
示例14: olv_CanDrop
private void olv_CanDrop(object sender, OlvDropEventArgs e)
{
e.Effect = DragDropEffects.All;
}
示例15: CalculateDropTarget
/// <summary>
/// When the mouse is at the given point, what should the target of the drop be?
/// </summary>
/// <remarks>This method should update the DropTarget* members of the given arg block</remarks>
/// <param name="pt">The mouse point, in client co-ordinates</param>
protected virtual void CalculateDropTarget(OlvDropEventArgs args, Point pt)
{
const int SMALL_VALUE = 3;
DropTargetLocation location = DropTargetLocation.None;
int targetIndex = -1;
int targetSubIndex = 0;
if (this.CanDropOnBackground)
location = DropTargetLocation.Background;
// Which item is the mouse over?
// If it is not over any item, it's over the background.
ListViewHitTestInfo info = this.ListView.HitTest(pt.X, pt.Y);
if (info.Item != null && this.CanDropOnItem) {
location = DropTargetLocation.Item;
targetIndex = info.Item.Index;
if (info.SubItem != null && this.CanDropOnSubItem)
targetSubIndex = info.Item.SubItems.IndexOf(info.SubItem);
}
// Check to see if the mouse is "between" rows.
// ("between" is somewhat loosely defined)
if (this.CanDropBetween && this.ListView.GetItemCount() > 0) {
// If the mouse is over an item, check to see if it is near the top or bottom
if (location == DropTargetLocation.Item) {
if (pt.Y - SMALL_VALUE <= info.Item.Bounds.Top)
location = DropTargetLocation.AboveItem;
if (pt.Y + SMALL_VALUE >= info.Item.Bounds.Bottom)
location = DropTargetLocation.BelowItem;
} else {
// Is there an item a little below the mouse?
// If so, we say the drop point is above that row
info = this.ListView.HitTest(pt.X, pt.Y + SMALL_VALUE);
if (info.Item != null) {
targetIndex = info.Item.Index;
location = DropTargetLocation.AboveItem;
} else {
// Is there an item a little above the mouse?
info = this.ListView.HitTest(pt.X, pt.Y - SMALL_VALUE);
if (info.Item != null) {
targetIndex = info.Item.Index;
location = DropTargetLocation.BelowItem;
}
}
}
}
args.DropTargetLocation = location;
args.DropTargetIndex = targetIndex;
args.DropTargetSubItemIndex = targetSubIndex;
}