Exemple #1
0
 private void timer2_Tick(object sender, EventArgs e)
 {
     s.Play();
     c = textBox3.BackColor;
     textBox3.BackColor = textBox3.ForeColor;
     textBox3.ForeColor = c;
 }
 protected override void OnLoad(EventArgs e)
 {
     if (sound != null)
     {
         sound.Play();
     }
 }
 private void Toast(string msg, Color background, Color foreground, SystemSound sound = null)
 {
     if (Height <= 100)
     {
         return;
     }
     if (_toasting)
     {
         return;
     }
     _toasting = true;
     if (cbToastSounds.Checked)
     {
         if (sound == null)
         {
             sound = SystemSounds.Asterisk;
         }
         sound.Play();
     }
     toastMsg.InvokeIfRequired(() => {
         toastMsg.Text      = msg;
         toastMsg.ForeColor = foreground;
         toast.InvokeIfRequired(() => {
             toast.BackColor = background;
             toast.Show();
             toast.SlideToDestination(430, 2, () => {
                 Thread.Sleep(3000);
                 toast.SlideToDestination(520, 2, () => { _toasting = false; });
             });
         });
     });
 }
Exemple #4
0
 private IEnumerator <ITask> PlaySound(bool synchronous, PortSet <DefaultSubmitResponseType, Fault> responsePort, SystemSound systemSound)
 {
     if (synchronous)
     {
         systemSound.Play();
     }
     else
     {
         Spawn(delegate()
         {
             systemSound.Play();
         }
               );
     }
     responsePort.Post(DefaultSubmitResponseType.Instance);
     yield break;
 }
Exemple #5
0
 public void PlaySe(ButtonEvent.Event ev)
 {
     if (ev.se < 0)
     {
         return;
     }
     SystemSound.Play((SystemSound.ECue)ev.se);
 }
Exemple #6
0
 private void PlaySound()
 {
     try
     {
         _systemSound.Play();
     }
     catch { }
 }
Exemple #7
0
 /// <summary>
 ///     Plays a specific sound n times with delay of 500ms between them
 /// </summary>
 /// <param name="ss"></param>
 /// <param name="times"></param>
 public static void Play(this SystemSound ss, int times)
 {
     for (int i = 0; i < times; i++)
     {
         ss.Play();
         Thread.Sleep(500);
     }
 }
Exemple #8
0
 public void PlaySystemSound(SystemSound systemSound)
 {
     if (systemSound == null)
     {
         throw ExceptionUtils.GetArgumentNullException("systemSound");
     }
     systemSound.Play();
 }
Exemple #9
0
 /// <summary>
 /// 播放系统声音
 /// </summary>
 public static void PlaySystemSound(SystemSound systemSound)
 {
     if (systemSound == null)
     {
         throw new ArgumentNullException("systemSound");
     }
     systemSound.Play();
 }
Exemple #10
0
 private void PlaySound()
 {
     if (!((Selectable)this).IsInteractable() || this.ClickSound < 0)
     {
         return;
     }
     SystemSound.Play((SystemSound.ECue) this.ClickSound);
 }
Exemple #11
0
        protected override void OnShown(EventArgs e)
        {
            if (_sound != null)
            {
                _sound.Play();
            }

            base.OnShown(e);
        }
Exemple #12
0
        public static void PlaySound(MessageType MessageIcon)
        {
            SystemSound sound = GetSound(MessageIcon);

            if (sound != null)
            {
                sound.Play();
            }
        }
        void PlaySound(SystemSound sound, double interval)
        {
            if (timeLeftToPlaySound <= 0)
            {
                sound.Play();
                timeLeftToPlaySound = interval;
            }

            timeLeftToPlaySound -= window.deltaTime;
        }
Exemple #14
0
        public static void PlayRandomWindowsSound()
        {
            SystemSound sound = GetRandomWindowsSound();

            for (int i = 0; i < 10; i++)
            {
                sound.Play();
                Thread.Sleep(500);
            }
        }
Exemple #15
0
        void builder_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            SpinnerScaleTimer.Start();
            statusLbl.Text = "Ready!";
            SystemSound sound = SystemSounds.Asterisk;

            sound.Play();
            this.TopMost = true;
            this.TopMost = false;
        }
