Beispiel #1
0
        static void SetSound(IXmlDocument xmldoc, PredefinedSound sound)
        {
            string      soundXml = "ms-winsoundevent:" + sound.ToString().Replace("_", ".");
            IXmlElement soundElement;

            ComFunctions.CheckHRESULT(xmldoc.CreateElement("audio", out soundElement));
            if (sound == PredefinedSound.NoSound)
            {
                ComFunctions.CheckHRESULT(soundElement.SetAttribute("silent", "true"));
            }
            else
            {
                ComFunctions.CheckHRESULT(soundElement.SetAttribute("src", soundXml));
                ComFunctions.CheckHRESULT(soundElement.SetAttribute("loop", IsLoopingSound(sound).ToString().ToLower()));
            }
            var          asNode = (IXmlNode)xmldoc;
            IXmlNode     appendedChild;
            IXmlNodeList nodes;

            ComFunctions.CheckHRESULT(xmldoc.GetElementsByTagName("toast", out nodes));
            IXmlNode toastNode;

            ComFunctions.CheckHRESULT(nodes.Item(0, out toastNode));
            ComFunctions.CheckHRESULT(toastNode.AppendChild((IXmlNode)soundElement, out appendedChild));
        }
Beispiel #2
0
        static void SetSound(IXmlDocument xmldoc, PredefinedSound sound)
        {
            string      soundXml     = "ms-winsoundevent:" + sound.ToString().Replace("_", ".");
            IXmlElement soundElement = CreateElement(xmldoc, "audio");

            if (sound == PredefinedSound.NoSound)
            {
                SetAttribute(soundElement, "silent", "true");
            }
            else
            {
                SetAttribute(soundElement, "src", soundXml);
                SetAttribute(soundElement, "loop", IsLoopingSound(sound).ToString().ToLower());
            }
            IXmlNode toastNode = GetNode(xmldoc, "toast");

            AppendNode(toastNode, (IXmlNode)soundElement);
        }
Beispiel #3
0
 public void SetSound(PredefinedSound sound)
 {
     this.sound = sound;
 }
Beispiel #4
0
 static bool IsLoopingSound(PredefinedSound sound)
 {
     return(sound >= PredefinedSound.Notification_Looping_Alarm);
 }
 public void SetSound(PredefinedSound sound) {
     this.sound = sound;
 }
 static void SetSound(IXmlDocument xmldoc, PredefinedSound sound) {
     string soundXml = "ms-winsoundevent:" + sound.ToString().Replace("_", ".");
     IXmlElement soundElement;
     ComFunctions.CheckHRESULT(xmldoc.CreateElement("audio", out soundElement));
     if(sound == PredefinedSound.NoSound) {
         ComFunctions.CheckHRESULT(soundElement.SetAttribute("silent", "true"));
     }
     else {
         ComFunctions.CheckHRESULT(soundElement.SetAttribute("src", soundXml));
         ComFunctions.CheckHRESULT(soundElement.SetAttribute("loop", IsLoopingSound(sound).ToString().ToLower()));
     }
     var asNode = (IXmlNode)xmldoc;
     IXmlNode appendedChild;
     IXmlNodeList nodes;
     ComFunctions.CheckHRESULT(xmldoc.GetElementsByTagName("toast", out nodes));
     IXmlNode toastNode;
     ComFunctions.CheckHRESULT(nodes.Item(0, out toastNode));
     ComFunctions.CheckHRESULT(toastNode.AppendChild((IXmlNode)soundElement, out appendedChild));
 }
 static bool IsLoopingSound(PredefinedSound sound) {
     return sound >= PredefinedSound.Notification_Looping_Alarm;
 }