コード例 #1
0
        private async System.Threading.Tasks.Task AddActionAsync(IDEEventType iDEEventType)
        {
            var sourceType = GetIDEEventSource(iDEEventType);

            if (sourceType == IDEEventSourceType.CommandEvent)
            {
                await SetEventForActionAsync(iDEEventType);
            }
            else if (sourceType == IDEEventSourceType.DteEvent)
            {
                if (iDEEventType == IDEEventType.Building)
                {
                    _buildEvents.OnBuildDone  += Building_OnBuildDone;
                    _buildEvents.OnBuildBegin += Building_OnBuildBegin;
                }
                else if (iDEEventType == IDEEventType.Breakepoint)
                {
                    _debuggerEvents.OnEnterBreakMode += DebuggerEvents_OnEnterBreakMode;;
                }
                else if (iDEEventType == IDEEventType.Exception)
                {
                    _debuggerEvents.OnExceptionNotHandled += DebuggerEvents_OnExceptionNotHandled;
                    _debuggerEvents.OnExceptionThrown     += DebuggerEvents_OnExceptionThrown;;
                }
            }
        }
コード例 #2
0
 private void SetSoundForSingleEvent(IDEEventType iDEEventType, bool loop)
 {
     _ = System.Threading.Tasks.Task.Run(async() =>
     {
         await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
         DamnGoodPlayer.Instance.PlaySound(iDEEventType, loop);
     }).ConfigureAwait(false);
 }
コード例 #3
0
        private async System.Threading.Tasks.Task SetEventForActionAsync(IDEEventType iDEEventType)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            string actionName = IDEEventTypeMapper.IDEEventTypeToVSAction(iDEEventType);

            Command cmdobj       = _commands.Item(actionName, 0);
            var     commandEvent = _events.CommandEvents[cmdobj.Guid, cmdobj.ID];

            commandEvent.BeforeExecute += (string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault) =>
            {
                DamnGoodPlayer.Instance.PlaySound(iDEEventType);
            };
            _actionCommandEvents.Add(actionName, commandEvent);
        }
コード例 #4
0
        public static string IDEEventTypeToVSAction(IDEEventType iDEEventType)
        {
            switch (iDEEventType)
            {
            case IDEEventType.FileSave:
                return(Action_Save);

            case IDEEventType.FileSaveAll:
                return(Action_SaveAll);

            case IDEEventType.Unknown:
            default:
                return(string.Empty);
            }
        }
コード例 #5
0
        public static string IDEEventTypeToSoundPath(IDEEventType iDEEventType)
        {
            string path = string.Empty;

            switch (iDEEventType)
            {
            case IDEEventType.Unknown:
                path = "ohno!";
                break;

            default:
                path = iDEEventType.ToString();
                break;
            }
            return(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Audio", $"{path}.wav"));
        }
コード例 #6
0
        public void PlaySound(IDEEventType iDEEventType, bool loop = false)
        {
            var path = IDEEventTypeMapper.IDEEventTypeToSoundPath(iDEEventType);

            _player.Stop();
            _player.SoundLocation = path;

            if (MakeTheSoundEventCatcher.Instance.OptionsPage.IsAudioActive(iDEEventType))
            {
                if (loop)
                {
                    _player.PlayLooping();
                }
                else
                {
                    _player.Play();
                }
            }
        }
コード例 #7
0
 private IDEEventSourceType GetIDEEventSource(IDEEventType iDEEventType)
 {
     return(typeof(IDEEventType).GetMember(iDEEventType.ToString())
            .First()
            .GetCustomAttribute <IDEEventSourceAttribute>().IDEEventSourceType);
 }
コード例 #8
0
 public bool IsAudioActive(IDEEventType iDEEventType)
 {
     return(_eventTypeConfig[iDEEventType]);
 }