/// <summary>
        /// Adds the copies of the given elements to a data object and adds it to the clipboard.
        /// </summary>
        /// <param name="modelElements">Elements to move.</param>
        public static void ExecuteCut(Collection<ModelElement> modelElements)
        {
            System.Windows.IDataObject dataObject = new System.Windows.DataObject();
            ModelElementOperations.CopyToMove(modelElements, dataObject);

            System.Windows.Clipboard.SetDataObject(dataObject, true);
        }
Example #2
0
        /// <summary>
        /// Allow manifest to be exported by drag and drop.
        /// </summary>
        public override void DragStart()
        {
            // get selected manifests
            List <Manifest> selectedManifests = new List <SalesForceData.Manifest>();

            foreach (INode node in App.Instance.Navigation.SelectedNodes)
            {
                if (node is ManifestNode)
                {
                    selectedManifests.Add((node as ManifestNode).Manifest);
                }
                else
                {
                    selectedManifests = null;
                    break;
                }
            }

            // start drag operation with selected manifests
            if (selectedManifests != null)
            {
                List <string> fileNames = new List <string>();
                foreach (Manifest manifest in selectedManifests)
                {
                    fileNames.Add(manifest.FileName);
                }

                System.Windows.DataObject dataObject = new System.Windows.DataObject();
                dataObject.SetData(System.Windows.DataFormats.FileDrop, fileNames.ToArray());
                dataObject.SetData("SalesForceData.Manifest[]", selectedManifests.ToArray());

                Presenter.DoDragDrop(dataObject, System.Windows.DragDropEffects.Copy);
            }
        }
        /// <summary>
        /// Adds the copies of the given elements to a data object and adds it to the clipboard.
        /// </summary>
        /// <param name="modelElements">Elements to move.</param>
        public static void ExecuteCut(Collection <ModelElement> modelElements)
        {
            System.Windows.IDataObject dataObject = new System.Windows.DataObject();
            ModelElementOperations.CopyToMove(modelElements, dataObject);

            System.Windows.Clipboard.SetDataObject(dataObject, true);
        }
        /// <summary>DropInfoをファイルパスのリストに変換する</summary>
        /// <param name="dropInfo">変換元ファイル</param>
        /// <param name="filePathList">変換後のファイルパス(絶対パス)リスト</param>
        /// <returns>true:成功, false:失敗/異常</returns>
        private bool ConvertDropInfoToPathList(IDropInfo dropInfo, out List <string> filePathList)
        {
            filePathList = new List <string>();

            if (dropInfo == null)
            {
                Logger.Fatal(CLASS_NAME, "ConvertDropInfoToPathList", "dropInfo is null!");
                return(false);
            }

            System.Windows.DataObject dragOverFiles = (System.Windows.DataObject)dropInfo.Data;
            if (dragOverFiles == null)
            {
                Logger.Fatal(CLASS_NAME, "ConvertDropInfoToPathList", "dragOverFiles are null!");
                return(false);
            }

            System.Collections.Specialized.StringCollection dragOverFileList = dragOverFiles.GetFileDropList();
            if (dragOverFileList == null || dragOverFileList.Count < 1)
            {
                Logger.Fatal(CLASS_NAME, "ConvertDropInfoToPathList", "dragOverFileList is invalid!");
                return(false);
            }

            filePathList = dragOverFileList.Cast <string>().ToList();
            if (filePathList == null || filePathList.Any() == false)
            {
                Logger.Fatal(CLASS_NAME, "ConvertDropInfoToPathList", "filePathList is invalid!");
                return(false);
            }

            return(true);
        }
Example #5
0
        public static void SetRtf(string text_rtf)
        {
            // Also convert the RTF to normal text
            using (RichTextBox rich_text_box = new RichTextBox())
            {
                rich_text_box.Rtf = text_rtf;
                string text_plain = rich_text_box.Text;

                DataObject data = new DataObject();
                data.SetData(DataFormats.Rtf, text_rtf);
                data.SetData(DataFormats.Text, text_plain);

                for (int i = 0; i < 3; ++i)
                {
                    try
                    {
                        // Try set the text - and if we succeed, exit
                        Clipboard.Clear();
                        Clipboard.SetDataObject(data, true);
                        return;
                    }
                    catch (Exception ex)
                    {
                        Logging.Warn(ex, "There was a problem setting the clipboard text, so trying again.");
                        Thread.Sleep(250);
                    }
                }

                // If we get here, try one last time!
                Clipboard.Clear();
                Clipboard.SetDataObject(data, true);
            }
        }
