Ejemplo n.º 1
0
 protected virtual void OnItemKeyEnterPressed(FolderViewItemEventArgs e)
 {
     if (_itemKeyEnterPressed != null)
     {
         _itemKeyEnterPressed.Invoke(this, e);
     }
 }
Ejemplo n.º 2
0
 protected virtual void OnItemDoubleClick(FolderViewItemEventArgs e)
 {
     if (_itemDoubleClick != null)
     {
         _itemDoubleClick.Invoke(this, e);
     }
 }
Ejemplo n.º 3
0
            protected override void OnKeyDown(KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter)
                {
                    if (this.SelectedItems != null && this.SelectedItems.Count > 0)
                    {
                        try
                        {
                            FolderListViewItem item = (FolderListViewItem)this.FocusedItem;
                            if (item != null)
                            {
                                var pidl = item.Pidl.Clone();
                                try
                                {
                                    if (DereferenceLinks && pidl.IsLink)
                                    {
                                        // attempt to resolve links first if necessary
                                        string resolvedPath;
                                        Pidl   resolvedPidl;
                                        if (ShellItem.TryResolveLink(Handle, pidl.Path, out resolvedPath) && Pidl.TryParse(resolvedPath, out resolvedPidl))
                                        {
                                            pidl.Dispose();
                                            pidl = resolvedPidl;
                                        }
                                    }

                                    var handled = false;

                                    var control = Parent as FolderView;
                                    if (control != null)
                                    {
                                        var args = new FolderViewItemEventArgs(new FolderViewItem(pidl));
                                        control.OnItemKeyEnterPressed(args);
                                        handled = args.Handled;
                                    }

                                    if (AutoDrillDown && pidl.IsFolder && !handled)
                                    {
                                        // if the user pressed ENTER on a folder item, perform a drill down
                                        Browse(new ShellItem(pidl, _rootShellItem, false));
                                    }
                                }
                                finally
                                {
                                    pidl.Dispose();
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            HandleBrowseException(ex);
                        }
                    }

                    e.Handled          = true;
                    e.SuppressKeyPress = true;
                }
                base.OnKeyDown(e);
            }
Ejemplo n.º 4
0
            protected override void OnDoubleClick(EventArgs e)
            {
                if (this.SelectedItems != null && this.SelectedItems.Count > 0)
                {
                    try
                    {
                        Point point             = this.PointToClient(Cursor.Position);
                        FolderListViewItem item = (FolderListViewItem)this.GetItemAt(point.X, point.Y);
                        if (item != null)
                        {
                            var pidl = item.Pidl.Clone();
                            try
                            {
                                if (DereferenceLinks && pidl.IsLink)
                                {
                                    // attempt to resolve links first if necessary
                                    string resolvedPath;
                                    Pidl   resolvedPidl;
                                    if (ShellItem.TryResolveLink(Handle, pidl.Path, out resolvedPath) && Pidl.TryParse(resolvedPath, out resolvedPidl))
                                    {
                                        pidl.Dispose();
                                        pidl = resolvedPidl;
                                    }
                                }

                                var handled = false;

                                var control = Parent as FolderView;
                                if (control != null)
                                {
                                    var args = new FolderViewItemEventArgs(new FolderViewItem(pidl));
                                    control.OnItemDoubleClick(args);
                                    handled = args.Handled;
                                }

                                if (AutoDrillDown && pidl.IsFolder && !handled)
                                {
                                    // if the user double clicked on a folder item, perform a drill down
                                    Browse(new ShellItem(pidl, _rootShellItem, false));
                                }
                            }
                            finally
                            {
                                pidl.Dispose();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        HandleBrowseException(ex);
                    }
                }
                base.OnDoubleClick(e);
            }
Ejemplo n.º 5
0
			protected override void OnKeyDown(KeyEventArgs e)
			{
				if (e.KeyCode == Keys.Enter)
				{
					if (this.SelectedItems != null && this.SelectedItems.Count > 0)
					{
						try
						{
							FolderListViewItem item = (FolderListViewItem) this.FocusedItem;
							if (item != null)
							{
								var pidl = item.Pidl.Clone();
								try
								{
									if (DereferenceLinks && pidl.IsLink)
									{
										// attempt to resolve links first if necessary
										string resolvedPath;
										Pidl resolvedPidl;
										if (ShellItem.TryResolveLink(Handle, pidl.Path, out resolvedPath) && Pidl.TryParse(resolvedPath, out resolvedPidl))
										{
											pidl.Dispose();
											pidl = resolvedPidl;
										}
									}

									var handled = false;

									var control = Parent as FolderView;
									if (control != null)
									{
										var args = new FolderViewItemEventArgs(new FolderViewItem(pidl));
										control.OnItemKeyEnterPressed(args);
										handled = args.Handled;
									}

									if (AutoDrillDown && pidl.IsFolder && !handled)
									{
										// if the user pressed ENTER on a folder item, perform a drill down
										Browse(new ShellItem(pidl, _rootShellItem, false));
									}
								}
								finally
								{
									pidl.Dispose();
								}
							}
						}
						catch (Exception ex)
						{
							HandleBrowseException(ex);
						}
					}

					e.Handled = true;
					e.SuppressKeyPress = true;
				}
				base.OnKeyDown(e);
			}
Ejemplo n.º 6
0
			protected override void OnDoubleClick(EventArgs e)
			{
				if (this.SelectedItems != null && this.SelectedItems.Count > 0)
				{
					try
					{
						Point point = this.PointToClient(Cursor.Position);
						FolderListViewItem item = (FolderListViewItem) this.GetItemAt(point.X, point.Y);
						if (item != null)
						{
							var pidl = item.Pidl.Clone();
							try
							{
								if (DereferenceLinks && pidl.IsLink)
								{
									// attempt to resolve links first if necessary
									string resolvedPath;
									Pidl resolvedPidl;
									if (ShellItem.TryResolveLink(Handle, pidl.Path, out resolvedPath) && Pidl.TryParse(resolvedPath, out resolvedPidl))
									{
										pidl.Dispose();
										pidl = resolvedPidl;
									}
								}

								var handled = false;

								var control = Parent as FolderView;
								if (control != null)
								{
									var args = new FolderViewItemEventArgs(new FolderViewItem(pidl));
									control.OnItemDoubleClick(args);
									handled = args.Handled;
								}

								if (AutoDrillDown && pidl.IsFolder && !handled)
								{
									// if the user double clicked on a folder item, perform a drill down
									Browse(new ShellItem(pidl, _rootShellItem, false));
								}
							}
							finally
							{
								pidl.Dispose();
							}
						}
					}
					catch (Exception ex)
					{
						HandleBrowseException(ex);
					}
				}
				base.OnDoubleClick(e);
			}
Ejemplo n.º 7
0
		protected virtual void OnItemKeyEnterPressed(FolderViewItemEventArgs e)
		{
			if (_itemKeyEnterPressed != null)
				_itemKeyEnterPressed.Invoke(this, e);
		}
Ejemplo n.º 8
0
		protected virtual void OnItemDoubleClick(FolderViewItemEventArgs e)
		{
			if (_itemDoubleClick != null)
				_itemDoubleClick.Invoke(this, e);
		}