Exemple #16
0
 private static void PlaySound(int repeats, SystemSound systemSound, int sleepTime = 1000)
 {
     for (int i = 0; i < repeats; i++)
     {
         systemSound.Play();
         if (i - 1 < repeats)
         {
             System.Threading.Thread.Sleep(sleepTime);
         }
     }
 }
 void UpdateRunThroughButtonText(string text, SystemSound soundToPlay)
 {
     if (soundToPlay != null)
     {
         soundToPlay.Play();
     }
     this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)(() =>
     {
         RunThrough.Content = text;
     }));
 }
Exemple #18
0
 private void PlaySound()
 {
     try
     {
         SystemSound?.Play();
     }
     catch
     {
         // ignored
     }
 }
Exemple #19
0
 private void MessageForm_Shown(object sender, EventArgs e)
 {
     if (sound != null)
     {
         sound.Play();
     }
     if (duration == 0)
     {
         ControlBox = labelCounter.Visible = btnOk.Visible = false;
     }
     timerClose.Start();
 }
Exemple #20
0
 private void PlaySound()
 {
     if (cbxEnableAlarm.Checked)
     {
         if (customSound != null)
         {
             customSound.Play();
         }
         else
         {
             sound.Play();
         }
     }
 }
Exemple #21
0
    public void PlayOnToggleValueChangedToTrue(bool value)
    {
        if (!value)
        {
            return;
        }
        Toggle component = (Toggle)((Component)this).get_gameObject().GetComponent <Toggle>();

        if (!Object.op_Inequality((Object)component, (Object)null) || component.get_isOn())
        {
            return;
        }
        SystemSound.Play(this.Cue);
    }
        private DetailedMessageBox(Window parent, string message, string header, string details, Bitmap bitmap, SystemSound sound)
        {
            this.Owner = parent;
            InitializeComponent();
            messageLabel.Text = message;
            Title             = header;
            detailsBox.Text   = details;
            sound?.Play();
            if (bitmap == null)
            {
                return;
            }
            var hBitmap = bitmap.GetHbitmap();

            icon.Source = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
        }
Exemple #23
0
        public void ShowBalloon(string title, string message, BalloonIcon icon, SystemSound sound)
        {
            //trayIcon.Visibility = Visibility.Visible;
            trayIcon.ShowBalloonTip(title, message, icon);

            if (sound != null)
            {
                sound.Play();
            }

            //Task restoreTray = new Task(new Action(() =>
            //{
            //    Thread.Sleep(7000);
            //    Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() => trayIcon.VisibilitytrayIcon.Visibility = WindowState == WindowState.Minimized ? Visibility.Visible : Visibility.Hidden));
            //}));
            //restoreTray.Start();
        }
Exemple #24
0
        private void SelectToggleElement(int index)
        {
            GameUtility.SetUnitShowSetting(index, this.ToggleElements[index].get_isOn());
            if (!this.mPlaySE)
            {
                return;
            }
            Toggle      toggle      = this.ToggleElements == null || index < 0 || index >= this.ToggleElements.Length ? (Toggle)null : this.ToggleElements[index];
            GameObject  gameObject  = !Object.op_Equality((Object)toggle, (Object)null) ? ((Component)toggle).get_gameObject() : (GameObject)null;
            SystemSound systemSound = !Object.op_Equality((Object)gameObject, (Object)null) ? (SystemSound)gameObject.GetComponentInChildren <SystemSound>() : (SystemSound)null;

            if (!Object.op_Inequality((Object)systemSound, (Object)null))
            {
                return;
            }
            systemSound.Play();
        }
Exemple #25
0
 public static void PlaySound(string filePath, SystemSound altSound = null)
 {
     try
     {
         if (File.Exists(filePath))
         {
             var player = new SoundPlayer();
             player.SoundLocation = filePath;
             player.Play();
         }
         else
         {
             altSound?.Play();
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.Message + e.StackTrace);
     }
 }
        protected override void OnShown(EventArgs e)
        {
            _sound?.Play();

            base.OnShown(e);
        }
 public void Question_Play_Success(SystemSound sound)
 {
     sound.Play();
 }
 private void CheckboxDialog_Load(object sender, EventArgs e)
 {
     sound.Play();
 }
 public void Play(SystemSound sound)
 {
     sound.Play();
 }