Example #6
0
 /// <summary>Wraps an Exsisting instance of an object</summary>
 /// <param name="o">Instance of the object to wrap</param>
 public static Microsoft.Test.Security.Wrappers.DataObjectSW Wrap(System.Windows.DataObject o)
 {
     if (o == null)
     {
         return(null);
     }
     return(new Microsoft.Test.Security.Wrappers.DataObjectSW(o));
 }
        protected override void Work()
        {
            var obj = new System.Windows.DataObject(
                _format,
                _data
                );

            System.Windows.Clipboard.SetDataObject(obj, true);
        }
        protected override void Work()
        {
            var obj = new System.Windows.DataObject(
                _format,
                _data
            );

            System.Windows.Clipboard.SetDataObject(obj, true);
        }
Example #9
0
            public int OleDrop(object pDataObj, int grfKeyState, long pt, ref int pdwEffect)
            {
                Trace.WriteLine("OleDrop");
                System.Windows.DataObject data = new System.Windows.DataObject(pDataObj);

                OnDragDrop(data);
                Marshal.FinalReleaseComObject(pDataObj);
                return(0);
            }
Example #10
0
        public void CopyToClipboard(string data)
        {
            System.Windows.DataObject dataObject = new System.Windows.DataObject();

            // put textual data
            dataObject.SetText(data, System.Windows.TextDataFormat.UnicodeText);
            dataObject.SetText(data, System.Windows.TextDataFormat.Text);

            System.Windows.Clipboard.SetDataObject(dataObject, false);
        }
Example #11
0
        public static void SetSearchInfos(IEnumerable <SearchInfo> items)
        {
            lock (_thisLock)
            {
                var dataObject = new System.Windows.DataObject();
                dataObject.SetData("Amoeba_SearchInfos", Clipboard.ToStream(items));

                System.Windows.Clipboard.SetDataObject(dataObject);
            }
        }
Example #12
0
        public static void SetStoreCategorizeTreeItems(IEnumerable <Windows.StoreCategorizeTreeItem> items)
        {
            lock (_thisLock)
            {
                var dataObject = new System.Windows.DataObject();
                dataObject.SetData("Amoeba_StoreCategorizeTreeItems", Clipboard.ToStream(items));

                System.Windows.Clipboard.SetDataObject(dataObject);
            }
        }
        /// <summary>
        /// Adds the copies of the given elements to a data object and adds it to the clipboard.
        /// </summary>
        /// <param name="modelElements">Elements to move.</param>
        public static void ExecuteCut(Collection<ModelElement> modelElements)
        {
            // move domain classes to the top of the list
            Collection<ModelElement> sortedME = MoveDomainClassesToTop(modelElements);

            System.Windows.IDataObject dataObject = new System.Windows.DataObject();
            ModelElementOperations.CopyToMove(sortedME, dataObject);

            System.Windows.Clipboard.SetDataObject(dataObject, true);
        }
Example #14
0
        public static void SetBoxes(IEnumerable <Box> boxes)
        {
            lock (_thisLock)
            {
                var dataObject = new System.Windows.DataObject();
                dataObject.SetData("Amoeba_Boxes", Clipboard.ToStream(boxes));

                System.Windows.Clipboard.SetDataObject(dataObject);
            }
        }
Example #15
0
        public void CopyToClipboard(string data)
        {
            System.Windows.DataObject dataObject = new System.Windows.DataObject();

            // put textual data
            dataObject.SetText(data, System.Windows.TextDataFormat.UnicodeText);
            dataObject.SetText(data, System.Windows.TextDataFormat.Text);

            System.Windows.Clipboard.SetDataObject(dataObject, false);
        }
        /// <summary>
        /// Adds the copies of the given elements to a data object and adds it to the clipboard.
        /// </summary>
        /// <param name="modelElements">Elements to move.</param>
        public static void ExecuteCut(Collection <ModelElement> modelElements)
        {
            // move domain classes to the top of the list
            Collection <ModelElement> sortedME = MoveDomainClassesToTop(modelElements);

            System.Windows.IDataObject dataObject = new System.Windows.DataObject();
            ModelElementOperations.CopyToMove(sortedME, dataObject);

            System.Windows.Clipboard.SetDataObject(dataObject, true);
        }
