public VoiceChatViewModel(AudioStreamingService audioStreamingService, EventAggregator eventAggregator, ServerServiceProxy serverServiceProxy) { this.audioStreamingService = audioStreamingService; this.serverServiceProxy = serverServiceProxy; this.cancelCallCommand = DelegateCommand <object> .FromAsyncHandler(this.OnCancelCall); this.acceptCallCommand = DelegateCommand <object> .FromAsyncHandler(this.OnAcceptCall); this.windowLoadedCommand = DelegateCommand <object> .FromAsyncHandler(this.OnWindowLoaded); eventAggregator.GetEvent <AcceptedCallEvent>().Subscribe(OnCallAccepted, ThreadOption.UIThread, true); eventAggregator.GetEvent <CanceledCallEvent>().Subscribe(OnCallCanceled, ThreadOption.UIThread, true); }
/// <summary> /// creates a new instance of the <see cref="ChatModule"/> class /// </summary> /// <param name="regionManager">injected by the <see cref="IUnityContainer"/>, stored in <see cref="regionManager"/></param> /// <param name="container">injected by the <see cref="IUnityContainer"/>, stored in <see cref="container"/></param> /// <param name="audioStreamer">injected by the <see cref="IUnityContainer"/>, stored in <see cref="audioStreamer"/></param> public ChatModule(IRegionManager regionManager, IUnityContainer container, ModuleManager moduleManager, AudioStreamingService audioStreamer, ServerServiceProxy serverServiceProxy) { this.container = container; this.audioStreamer = audioStreamer; regionManager.RegisterViewWithRegion(RegionNames.MainNavigationRegion, typeof(ChatNavigationItemView)); this.audioInitWorker = new BackgroundWorker(); audioInitWorker.DoWork += audioInitWorker_DoWork; moduleManager.LoadModuleCompleted += (s, e) => { audioInitWorker.RunWorkerAsync(); }; }
/// <summary> /// creates a new instance of the <see cref="OptionsViewModel"/> class /// </summary> /// <param name="audioStreamingService">will be injected by the <see cref="IUnityContainer"/>, stored in <see cref="audioStreamingService"/></param> public OptionsViewModel(AudioStreamingService audioStreamingService, ServerServiceProxy serverService) { this.audioStreamingService = audioStreamingService; this.serverService = serverService; this.inputDeviceSelectionChanged = new DelegateCommand <object>(this.OnInputDeviceSelectionChanged); this.outputDeviceSelectionChanged = new DelegateCommand <object>(this.OnOutputDeviceSelectionChanged); this.statusSelectionChanged = DelegateCommand <object> .FromAsyncHandler(this.OnStatusSelectionChanged); this.accountInfoSendCommand = DelegateCommand <object> .FromAsyncHandler(this.OnAccountInfoSendCommand, CanSendAccountInfo); InputDevices = new ObservableCollection <string>(audioStreamingService.GetInputDevice()); OutputDevices = new ObservableCollection <string>(audioStreamingService.GetOutputDevice()); List <string> statuses = new List <string>(Enum.GetNames(typeof(Status))); statuses.Remove(statuses.Where(status => status.Equals(Status.Web.ToString())).First()); StatusStrings = statuses; }