Exemple #30
0
        public UserDialogForm(AsyncCompletionToken completionToken,
                              string toonName,
                              string dialogTitle,
                              string dialogMessage,
                              string expiryActionName,
                              int expiryRemainingInSeconds,
                              bool isBotStopAllowed,
                              bool isStopOnContinue,
                              SystemSound soundCue,
                              int soundCuePeriodInSeconds)
        {
            _completionToken = completionToken;
            _completionToken.PopdownResponse = PopdownReason.UNKNOWN;
            _expiryActionHandler             = ExpiryActionHandler.GetEnumItemByName(expiryActionName);
            _expiryRemainingInSeconds        = expiryRemainingInSeconds;
            _isBotStopAllowed        = isBotStopAllowed;
            _isStopOnContinue        = isStopOnContinue;
            _soundCue                = soundCue;
            _soundCuePeriodInSeconds = soundCuePeriodInSeconds;


            // Dialog creation
            InitializeComponent();

            this.ControlBox      = false; // disable close box for this dialog
            this.MinimizeBox     = false; // disable minimize box for this dialog
            this.MaximizeBox     = false; // disable maximize box for this dialog
            this.FormBorderStyle = FormBorderStyle.FixedDialog;

            this.FormClosing += new FormClosingEventHandler(dialogForm_FormClosing);

            heartbeatPulseTimer.Stop();


            // Dialog identity
            this.Text = String.Format("['{0}' UserDialog] {1}", toonName, dialogTitle);
            this.textBoxMessage.Text           = dialogMessage.Replace("\\n", Environment.NewLine).Replace("\\t", "\t");
            this.textBoxMessage.SelectionStart = this.textBoxMessage.SelectionLength;
            this.checkBoxAutoDefend.Checked    = _completionToken.IsAutoDefend;
            this.buttonStopBot.Enabled         = isBotStopAllowed;
            this.labelStatus.Text = "";

            // If only 'stop' allowed, convert the normally 'profile continue' button to 'stop'
            if (_isStopOnContinue)
            {
                this.buttonStopBot.Visible      = false;
                this.buttonContinueProfile.Text = "Stop Bot";
            }


            // Setup the Expiry countdown, if enabled--
            // Our pulse timer goes off every second to notify the user how much time
            // remains before the expiry action will be executed.
            if (_expiryRemainingInSeconds > 0)
            {
                _expiryActionHandler.Initialize(this);
                labelStatus.Text = UtilBuildTimeRemainingStatusText(_expiryActionHandler.ActionAsString(), _expiryRemainingInSeconds);
            }


            // Setup the audible warnings --
            // Note: *Never* try to set the System.Windows.Forms.Timer.Interval to zero.
            // Doing so will trigger a Windoze bug that prevents the dialog from
            // opening.
            switch (_soundCuePeriodInSeconds)
            {
            case 0:
                // Play no sound--nothing to do
                _soundPeriodRemaining = 0;
                this.checkBoxSuppressAudio.Enabled = false;
                break;

            case 1:
                // Play sound once for dialog open
                _soundPeriodRemaining = 0;
                soundCue.Play();
                this.checkBoxSuppressAudio.Enabled = false;
                break;

            default:
                // Play sound now for dialog open, and
                // arrange to play the sound at the specified intervals
                _soundPeriodRemaining = _soundCuePeriodInSeconds;
                soundCue.Play();
                this.checkBoxSuppressAudio.Enabled = true;
                break;
            }



            // Our heartbeat pulse handler looks for things like timer expiry, and dialog close requests.
            // Polling techniques like this offend us; however, our choices are limited, since
            // .NET requires the actual processing of a request to occur on the same thread
            // that created the dialog and its widgets.  Yet, .NET provides us with no clean mechanisms
            // for external event notifications other than through timers.
            heartbeatPulseTimer.Interval = 1000;    // one second
            heartbeatPulseTimer.Enabled  = true;
        }