示例#1
0
        /// <summary>
        /// The function to call when sending a picture
        /// </summary>
        /// <param name="cp">fill the packet with the appropriate information and write the image to the stream</param>
        public void SendPicture()
        {
            Microsoft.Win32.OpenFileDialog ofd;
            ofd                  = new Microsoft.Win32.OpenFileDialog();
            ofd.FileName         = "openFileDialog1";
            ofd.Filter           = "(*.JPG, *.GIF, *.PNG)|*.jpg;*.gif;*.png|All Files (*.*)|*.*";
            ofd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
            ofd.RestoreDirectory = true;
            ofd.Title            = "Select a Picture";


            //check return value, but how in wpf?
            bool ok = (bool)ofd.ShowDialog();

            if (ok)
            {
                System.IO.Stream stream;
                if ((stream = ofd.OpenFile()) != null)
                {
                    PicturePacket packet = new PicturePacket();
                    packet.s        = stream;
                    packet.fileName = System.IO.Path.GetFileName(ofd.FileName);
                    MetadataFileInfo md = new MetadataFileInfo();
                    md.ReadMetaData(ofd.FileName);
                    packet.title          = md.Title;
                    packet.senderNodeName = mNodeName;
                    mOperationContract(packet);
                }
            }
        }
示例#2
0
 public void SendPicture(PicturePacket pp)
 {
     if (pp != null)
     {
         mOperationContract(pp);
     }
 }
示例#3
0
 /// <summary>
 /// Implements the Share Picture interface
 /// </summary>
 /// <param name="member"></param>
 public void SharePicture(PicturePacket cp)
 {
     //look to see if anyone is listening, if so perform the callback.
     if (mPictureChanged != null)
     {
         mPictureChanged(this, new PictureChangedEventArgs(cp));
     }
 }
示例#4
0
        public void SendPicture(Stream stream, String title)
        {
            PicturePacket packet = new PicturePacket();

            packet.s              = stream;
            packet.title          = title;
            packet.senderNodeName = mNodeName;
            mOperationContract(packet);
        }
示例#5
0
        /// <summary>
        /// Make a call to this in order to send a picture.
        /// </summary>
        /// <param name="fullFileName"></param>
        public void SendPicture(String fullFileName)
        {
            if (fullFileName == null)
            {  //send an empty picture...
                PicturePacket packet = new PicturePacket();
                packet.s = new MemoryStream();
                packet.senderNodeName = mNodeName;
                mOperationContract(packet);
                return;
            }

            System.IO.Stream stream;
            if ((stream = System.IO.File.OpenRead(fullFileName)) != null)
            {
                PicturePacket packet = new PicturePacket();
                packet.s        = stream;
                packet.fileName = System.IO.Path.GetFileName(fullFileName);
                MetadataFileInfo md = new MetadataFileInfo();
                md.ReadMetaData(fullFileName);
                packet.title          = md.Title;
                packet.senderNodeName = mNodeName;
                mOperationContract(packet);
            }
        }
示例#6
0
 public PictureChangedEventArgs(PicturePacket cp)
 {
     mChunkedPacket = cp;
 }
示例#7
0
 public void SharePicture(PicturePacket packet)
 {
     CheckDisposed();
     mPicture.SharePicture(packet);
 }