Esempio n. 1
0
 private void toolButtonPlay_Click(object sender, EventArgs e)
 {
     if (mSelectedVoiceMailEntry != null && mSelectedVoiceMailEntry.Cached)
     {
         toolButtonPlay.Visible = false;
         toolButtonStop.Visible = true;
         StartPlayingVoiceMail(mSelectedVoiceMailEntry, e);
         mSelectedVoiceMailEntry.ArchiveLocal();
     }
 }
Esempio n. 2
0
        void MessageListUpdate(MailService.FileInfo[] list)
        {
            int newInboxFiles   = 0;
            int newArchiveFiles = 0;

            foreach (MailService.FileInfo info in list)
            {
                try
                {
                    //File was not in our local list, so add it
                    if (pEmailEntries.Controls.ContainsKey(info.FileName) == false)
                    {
                        if (info.Location == MailService.LocationType.INBOX)
                        {
                            ++newInboxFiles;
                        }
                        else if (info.Location == MailService.LocationType.ARCHIVE)
                        {
                            ++newArchiveFiles;
                        }

                        String newFileInfoName  = this.BasePath + info.Location.ToString() + @"\" + info.FileName + ".xml";;
                        String tempFileInfoName = Path.GetTempFileName();

                        XmlSerializer ser = new XmlSerializer(typeof(InfoFile));
                        FileStream    fs  = File.OpenWrite(tempFileInfoName);

                        InfoFile infoFile = new InfoFile(info);
                        infoFile.Cached = File.Exists(mBaseDirectory + info.Location.ToString() + @"\" + info.FileName);

                        ser.Serialize(fs, infoFile);
                        fs.Close();

                        //Now move files
                        if (File.Exists(newFileInfoName))
                        {
                            File.Delete(newFileInfoName);
                        }
                        File.Move(tempFileInfoName, newFileInfoName);

                        pEmailEntries.Controls.Add(new VoiceMailEntry(this, infoFile));
                    }
                    else
                    {
                        //Check for a message which may have moved from Inbox to Archive
                        VoiceMailEntry entry = (VoiceMailEntry)pEmailEntries.Controls[info.FileName];
                        if ((MailService.LocationType)entry.Info.Location != info.Location && info.Location == MailService.LocationType.ARCHIVE)
                        {
                            entry.ArchiveLocal();
                        }
                    }
                }
                catch
                {
                }
            }

            if (newInboxFiles > 0 || newArchiveFiles > 0)
            {
                OnNewMailEvent(this, newInboxFiles, newArchiveFiles);
            }
        }