Example #17
0
        public static void SetStoreSignatureInfos(IEnumerable <StoreSignatureInfo> items)
        {
            lock (_thisLock)
            {
                var dataObject = new System.Windows.DataObject();
                dataObject.SetText(string.Join(Environment.NewLine, items.Select(n => n.AuthorSignature.ToString())));
                dataObject.SetData("Amoeba_StoreSignatureInfos", Clipboard.ToStream(items));

                System.Windows.Clipboard.SetDataObject(dataObject);
            }
        }
Example #18
0
        public static void SetStoreTreeItems(IEnumerable <Windows.StoreTreeItem> items)
        {
            lock (_thisLock)
            {
                var dataObject = new System.Windows.DataObject();
                dataObject.SetText(string.Join("\r\n", items.Select(n => n.Signature)));
                dataObject.SetData("Amoeba_StoreTreeItems", Clipboard.ToStream(items));

                System.Windows.Clipboard.SetDataObject(dataObject);
            }
        }
Example #19
0
        public static void SetBoxAndSeeds(IEnumerable <Box> boxes, IEnumerable <Seed> seeds)
        {
            lock (_thisLock)
            {
                var dataObject = new System.Windows.DataObject();
                dataObject.SetText(string.Join("\r\n", seeds.Select(n => AmoebaConverter.ToSeedString(n))));
                dataObject.SetData("Amoeba_Boxes", Clipboard.ToStream(boxes));

                System.Windows.Clipboard.SetDataObject(dataObject);
            }
        }
Example #20
0
        protected override object StartItemDrag(SideTabItem draggedItem)
        {
            if (this.ActiveTab.ChoosedItem != draggedItem && this.ActiveTab.Items.Contains(draggedItem))
            {
                this.ActiveTab.ChoosedItem = draggedItem;
            }
            var dataObject = new System.Windows.DataObject();

            dataObject.SetText(draggedItem.Tag.ToString());
            return(dataObject);
        }
Example #21
0
        public static void SetStoreCategoryInfosAndStoreSignatureInfos(IEnumerable <StoreCategoryInfo> categoryInfos, IEnumerable <StoreSignatureInfo> signatureInfo)
        {
            lock (_thisLock)
            {
                var dataObject = new System.Windows.DataObject();
                dataObject.SetData("Amoeba_StoreCategoryInfos", Clipboard.ToStream(categoryInfos));
                dataObject.SetData("Amoeba_StoreSignatureInfos", Clipboard.ToStream(signatureInfo));

                System.Windows.Clipboard.SetDataObject(dataObject);
            }
        }
Example #22
0
        public static void SetChatThreadInfos(IEnumerable <ChatThreadInfo> items)
        {
            lock (_thisLock)
            {
                var dataObject = new System.Windows.DataObject();
                dataObject.SetText(string.Join(Environment.NewLine, items.Select(n => AmoebaConverter.ToTagString(n.Tag))));
                dataObject.SetData("Amoeba_ChatThreadInfos", Clipboard.ToStream(items));

                System.Windows.Clipboard.SetDataObject(dataObject);
            }
        }
Example #23
0
        public static void SetChatTreeItems(IEnumerable <Windows.ChatTreeItem> items)
        {
            lock (_thisLock)
            {
                var dataObject = new System.Windows.DataObject();
                dataObject.SetText(string.Join("\r\n", items.Select(n => AmoebaConverter.ToTagString(n.Tag))));
                dataObject.SetData("Amoeba_ChatTreeItems", Clipboard.ToStream(items));

                System.Windows.Clipboard.SetDataObject(dataObject);
            }
        }
Example #24
0
        public static void SetUploadCategoryInfosAndUploadDirectoryInfos(IEnumerable <UploadCategoryInfo> categoryInfos, IEnumerable <UploadDirectoryInfo> directoryInfos)
        {
            lock (_thisLock)
            {
                var dataObject = new System.Windows.DataObject();
                dataObject.SetData("Amoeba_UploadCategoryInfos", Clipboard.ToStream(categoryInfos));
                dataObject.SetData("Amoeba_UploadDirectoryInfos", Clipboard.ToStream(directoryInfos));

                System.Windows.Clipboard.SetDataObject(dataObject);
            }
        }
