Example #1
0
        public MainViewModel(IAudioRecorder audioRecorder, Settings settings, ICallNumber callNumber, IReactOnCall reactOnCall, ICreateTimer createTimer, IUnMutePhone unmutePhone, IMutePhone mutePhone, ISpeaker speaker)
        {
            this.Settings            = settings;
            this.m_RecorderViewModel = audioRecorder;
            this.m_RecorderViewModel.Start();
            this.m_PhoneViewModel       = new PhoneViewModel(m_RecorderViewModel, settings, callNumber, reactOnCall, createTimer, mutePhone, unmutePhone, speaker);
            this.m_InfoTimer            = createTimer.Create(new TimeSpan(0, 0, 0, 0, 250));
            this.m_InfoTimer.AutoReset  = true;
            this.m_InfoTimer.MyElapsed += m_Timer_Elapsed;

            this.m_InfoTimer.Start();
        }
Example #2
0
        public PhoneViewModel(IAudioRecorder recorder, Settings settings, ICallNumber callNumber, IReactOnCall reactOnCall, ICreateTimer createTimer, IMutePhone mutePhone, IUnMutePhone unmutePhone, ISpeaker speaker)
        {
            this.IsStarted                = false;
            this.m_Speaker                = speaker;
            this.m_UnmutePhone            = unmutePhone;
            this.m_MutePhone              = mutePhone;
            this.m_Settings               = settings;
            this.m_CallNumber             = callNumber;
            this.m_AudioRecorderViewModel = recorder;

            this.m_PhoneTimer            = createTimer.Create(new TimeSpan(0, 0, 0, 1, 0));
            this.m_PhoneTimer.AutoReset  = false;
            this.m_PhoneTimer.MyElapsed += m_PhoneTimer_Elapsed;

            this.m_ReactOnCall = reactOnCall;
            this.m_ReactOnCall.Register(this.OnHangUp);
        }
Example #3
0
        private void CleanUp()
        {
            if (null != this.m_PhoneTimer)
            {
                this.m_PhoneTimer.Stop();
                this.m_PhoneTimer.MyElapsed -= m_PhoneTimer_Elapsed;
                this.m_PhoneTimer.Dispose();
                this.m_PhoneTimer = null;
            }

            if (null != m_MutePhone)
            {
                this.m_MutePhone.Dispose();
                this.m_MutePhone = null;
            }

            if (null != m_UnmutePhone)
            {
                this.m_UnmutePhone.Dispose();
                this.m_UnmutePhone = null;
            }

            if (null != m_ReactOnCall)
            {
                m_ReactOnCall.Dispose();
                m_ReactOnCall = null;
            }

            if (null != m_CallNumber)
            {
                m_CallNumber.Dispose();
                m_CallNumber = null;
            }

            if (null != m_AudioRecorderViewModel)
            {
                m_AudioRecorderViewModel.Dispose();
                m_AudioRecorderViewModel = null;
            }
        }