当前位置: 首页>>代码示例>>C#>>正文


C# DataObject.GetFileDropList方法代码示例

本文整理汇总了C#中System.Windows.DataObject.GetFileDropList方法的典型用法代码示例。如果您正苦于以下问题:C# DataObject.GetFileDropList方法的具体用法?C# DataObject.GetFileDropList怎么用?C# DataObject.GetFileDropList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.DataObject的用法示例。


在下文中一共展示了DataObject.GetFileDropList方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandlePreviewDropCommand

        private void HandlePreviewDropCommand(DataObject droppedObject)
        {
            if (!droppedObject.ContainsFileDropList()) return;

            foreach (var filePath in droppedObject.GetFileDropList())
            {
                LocalPhotos.Add(new SinglePhotoFlickrMatchesViewModel(filePath, _flickrModel));
            }
        }
开发者ID:simm0n,项目名称:Synchronizr,代码行数:9,代码来源:MainWindowViewModel.cs

示例2: GetImageFilename

        private static string GetImageFilename(DragDropInfo info)
        {
            DataObject data = new DataObject(info.Data);

            if (info.Data.GetDataPresent("FileDrop"))
            {
                // The drag and drop operation came from the file system
                StringCollection files = data.GetFileDropList();

                if (files != null && files.Count == 1)
                    return files[0];
            }
            else if (info.Data.GetDataPresent("CF_VSSTGPROJECTITEMS"))
            {
                return data.GetText(); // The drag and drop operation came from the VS solution explorer
            }
            else if (info.Data.GetDataPresent("MultiURL"))
            {
                return data.GetText();
            }

            return null;
        }
开发者ID:yannduran,项目名称:CommandTaskRunner,代码行数:23,代码来源:CommandDropHandler.cs

示例3: GetFilename

        /// <summary>
        /// Get the dropped filename
        /// </summary>
        /// <param name="Info"></param>
        /// <returns></returns>
        private static string GetFilename(DragDropInfo Info)
        {
            DataObject Data = new DataObject(Info.Data);

            if (Info.Data.GetDataPresent(DragDropHandlerProvider.FileDropDataFormat))
            {
                // The drag and drop operation came from the file system
                StringCollection Files = Data.GetFileDropList();

                if (Files != null && Files.Count == 1)
                {
                    return Files[0];
                }
            }
            else if (Info.Data.GetDataPresent(DragDropHandlerProvider.VSProjectStorageItemDataFormat))
            {
                // The drag and drop operation came from the VS solution explorer as a storage item
                return Data.GetText();
            }
            else if (Info.Data.GetDataPresent(DragDropHandlerProvider.VSProjectReferenceItemDataFormat))
            {
                // The drag and drop operation came from the VS solution explorer as a reference item have to
                // get the selected item from the solution explorer
                DTE2 dte = Package.GetGlobalService(typeof(DTE)) as DTE2;

                UIHierarchy solutionExplorer = dte.ToolWindows.SolutionExplorer;

                var SolutionExplorerSeclectedItems = solutionExplorer.SelectedItems as System.Array;

                if (SolutionExplorerSeclectedItems != null && SolutionExplorerSeclectedItems.Length == 1)
                {
                    foreach (UIHierarchyItem SolutionExplorerSelectedItem in SolutionExplorerSeclectedItems)
                    {
                        ProjectItem SolutionExplorerSelectedObject = SolutionExplorerSelectedItem.Object as ProjectItem;

                        return SolutionExplorerSelectedObject.Properties.Item("FullPath").Value.ToString();
                    }

                }
            }

            return null;
        }
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:48,代码来源:DragDropHandler.cs

示例4: GetImageFilename

        private static string GetImageFilename(DragDropInfo info)
        {
            DataObject data = new DataObject(info.Data);

            if (info.Data.GetDataPresent(ImageInsertionDropHandlerProvider.FileDropDataFormat))
            {
                // The drag and drop operation came from the file system
                StringCollection files = data.GetFileDropList();

                if (files != null && files.Count == 1)
                {
                    return files[0];
                }
            }
            else if (info.Data.GetDataPresent(ImageInsertionDropHandlerProvider.VSProjectItemDataFormat))
            {
                // The drag and drop operation came from the VS solution explorer
                return data.GetText();
            }

            return null;
        }
开发者ID:dangilkerson,项目名称:ApprovalTestsVS2010,代码行数:22,代码来源:ImageInsertionDropHandler.cs

示例5: ClipboardReceived

        private void ClipboardReceived(object sender, RunWorkerCompletedEventArgs eventArgs)
        {
            if (!eventArgs.Cancelled && eventArgs.Error == null)
            {
                ArrayList data = (ArrayList)eventArgs.Result;
                if (data != null)
                {
                    DataObject dataObj = new DataObject();
                    Console.WriteLine("Count: " + data.Count);
                    for (int i = 0; i < data.Count; i++)
                    {
                        string format = (string)data[i++];
                        Console.WriteLine(format);
                        dataObj.SetData(format, data[i]);
                    }

                    if (dataObj.ContainsFileDropList())
                    {
                        StringCollection files = dataObj.GetFileDropList();
                        dataObj = new DataObject();
                        StringCollection adjusted = new StringCollection();
                        foreach (string f in files)
                        {
                            if (!f.StartsWith("\\"))
                            {
                                string toadd = "\\\\" + Ip + "\\" + f.Replace(":", "");
                                Console.WriteLine(toadd);
                                adjusted.Add(toadd);
                            }
                            else
                            {
                                adjusted.Add(f);
                            }
                        }
                        dataObj.SetFileDropList(adjusted);
                    }
                    Clipboard.SetDataObject(dataObj);

                }
            }
        }
开发者ID:fabriziogueli,项目名称:Mouse-Keyboard-Remote-Control-Client,代码行数:41,代码来源:Server.cs

示例6: SetClipboard

        public void SetClipboard(string Ip, Object obj)
        {
            try
            {
                ArrayList data = (ArrayList)obj;
                if (data != null)
                {
                    DataObject dataObj = new DataObject();
                    Console.WriteLine("Count: " + data.Count);
                    for (int i = 0; i < data.Count; i++)
                    {
                        string format = (string)data[i++];
                        Console.WriteLine(format);
                        dataObj.SetData(format, data[i]);
                    }
                    if (dataObj.ContainsFileDropList())
                    {
                        StringCollection files = dataObj.GetFileDropList();
                        dataObj = new DataObject();
                        StringCollection adjusted = new StringCollection();
                        foreach (string f in files)
                        {
                            if (!f.StartsWith("\\"))
                            {
                                string toadd = "\\\\" + Ip + "\\" + f.Replace(":", "");
                                Console.WriteLine(toadd);
                                adjusted.Add(toadd);
                            }
                            else
                            {
                                adjusted.Add(f);
                            }
                        }
                        dataObj.SetFileDropList(adjusted);
                    }
                    Clipboard.SetDataObject(dataObj);

                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
开发者ID:alessioscicolone,项目名称:Mouse-Keyboard-Remote-Control-Server,代码行数:44,代码来源:MyClipBoard.cs


注:本文中的System.Windows.DataObject.GetFileDropList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。