Example #25
0
        public static void CopyContentsToClipboard(this WinForms.DataGridView dataGrid)
        {
            // Prepare copy string builder
            StringBuilder csvBuilder = new StringBuilder(dataGrid.RowCount * 100 + 100);

            // Build header string
            bool isFirst = true;

            foreach (WinForms.DataGridViewColumn actColumn in dataGrid.Columns)
            {
                if (!isFirst)
                {
                    csvBuilder.Append(';');
                }
                isFirst = false;

                csvBuilder.Append(actColumn.HeaderText);
            }
            csvBuilder.Append(Environment.NewLine);

            // Build strings for all lines
            for (int actRowID = 0; actRowID < dataGrid.Rows.Count; actRowID++)
            {
                for (int actColumnID = 0; actColumnID < dataGrid.Columns.Count; actColumnID++)
                {
                    if (actColumnID > 0)
                    {
                        csvBuilder.Append(';');
                    }

                    object actValue = dataGrid[actColumnID, actRowID].Value;
                    csvBuilder.Append(actValue != null ? actValue.ToString() : string.Empty);
                }
                csvBuilder.Append(Environment.NewLine);
            }

            // Add text to the clipboard
            //  Here we do specialized conversion for excel compatibility
            //  see http://stackoverflow.com/questions/329918/how-to-paste-csv-data-to-windows-clipboard-with-c-sharp
            System.Windows.DataObject dataObject = new System.Windows.DataObject();

            // Convert the CSV text to a UTF-8 byte stream before adding it to the container object.
            var bytes  = System.Text.Encoding.UTF8.GetBytes(csvBuilder.ToString());
            var stream = new System.IO.MemoryStream(bytes);

            dataObject.SetData(System.Windows.DataFormats.CommaSeparatedValue, stream);

            // Copy the container object to the clipboard.
            System.Windows.Clipboard.SetDataObject(dataObject, true);
        }
Example #26
0
        /// <summary>
        /// Sets managed data to a clipboard DataObject.
        /// </summary>
        /// <param name="dataObject">The DataObject to set the data on.</param>
        /// <param name="format">The clipboard format.</param>
        /// <param name="data">The data object.</param>
        /// <remarks>
        /// Because the underlying data store is not storing managed objects, but
        /// unmanaged ones, this function provides intelligent conversion, allowing
        /// you to set unmanaged data into the COM implemented IDataObject.</remarks>
        public void SetDataEx(string format, object data)
        {
            System.Windows.DataFormat dataFormat = System.Windows.DataFormats.GetDataFormat(format);

            // Initialize the format structure
            FORMATETC formatETC = new FORMATETC
            {
                cfFormat = (short)dataFormat.Id,
                dwAspect = DVASPECT.DVASPECT_CONTENT,
                lindex   = -1,
                ptd      = IntPtr.Zero
            };

            // Try to discover the TYMED from the format and data
            TYMED tymed = GetCompatibleTymed(format, data);

            // If a TYMED was found, we can use the system DataObject
            // to convert our value for us.
            if (tymed != TYMED.TYMED_NULL)
            {
                formatETC.tymed = tymed;

                // Set data on an empty DataObject instance
                System.Windows.DataObject conv = new System.Windows.DataObject();
                conv.SetData(format, data, true);

                // Now retrieve the data, using the COM interface.
                // This will perform a managed to unmanaged conversion for us.
                ((IDataObject)conv).GetData(ref formatETC, out STGMEDIUM medium);
                try
                {
                    // Now set the data on our data object
                    SetData(ref formatETC, ref medium, true);
                }
                catch
                {
                    // On exceptions, release the medium
                    ReleaseStgMedium(ref medium);
                    throw;
                }
            }
            else
            {
                // Since we couldn't determine a TYMED, this data
                // is likely custom managed data, and won't be used
                // by unmanaged code, so we'll use our custom marshaling
                // implemented by our COM IDataObject extensions.
                SetManagedData(format, data);
            }
        }
