Beispiel #1
0
		}//end constructor

		private void FormFavorites_Load(object sender, EventArgs e)
		{
			m_listFavorites_SizeChanged(sender, e);
			for (int i = 0; i < m_ClipboardFavorites.Count; i++)
			{
				ClipboardEntryLogic entry = m_ClipboardFavorites.GetEntry(i);
				string sText = entry.ShortDesc();
				int ico = entry._icoItemType;

				ListViewItem itm = m_listFavorites.Items.Add(sText, ico);
				itm.Tag = entry;
			}//end for
			m_listFavorites_SelectedIndexChanged(null, null);
		}//end FormFavorites_Load
Beispiel #2
0
        }        //end Save

        //for load from Xml
        public static ClipboardEntryLogic Load(XmlNode nd, string sOwnerType, Image icoDefault, string baseFolder)
        {
            ClipboardEntryLogic entry = new ClipboardEntryLogic(sOwnerType);

            entry._dataType  = XmlUtil.GetStrAtt(nd, "Type", DataFormats.Text);
            entry._svFormats = new string[] { entry._dataType };

            entry._ownerType = XmlUtil.GetStrAtt(nd, "OwnerType", "");
            if (entry._ownerType != sOwnerType)
            {
                throw new Exception(OWNER_TYPE_MISMATCH);
            }

            string Value          = nd.InnerText;
            string sImageFileName = XmlUtil.GetStrAtt(nd, "Ico", "Image001");
            Image  ico            = LoadImage(Path.Combine(baseFolder, sImageFileName), icoDefault);

            entry._icoAppFrom = ico;
            if (ico == null)
            {
                entry._icoAppFrom = new Bitmap(16, 16);
            }

            if (entry._dataType == DataFormats.Rtf)
            {
                entry._icoItemType = 2;
                entry._data        = Value;
                m_RtfBox.Rtf       = Value;
                entry._desc        = m_RtfBox.Text;
                if (entry._desc.Trim().Length == 0)
                {
                    entry._desc = "--Rtf Binary--";
                }
            }            //end if
            else if (entry._dataType == DataFormats.UnicodeText)
            {
                entry._icoItemType = 1;
                entry._data        = Value;
                entry._desc        = Value;
            }            //end else if
            else if (entry._dataType == DataFormats.Text)
            {
                entry._icoItemType = 0;
                entry._data        = Value;
                entry._desc        = Value;
            }            //end else if
            else if (entry._dataType == DataFormats.FileDrop)
            {
                entry._icoItemType = 4;
                String[] sv = Value.Split('|');
                entry._data = sv;
                entry._desc = entry.FileDropListDesc(sv);
            }            //end else if
            else
            {
                throw new Exception("Unknown clipboard format");
            }            //end else

            System.Diagnostics.Trace.WriteLine(
                "File: " + Path.GetFileName(sImageFileName) +
                " Entry: " + entry.ShortDesc());

            return(entry);
        }        //end Load