Example #27
0
 public void CopyNode()
 {
     if (_CurrentNode == Nodes.Table)
     {
         _ClipboardTable = _CurrentTreeViewItem.Tag as Table;
         //_ClipboardTable = table;
         System.Windows.DataObject dataobj = new System.Windows.DataObject(typeof(Table), _ClipboardTable);
         Clipboard.SetDataObject(dataobj);
     }
     else if (_CurrentNode == Nodes.Col)
     {
         _ClipboardCol = _CurrentTreeViewItem.Tag as Col;
         //_ClipboardCol = col;
         System.Windows.DataObject dataobj = new System.Windows.DataObject(typeof(Col), _ClipboardCol);
         Clipboard.SetDataObject(dataobj);
     }
 }
Example #28
0
        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------
        #region Internal Methods
        /// <summary>
        /// Invokes the "People Picker" dialog and returns a list of strings
        /// representing the email address of the users and groups selected therein.
        /// </summary>   
        /// <param name="hWndParent">The parent window for this dialog.  If null, window will
        /// be shown non-modally.</param>
        internal String[] Show(IntPtr hWndParent)
        {
            ValidateHWnd(hWndParent);

            IDataObject data = OpenQueryWindow(hWndParent);

            //If the data returned from OpenQueryWindow is null,
            //it means no data was entered in the dialog so we will
            //return null.  Otherwise we need to extract the data
            //from the returned IDataObject object.
            if (data != null)
            {                
                //Get a MemoryStream that contains the data contained in the
                //IDataObject (which is a raw form of a DsObjects struct).
                System.Windows.DataObject dataObject = new System.Windows.DataObject(data);
                System.IO.MemoryStream dsObjectStream =
                    dataObject.GetData(
                        UnsafeNativeMethods.CFSTR_DSOBJECTNAMES) as System.IO.MemoryStream;
                
                //Extract the data from that memory stream.  These will come back as
                //ActiveDirectory paths in the form 'LDAP://CN=...'                

                String[] ldapPaths = Array.Empty<String>();
               
                //Get a wrapper for the DsObjectNames object our pointer points to.
                DsObjectNamesWrapper dsObjects = new DsObjectNamesWrapper(dsObjectStream);               

                try
                {
                    //Get the names from the DsObjectNamesWrapper (these are AD paths)
                    ldapPaths = dsObjects.Names;
                }
                finally
                {
                    dsObjects.Dispose();
                    dsObjectStream.Close();    
                }

                //Get a set of e-mail addresses from the paths using AD and return them.
                return GetEmailAddressesFromPaths(ldapPaths);               
            }
            else
            {
                return Array.Empty<String>();
            }
        }
Example #29
0
        public void CopyFromTable(IList <CompleteRow> completeRows)
        {
            var str = new StringBuilder();

            foreach (var completeRow in completeRows)
            {
                str.AppendLine(
                    completeRow.Description + '\t' +
                    completeRow.RectCoord.X.ToString() + '\t' +
                    completeRow.RectCoord.Y.ToString() + '\t' +
                    completeRow.GeoCoord.Lat.ToString() + '\t' +
                    completeRow.GeoCoord.Lon.ToString());
            }
            var dataObject = new System.Windows.DataObject();

            dataObject.SetText(str.ToString());
            System.Windows.Clipboard.SetDataObject(dataObject, true);
        }
Example #30
0
            public void OnDragDrop(System.Windows.DataObject d)
            {
                Trace.WriteLine("OnDragDrop");

                var formats = d.GetFormats();

                foreach (var format in formats)
                {
                    Trace.WriteLine(format);
                }

                var obj  = d;
                var data = obj.GetData("RenPrivateMessages");

                if (data is MemoryStream)
                {
                    BinaryReader reader         = new BinaryReader(data as MemoryStream);
                    int          folderIdLength = reader.ReadInt32();
                }
            }
Example #31
0
        public static void SetBoxAndSeeds(IEnumerable <Box> boxes, IEnumerable <Seed> seeds)
        {
            lock (_thisLock)
            {
                System.Windows.DataObject dataObject = new System.Windows.DataObject();

                {
                    var sb = new StringBuilder();

                    foreach (var item in seeds)
                    {
                        sb.AppendLine(AmoebaConverter.ToSeedString(item));
                    }

                    dataObject.SetText(sb.ToString());
                }

                dataObject.SetData("Amoeba_Boxes", Clipboard.ToStream(boxes));

                System.Windows.Clipboard.SetDataObject(dataObject);
            }
        }
Example #32
0
        public System.Windows.DataObject GetData(string SelectedType)
        {
            System.Windows.DataObject data = new System.Windows.DataObject();
            switch (SelectedType)
            {
            case "VHDLTextTemplates":
            case "VerilogTextTemplates":
            case "SystemCTextTemplates":
                data.SetText(description);
                break;

            case "FSM":
            case "EntityDrawning":
            case "Schema":
                data.SetText(command);
                break;

            default:
                break;
            }
            return(data);
        }
Example #33
0
        public static void SetStoreTreeItems(IEnumerable <Windows.StoreTreeItem> items)
        {
            lock (_thisLock)
            {
                System.Windows.DataObject dataObject = new System.Windows.DataObject();

                {
                    var sb = new StringBuilder();

                    foreach (var item in items)
                    {
                        sb.AppendLine(item.Signature);
                    }

                    dataObject.SetText(sb.ToString());
                }

                dataObject.SetData("Amoeba_StoreTreeItems", Clipboard.ToStream(items));

                System.Windows.Clipboard.SetDataObject(dataObject);
            }
        }
Example #34
0
File: Editor.cs Project: Joxx0r/ATF
        /// <summary>
        /// Opens or creates a document at the given URI</summary>
        /// <param name="uri">Document URI</param>
        /// <returns>Document, or null if the document couldn't be opened or created</returns>
        public IDocument Open(Uri uri)
        {
            DomNode node = null;
            string filePath = uri.LocalPath;
            string fileName = Path.GetFileName(filePath);

            if (File.Exists(filePath))
            {
                // read existing document using standard XML reader
                using (FileStream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
                {
                    DomXmlReader reader = new DomXmlReader(m_schemaLoader);
                    node = reader.Read(stream, uri);
                }
            }
            else
            {
                // create new document by creating a Dom node of the root type defined by the schema
                node = new DomNode(Schema.winGuiCommonDataType.Type, Schema.winGuiCommonDataRootElement);
            }

            WinGuiWpfDataDocument document = null;
            if (node != null)
            {
                // Initialize Dom extensions now that the data is complete
                node.InitializeExtensions();

                WinGuiWpfDataContext context = node.As<WinGuiWpfDataContext>();
                context.SelectionChanged += ContextSelectionChanged;

                ControlInfo controlInfo = new ControlInfo(Path.Combine(filePath, fileName), StandardControlGroup.Center, new Sce.Atf.Wpf.Docking.DockContent(null, null), this);
                context.ControlInfo = controlInfo;

                // set document URI
                document = node.As<WinGuiWpfDataDocument>();
                document.Uri = uri;

                context.ListView.Tag = document;

                // If the document is empty, add some data so there's something to look at
                if (!context.Items.Any(typeof(object)))
                {
                    DomNode domNode = new DomNode(Schema.eventType.Type);
                    domNode.SetAttribute(Schema.eventType.nameAttribute, "First Event");
                    domNode.SetAttribute(Schema.eventType.durationAttribute, 100);
                    var dataObject = new System.Windows.DataObject(new object[] { domNode });
                    context.Insert(dataObject);

                    domNode = new DomNode(Schema.eventType.Type);
                    domNode.SetAttribute(Schema.eventType.nameAttribute, "Second Event");
                    domNode.SetAttribute(Schema.eventType.durationAttribute, 200);
                    var dataObject2 = new System.Windows.DataObject(new object[] { domNode });
                    context.Insert(dataObject2);
                }

                // show the ListView control
                ControlInfo registeredControlInfo = (ControlInfo)m_controlHostService.RegisterControl(context.ListView, 
                    fileName, 
                    "WPF Sample file", 
                    controlInfo.Group, 
                    fileName, 
                    this);

                if (registeredControlInfo.DockContent != null)
                {
                    registeredControlInfo.DockContent.Closing += DockContent_Closing;
                }
            }

            return document;
        }
        private void CopyProjectUrl()
        {
            string htmlData = Project.ClientName + " - " + Project.ProjectName + " (<a href=\"" + ServerUrl.Url +"/" + Project.ProjectNumber + "\">" + Project.ProjectNumber + "</a>)";
            string textData = ServerUrl.Url + "/" + Project.ProjectNumber;

            htmlData = ScrumFactory.Windows.Helpers.HTMLClipboardHelper.GetHtmlDataString(htmlData);

            System.Windows.DataObject data = new System.Windows.DataObject();
            data.SetData(System.Windows.DataFormats.UnicodeText, textData, true);
            data.SetData(System.Windows.DataFormats.Text, textData, true);
            data.SetData(System.Windows.DataFormats.OemText, textData, true);
            data.SetData(System.Windows.DataFormats.Html, htmlData, true);

            System.Windows.Clipboard.Clear();
            System.Windows.Clipboard.SetDataObject(data);
        }
Example #36
0
		protected override object StartItemDrag(SideTabItem draggedItem)
		{
			if (this.ActiveTab.ChoosedItem != draggedItem && this.ActiveTab.Items.Contains(draggedItem)) {
				this.ActiveTab.ChoosedItem = draggedItem;
			}
			var dataObject = new System.Windows.DataObject();
			dataObject.SetText(draggedItem.Tag.ToString());
			return dataObject;
		}
Example #37
0
        public static void CopyTaskTrackId(Task task, string trackId, string serverUrl)
        {
            string text = task.TaskName + " " + trackId;
            string link = GetHTMLLink(serverUrl, task);
            string html = task.TaskName + " <a href=\"" + link + "\">" + trackId + "</a>";
            html = HTMLClipboardHelper.GetHtmlDataString(html);

            System.Windows.DataObject data = new System.Windows.DataObject();
            data.SetData(System.Windows.DataFormats.UnicodeText, text, true);
            data.SetData(System.Windows.DataFormats.Text, text, true);
            data.SetData(System.Windows.DataFormats.OemText, text, true);
            data.SetData(System.Windows.DataFormats.Html, html, true);

            System.Windows.Clipboard.Clear();
            System.Windows.Clipboard.SetDataObject(data, true);
        }
        private void CopyToClipboard()
        {
            string textData = string.Empty;
            string htmlData = "<table>";
            foreach (Project p in FilteredProjects) {
                textData = textData + p.ToString() + System.Environment.NewLine;
                htmlData = htmlData + "<tr>" +  p.ToHTMLString(authorizator.ServerUrl.Url) + "</tr>";
            }

            htmlData = htmlData + "</table>";
            htmlData = HTMLClipboardHelper.GetHtmlDataString(htmlData);

            System.Windows.DataObject data = new System.Windows.DataObject();
            data.SetData(System.Windows.DataFormats.UnicodeText, textData, true);
            data.SetData(System.Windows.DataFormats.Text, textData, true);
            data.SetData(System.Windows.DataFormats.OemText, textData, true);
            data.SetData(System.Windows.DataFormats.Html, htmlData, true);

            System.Windows.Clipboard.Clear();
            System.Windows.Clipboard.SetDataObject(data);
        }
        private void CopyItemsToClipboard()
        {
            if (SelectedItemsCount == 0)
                return;

            ICollection<BacklogItemViewModel> items = SelectedItems;

            List<BacklogItem> clipItems = new List<BacklogItem>();

            string textData = string.Empty;
            foreach (BacklogItemViewModel i in items) {
                // need to ensure the order for text copy and paste
                i.Item.PlannedHours = i.Item.PlannedHours.OrderBy(p => p.Role.PermissionSet).ThenBy(p => p.Role.RoleName).ThenBy(p => p.Role.RoleShortName).ToList();
                textData = textData + i.ToString() + System.Environment.NewLine;
                clipItems.Add(i.Item.Clone());
            }

            System.Windows.DataObject data = new System.Windows.DataObject();
            data.SetText(textData, System.Windows.TextDataFormat.Text);
            data.SetData("sf_items", clipItems);
            System.Windows.Clipboard.Clear();
            System.Windows.Clipboard.SetDataObject(data);
        }
Example #40
0
        void OnCopy()
        {
            var dObj = new DataObject();

            var ms = new MemoryStream();

            var encoder = new PngBitmapEncoder();
            encoder.Frames.Add(BitmapFrame.Create(new Uri(SelectedFrame.FilePath)));

            encoder.Save(ms);
            
            dObj.SetImage(new PngBitmapDecoder(ms, BitmapCreateOptions.None, BitmapCacheOption.Default).Frames[0]);
            dObj.SetData("PNG", ms);

            Clipboard.SetDataObject(dObj, true);
        }
Example #41
0
			public WpfClipGetDataWrapper(System.Windows.DataObject value)
			{
				_dao = value;
			}
Example #42
0
        private void TxtSqlStringDragDrop(object sender, System.Windows.Forms.DragEventArgs e)
        {
            if (firstDrag == true)
            {
                this.txtSqlString.Clear();
                firstDrag = false;
            }

            // Drag and drop isn't working via e.Data.GetData, so I'm using reflection here - took me a lot of time to figure out how this works...
            // Still don't know why they implemented dnd so buggy and uncomfortable...
            string draggedFormat = e.Data.GetFormats()[0];
            IDatabaseObjectBase draggedObject = null;

            if (e.Data.GetDataPresent(draggedFormat))
            {
                object    tempDraggedObject = null;
                FieldInfo info;
                info = e.Data.GetType().GetField("innerData", BindingFlags.NonPublic | BindingFlags.Instance);
                tempDraggedObject = info.GetValue(e.Data);
                info = tempDraggedObject.GetType().GetField("innerData", BindingFlags.NonPublic | BindingFlags.Instance);
                System.Windows.DataObject dataObject = info.GetValue(tempDraggedObject) as System.Windows.DataObject;
                draggedObject = dataObject.GetData(draggedFormat) as IDatabaseObjectBase;
            }

            switch (CheckCurrentNode(draggedObject))
            {
            case NodeType.TableImage:
                // we insert Select * from.... otherwise we have to scan
                //the whole string for incorrect columnNames
                this.txtSqlString.Clear();
                this.txtSqlString.Text      = "SELECT * FROM " + (draggedObject as ICSharpCode.Data.Core.Interfaces.ITable).Name;
                reportStructure.CommandType = CommandType.Text;
                break;

            case NodeType.ColumnImage:
                string colName = (draggedObject as IColumn).Name;
                if (this.txtSqlString.Text.Length == 0)
                {
                    this.txtSqlString.AppendText("SELECT ");
                    this.txtSqlString.AppendText(colName);
                }

                else if (this.txtSqlString.Text.ToUpper(CultureInfo.InvariantCulture).IndexOf("where", StringComparison.OrdinalIgnoreCase) > 0)
                {
                    this.txtSqlString.AppendText(colName + " = ?");
                }
                else
                {
                    this.txtSqlString.AppendText(", ");
                    this.txtSqlString.AppendText(colName);
                }
                reportStructure.CommandType = CommandType.Text;
                break;

            case NodeType.ProcedureImage:
                this.txtSqlString.Clear();

                // we can't use the dragobject because it returns an string like 'EXECUTE ProcName'
                IProcedure procedure = draggedObject as IProcedure;
                this.txtSqlString.Text      = "EXECUTE " + procedure.Name;
                reportStructure.CommandType = CommandType.StoredProcedure;
//                    reportStructure.SharpQueryProcedure = new SharpQueryProcedure(new SharpQuery.Connection.OLEDBConnectionWrapper(this.connectionString), procedure.Parent.Name, procedure.SchemaName, string.Empty, procedure.Name);
                break;

            case NodeType.ViewImage:
                this.txtSqlString.Text = String.Empty;
                this.txtSqlString.Text = "No idea how to handle views";
                break;

            default:
                break;
            }
            base.EnableNext = true;
        }
        private void CopyTasksToClipboard()
        {
            if (SelectedTasksCount==0)
                return;

            ICollection<TaskViewModel> tasks = SelectedTasks;

            List<Task> clipTasks = new List<Task>();

            string textData = string.Empty;
            string htmlData = "<table>";
            foreach (TaskViewModel t in tasks) {
                textData = textData + t.ToString() + System.Environment.NewLine;
                htmlData = htmlData + "<tr>" + t.ToHTMLString() + "</tr>";
                clipTasks.Add(t.Task.Clone());
            }

            htmlData = htmlData + "</table>";
            htmlData = HTMLClipboardHelper.GetHtmlDataString(htmlData);

            System.Windows.DataObject data = new System.Windows.DataObject();
            data.SetData(System.Windows.DataFormats.UnicodeText, textData, true);
            data.SetData(System.Windows.DataFormats.Text, textData, true);
            data.SetData(System.Windows.DataFormats.OemText, textData, true);
            data.SetData(System.Windows.DataFormats.Html, htmlData, true);
            data.SetData("sf_tasks", clipTasks);

            System.Windows.Clipboard.Clear();
            System.Windows.Clipboard.SetDataObject(data);
        }